Avatar for Kalus

Kalus

Member since Feb 2014 • Last active May 2014
  • 0 conversations
  • 7 comments

Most recent activity

  • in Interfacing
    Avatar for Kalus

    Great idea. I suggest to initially add it to the existing Implementation.
    Buffersize @ .Setup ?
    Some builds later you could remove the old.
    I guess you would also add 'error' and/or 'break' later, right ?

  • in Interfacing
    Avatar for Kalus

    @JumJum yes, for sure (sorry i had been at the hospital for some days). It's runcode but it could be easily converted to a Driver like the SSD1351 :

    SPI1.setup({ mosi:A7, sck:A5, baud:2000000 });
    
    function connect (/*=SPI*/spi, /*=PIN*/dc, /*=PIN*/cs, /*=PIN*/rst, callback) {
      cs.write(1); // disable
      dc.write(0); // command
      rst.write(0); // reset
      var cd = function (c,d) {
        dc.write(0); // command
        spi.send(c);
        if (d!==undefined) {
          dc.write(1); // data
          spi.send(d);
        }
      };
      setTimeout(function() { // 20ms delay
        rst.write(1); // un-reset
        setTimeout(function() { // 120ms delay
          cs.write(0); // enable
    
          // cd(0x01); // ST7735: Software reset
          // wait 120ms
          
          // cd(0x00); // ST7735: No Operation
          
          // cd(0x10); // ST7735: SLPIN Sleep in & booster off
          cd(0x11); // ST7735: SLPOUT Sleep out & booster on
          // cd(0x12); // ST7735: PTLON Partial mode on
          // cd(0x13); // ST7735: NORON Partial off (Normal)
          
          // cd(0x38); // ST7735: IDMOFF Idle mode off
          // cd(0x39); // ST7735: IDMON Idle mode on
          
          // cd(0x20); // ST7735: INVOFF Display inversion off
          // cd(0x21); // ST7735: INVON Display inversion on
          cd(0x26,8);  // ST7735: GAMSET Gamma curve select
          // cd(0x28); // ST7735: DISPOFF Display off
                
          // cd(0x30,[psl15_8, psl7_0, pel15_8, pel7_0]); // ST7735: PTLAR Partial start/End address set
          // cd(0x34); // ST7735: TEOFF tearing effect line off
          // cd(0x35, telom); // ST7735: TEON Tearing effect mode set & on
          
          // ST7735: MADCTL Memory data access control (rotation, mirror, rgb/bgr, refresh order)
          cd(0x36, 0xC0); // horizontal128, vertical160, connector at bottom, no mirror
          // cd(0x36, 0x00); // horizontal128, vertical160, connector at top, no mirror
          
          // ST7735: COLMOD Interface pixel format 
          cd(0x3a, 5); // 5 =  16bit/pixel
          
          // ST7735: Panel function Command List
          // cd(0xB1,[rtna3_0, fpa5_0, bpa5_0]); // ST7735: FRMCTR1 In normal mode (Full colors)
          // cd(0xB2,[rtnb3_0, fpb5_0, bpb5_0]); // ST7735: FRMCTR2 In Idle mode (8-colors)
          // cd(0xB3,[rtnc3_0, fpc5_0, bpc5_0, rtnd3_0, fpd5_0, bpd5_0]); // ST7735: FRMCTR3 In partial mode + Full colors
          // cd(0xB4, nla_c); // ST7735: INVCTR Display inversion control
          // cd(0xB6, [no1_0_sdt1_0_eq1_0, ptg1_0_pt1_0]); // ST7735: DISSET5 Display function setting
                
          cd(0x29); // ST7735: DISPON Display on
    
          cs.write(1); // disable
          if (callback!==undefined) callback();
        }, 120);
      }, 20);
    
      return Graphics.createCallback(128,160,16,{ setPixel : function(x,y,col) {
        cs.write(0); 
        dc.write(0);spi.send(0x2a);     // ST7735: CASET Column address set
        dc.write(1);spi.send([0,x,0,127]);
        dc.write(0);spi.send(0x2b);     // ST7735: RASET Row address set
        dc.write(1);spi.send([0,y,0,159]);
        dc.write(0);spi.send(0x2c);     // ST7735: RAMWR Memory write
        dc.write(1);spi.send([col>>8,col]);
        cs.write(1);
      }, fillRect : function(x1,y1,x2,y2,col) {
        cs.write(0); 
        dc.write(0);spi.send(0x2a);     // ST7735: CASET Column address set
        dc.write(1);spi.send([0,x1,0,x2]);
        dc.write(0);spi.send(0x2b);     // ST7735: RASET Row address set
        dc.write(1);spi.send([0,y1,0,y2]);
        dc.write(0);spi.send(0x2c);     // ST7735: RAMWR Memory write
        dc.write(1);
        var p = [col>>8,col, col>>8,col, col>>8,col, col>>8,col,
                 col>>8,col, col>>8,col, col>>8,col, col>>8,col];
        var i=(1+x2-x1)*(1+y2-y1)+8;
        while ((i-=8)>8) spi.send(p);
        p = [col>>8,col];
        while (i-->0) spi.send(p);
        cs.write(1);
      }});
    }
    
    var g = connect(SPI1, A3, B10, B11, function() {
      g.clear();
      g.drawString("Hello",0,0);
      g.setFontVector(20);
      g.setColor(0,0.5,1);
      g.drawString("Espruino",0,10);
    });
    
  • in Interfacing
    Avatar for Kalus

    @Loop i would totally agree with Gordon and the CSTN technology would be pain for your eyes
    @JumJum you refer a very nice display, i've placed an order right now :)
    I have modified the SSD1351 OLED Driver to drive this ST7735R Display (1.8" 128x160):
    http://www.sainsmart.com/arduino-compati­bles-1/lcd-module/sainsmart-1-8-spi-lcd-­module-with-microsd-led-backlight-for-ar­duino-mega-atmel-atmega.html

  • in Interfacing
    Avatar for Kalus

    Maybe there is an issue with the configurable bitrate of the HC-05. Some modules have
    38400 bit/s as default and the Espruino expects 9600 bit/s at Serial1 for using it as console interface at startup. The bitrate of the HC-05 module could be changed by AT commands.

  • in Interfacing
    Avatar for Kalus

    +DrAzzy Yes, i have. The VDD pin sources only the current for the light, the VCC pin sources only the control circuit of the WS2812, which draws less current and at the 3.3 of Espruino therefore no Problem, because it's bypassed by capacitor. I go this way after magnifying the sample circuit on page 5 showing a series resistance of 150 ohms making it impossible to draw more then 33ma. I have tested it with 2 pieces on a breadboard and they are burning my eyes (at 255,255,255). This is just a test-setup, real projects get a seperate bypass-capacitor.

  • in Interfacing
    Avatar for Kalus

    No firmware issue. Changed the wiring and it works. DrAzzy might got the cause (but brightness was meaningless, therefore i hadn't guessed a hardware concern).
    I was using a bare WS2812 (6pin 5050) without cap. The curious issue occurs having
    WS2812.VCC and WS2812.VDD wired to the voltage Espruino.Bat .
    Now i had changed only WS2812.VCC to Espruino.3.3 and the issue has gone.
    Thank you and sorry guys.

  • in Interfacing
    Avatar for Kalus

    Hi, using the v1.53 Firmware i got a curious issue:
    With just one WS2812 this
    SPI2.send4bit([a,b,c], 0b0001, 0b0011);
    works only, if a!=b!=c, otherwise the WS2812 get's off.
    I had not try it with earlier Firmware, therefore this may be an issue only since v1.53 ?

Actions