You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Rough info so far:

    CPU: https://infocenter.nordicsemi.com/topic/­com.nordic.infocenter.pdf.ps/nRF51822_PS­_v3.1.pdf
    Accelerometer: http://kionixfs.kionix.com/cn/datasheet/­KX022-1020%20Specifications%20Rev4.0%20c­n.pdf
    0.49" OLED - SSD1306 - http://www.buydisplay.com/download/manua­l/ER-OLED0.49-1_Series_Datasheet.pdf (but not that pinout)

    Name Pins Notes
    RX pad P0.17 ?
    TX pad P0.18
    CLK pad SWDIO
    DIA pad SWDCLK
    32k osc? P0.26, P0-27 Not fitted
    Vibrate P0.07 via some FET/transistor
    Button P0.04 Needs input_pullup
    Accelerometer P0.10-16? Kionix kx022-1020
    P0.16 clk
    P0.15 short pulses? irq?
    P0.14 data
    OLED SSD1306 64x32
    P0.29 MOSI
    P0.30 SCK
    P0.0 DC
    P0.1 RST
    P0.2 CS

    Test code - there's very little program space at the moment:

    var BTN = D4; pinMode(BTN,"input_pullup");
    
    var initCmds = new Uint8Array([ 
      0xAe,
      0xD5, 
      0x80, 
      0xA8, 31,
      0xD3,0x0,
      0x40,
      0x8D, 0x14, 
      0x20,0x0, 
      0xA1,
      0xC8,
      0xDA, 0x12,
      0x81, 0xCF,
      0xD9, 0xF1,
      0xDb, 0x40,
      0xA4,
      0xA6,
      0xAf 
    ]);
    var flipCmds = [
         0x21,
         0, 63,
         0x22,
         0, 7];
    
    
    var dc = D0;
    var rst = D1;
    var cs = D2;
    
    var g = Graphics.createArrayBuffer(63,31,1,{vert­ical_byte : true});
    
    var spi = new SPI();
    spi.setup({mosi: 29 /* D1 */, sck:30 /* D0 */});
    
    digitalPulse(rst,0,10);
    setTimeout(function() {
      digitalWrite(cs,0);
      digitalWrite(dc,0); // command
      spi.write(initCmds);
      digitalWrite(dc,1); // data
      digitalWrite(cs,10);
    }, 50);
    
    g.flip = function() { 
    cs.reset();dc.reset();
    spi.write([0x21,0,127,0x22,0,7]);
    for (var i=0;i<4;i++) {
      spi.write(0xb0+i,0x00,0x12);
      dc.set();
      spi.write(Uint8Array(this.buffer,64*i,64­));
      dc.reset();
    }cs.set();
    };
    
    //function cmd(c){cs.reset();dc.reset();spi.write(c­);cs.set();}
    //function dispoff(){cmd(0xae);}
    //function dispon(){cmd(0xaf);}
    
     g.drawString("Hello",0,0);
     g.drawString("ESPRUINO",10,10);
     g.flip();
    
About

Avatar for Gordon @Gordon started