Since I need all my analog inputs and i2c is on the digital pins I need a way to get a cheap oled working.
There aren’t any yet for this combo, so I guess it is on me to try and figure out. https://github.com/officeboy/sh1106
I forked this Library as it seemed fairly simple and I understood the flow of it, so it seemed like a good place to start. (rather than u8glib)
But I am running into a problem with a class that is giving an error for “undefined reference to” class::something()
It compiled fine for arduino so it probably has something to do with the compile optimiser and the way the class is laid out. Anyone have a tip or hint on how to restructure this so that it might work?
error
/spark/compile_service/shared/workspace/2_compile-server2/core-firmware/build/sh1106.cpp:60: undefined reference to `sh1106_lcd::Show()'
/spark/compile_service/shared/workspace/2_compile-server2/core-firmware/build/sh1106.cpp:66: undefined reference to `sh1106_lcd::ClearScreen()'
code snip from sh1106.h
class sh1106_lcd {
public:
static sh1106_lcd *getInstance();
public:
void ClearScreen();
// ... deleted a few out for ease of review
void Show();
private:
void Initialize();
byte SendByte(byte data, SendState state);
byte SendCommand(byte command, SendState state = Complete);
byte SendData(byte data, SendState state = Complete);
void PrintData(char *data, bool incrementLine);
private:
static sh1106_lcd *m_pInstance;
byte m_currentLine;
byte m_cursor;
byte m_screen[MAX_PAGE_COUNT][SCREEN_WIDTH]; // 1024 bytes 8 pages of 128 bits
};