×

SparkFun will be closed on Monday for Memorial Day (5/27). Orders placed after 2pm MT on Friday (5/24) will process and ship out on Tuesday (5/28).

tomsax

Member Since: June 23, 2011

Country: United States

Profile

Spoken Languages

English

Programming Languages

C,C++,Perl,AppleScript

Websites

http://www.idleloop.com/

  • I am now talking to the OLED from a C/C++ program on the Raspberry Pi 3 B+.

    There is no data register, so you can skip that part of the initialization and just do the rest. Despite what the data sheet says, the OLED is 64x48, as stated in the product description. The DRAM buffer appears to be 128x64 (8 pages by 128 columns). The DRAM for the display starts on page 2 and column 32.

    Here are the key bits of code:

    #include <unistd.h>
    #include <wiringPiI2C.h>
    
    #define addrOLEDJumperOpen   0x3D
    #define addrOLEDJumperClosed 0x3C
    
    #define ctrlCommand 0x00
    #define ctrlData    0x40
    
    m_addrI2C = fJumperClosed ? addrOLEDJumperClosed : addrOLEDJumperOpen;
    
    m_fd = wiringPiI2CSetup(m_addrI2C);
    
    void OLED::SetPageAddress(uint8_t page)
    {
        Assert(0 <= page && page < cpageDisplayBuffer);
        page += 2;
        SendCommand(0xB0 + page);
    }
    
    void OLED::SetColumnAddress(uint8_t col)
    {
        Assert(0 <= col && col < ccolDisplayBuffer);
        col += 32;
        SendCommand(0x10 + (col>>4));
        SendCommand(0x00 + (col&0x0f));
    }
    
    void OLED::SendCommand(uint8_t cmd)
    {
        wiringPiI2CWriteReg8(m_fd, ctrlCommand, cmd);
    }
    
    void OLED::SendData(uint8_t b)
    {
        wiringPiI2CWriteReg8(m_fd, ctrlData, b);
    }
    
  • I got the Qwiic Micro OLED with a Raspberry Pi bundle, but the sample code here is for Arduino. Is there's a corresponding library and sample code for the Pi? I've read up on the wiringPi library and the SSD1306 data sheet, but I'm not having any luck getting it to work.

  • A great story and a nice Robothon photo! That was the first year Cathy and I were on the organizing committee. It's been great watching SparkFun grow from a tiny operation to the big time. Best wishes for another decade of success in helping many people build cool things.

No public wish lists :(