36 extern uint16_t ssd1306_color;
38 static const PROGMEM uint8_t s_oled96x64_initData[] =
45 SSD1331_SEGREMAP, 0x00 | 0x20 | 0x10 | 0x02 | 0x01,
46 SSD1331_SETSTARTLINE, 0x00,
47 SSD1331_SETDISPLAYOFFSET, 0x00,
48 SSD1331_NORMALDISPLAY,
49 SSD1331_SETMULTIPLEX, 63,
50 SSD1331_SETMASTER, 0x8E,
51 SSD1331_POWERMODE, 0x0B,
52 SSD1331_SETPRECHARGE, 0x31,
53 SSD1331_CLOCKDIV, 0xF0,
54 SSD1331_PRECHARGEA, 0x64,
55 SSD1331_PRECHARGEB, 0x78,
56 SSD1331_PRECHARGELEVEL, 0x3A,
58 SSD1331_MASTERCURRENT, 0x09,
59 SSD1331_CONTRASTA, 0x91,
60 SSD1331_CONTRASTB, 0x50,
61 SSD1331_CONTRASTC, 0x7D,
65 static const PROGMEM uint8_t s_oled96x64_initData16[] =
72 SSD1331_SEGREMAP, 0x40 | 0x20 | 0x10 | 0x02 | 0x01,
73 SSD1331_SETSTARTLINE, 0x00,
74 SSD1331_SETDISPLAYOFFSET, 0x00,
75 SSD1331_NORMALDISPLAY,
76 SSD1331_SETMULTIPLEX, 63,
77 SSD1331_SETMASTER, 0x8E,
78 SSD1331_POWERMODE, 0x0B,
79 SSD1331_SETPRECHARGE, 0x31,
80 SSD1331_CLOCKDIV, 0xF0,
81 SSD1331_PRECHARGEA, 0x64,
82 SSD1331_PRECHARGEB, 0x78,
83 SSD1331_PRECHARGELEVEL, 0x3A,
85 SSD1331_MASTERCURRENT, 0x09,
86 SSD1331_CONTRASTA, 0x91,
87 SSD1331_CONTRASTB, 0x50,
88 SSD1331_CONTRASTC, 0x7D,
92 static uint8_t s_rotation = 0x04;
97 (s_rotation & 1) ? SSD1331_ROWADDR: SSD1331_COLUMNADDR,
98 (s_rotation & 1) ? SSD1331_COLUMNADDR: SSD1331_ROWADDR );
107 (s_rotation & 1) ? SSD1331_ROWADDR: SSD1331_COLUMNADDR,
108 (s_rotation & 1) ? SSD1331_COLUMNADDR: SSD1331_ROWADDR );
133 if ((rotation^s_rotation) & 0x01)
139 s_rotation = (rotation & 0x03) | (s_rotation & 0x04);
147 ram_mode = 0b00110010;
150 ram_mode = 0b00110001;
153 ram_mode = 0b00100000;
156 ram_mode = 0b00100011;
160 ram_mode = 0b00110011;
163 ram_mode = 0b00110000;
166 ram_mode = 0b00100001;
169 ram_mode = 0b00100010;
172 ram_mode = 0b00100000;
180 static void ssd1331_sendPixel16_8(uint16_t data)
187 static void ssd1331_sendPixel8_16(uint8_t data)
195 static void ssd1331_sendPixel16(uint16_t color)
214 for( uint8_t i=0; i<
sizeof(s_oled96x64_initData); i++)
220 void ssd1331_96x64_init16()
233 for( uint8_t i=0; i<
sizeof(s_oled96x64_initData16); i++)
256 ssd1331_96x64_init16();
274 void ssd1331_copyBlock(uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop)
#define CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd)
void(* send)(uint8_t data)
#define SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS()
void ssd1331_setMode(lcd_mode_t mode)
Sets GDRAM autoincrement mode.
void(* send_pixels16)(uint16_t data)
Sends RGB pixel encoded in 5-6-5 format to OLED driver. Sends RGB pixel encoded in 5-6-5 format to OL...
void(* set_block)(lcduint_t x, lcduint_t y, lcduint_t w)
Sets block in RAM of lcd display controller to write data to.
void(* send_pixels8)(uint8_t data)
Sends RGB pixel encoded in 3-3-2 format to OLED driver. Sends RGB pixel encoded in 3-3-2 format to OL...
void ssd1306_spiDataMode(uint8_t mode)
void(* send_pixels_buffer1)(const uint8_t *buffer, uint16_t len)
void ssd1306_resetController(int8_t rstPin, uint8_t delayMs)
Does hardware reset for oled controller.
void(* send_pixels1)(uint8_t data)
void ssd1331_drawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint16_t color)
#define SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS()
void ssd1306_spiInit(int8_t cesPin, int8_t dcPin)
ssd1306_lcd_t ssd1306_lcd
void ssd1331_copyBlock(uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop)
ssd1306_interface_t ssd1306_intf
#define SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd)
void ssd1306_sendCommand(uint8_t command)
void ssd1331_setRotation(uint8_t rotation)
Sets screen orientation (rotation)
void ssd1331_96x64_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Inits 96x64 RGB OLED display over spi in 8-bit mode (based on SSD1331 controller).
void(* set_mode)(lcd_mode_t mode)
Sets library display mode for direct draw functions.
void ssd1331_96x64_init(void)
Inits 96x64 RGB OLED display (based on SSD1331 controller).
void ssd1331_96x64_spi_init16(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Inits 96x64 RGB OLED display over spi in 16-bit mode (based on SSD1331 controller).