36 #define CMD_DELAY 0xFF 38 extern uint16_t ssd1306_color;
41 static uint8_t s_rotation = 0x00;
42 static uint8_t s_rgb_bit = 0b00001000;
43 static lcdint_t s_offset_x = 0;
44 static lcdint_t s_offset_y = 0;
46 static const PROGMEM uint8_t s_oled128x128_initData[] =
69 0xC0, CMD_ARG, 0x0A, CMD_ARG, 0x02,
71 0xC5, CMD_ARG, 0x50, CMD_ARG, 0x5B,
75 0x36, CMD_ARG, 0b10001100,
79 static const PROGMEM uint8_t s_oled128x160_initData[] =
87 0xB1, 0x03, 0x01, 0x2C, 0x2D,
88 0xB2, 0x03, 0x01, 0x2C, 0x2D,
93 0xB6, 0x02, 0x15, 0x02,
94 0xC0, 0x03, 0xA2, 0x02, 0x84,
96 0xC2, 0x02, 0x0A, 0x00,
97 0xC3, 0x02, 0x8A, 0x2A,
98 0xC4, 0x02, 0x8A, 0xEE,
103 0x36, 0x01, 0b00100000,
109 0x0F, 0x1A, 0x0F, 0x18,
110 0x2F, 0x28, 0x20, 0x22,
111 0x1F, 0x1B, 0x23, 0x37,
112 0x00, 0x07, 0x02, 0x10,
114 0x0F, 0x1B, 0x0F, 0x17,
115 0x33, 0x2C, 0x29, 0x2E,
116 0x30, 0x30, 0x39, 0x3F,
117 0x00, 0x07, 0x03, 0x10,
121 0x29, CMD_DELAY, 100,
125 static uint8_t s_column;
126 static uint8_t s_page;
128 static void il9163_setBlock(lcduint_t x, lcduint_t y, lcduint_t w)
153 static void il9163_setBlock2(lcduint_t x, lcduint_t y, lcduint_t w)
182 static void il9163_nextPage(
void)
188 static void il9163_nextPage2(
void)
210 s_rotation = mode ? 0x00 : 0x04;
213 static void il9163_sendPixels(uint8_t data)
215 for (uint8_t i=8; i>0; i--)
231 static void il9163_sendPixelsBuffer(
const uint8_t *buffer, uint16_t len)
235 il9163_sendPixels(*buffer);
240 static void il9163_sendPixel8(uint8_t data)
247 static void il9163_sendPixel16(uint16_t color)
258 s_rgb_bit = 0b00001000;
273 pinMode(rstPin, OUTPUT);
274 digitalWrite(rstPin, HIGH);
278 digitalWrite(rstPin, LOW);
280 digitalWrite(rstPin, HIGH);
291 if ((rotation^s_rotation) & 0x01)
297 s_rotation = (rotation & 0x03) | (s_rotation & 0x04);
306 ram_mode = 0b00000000;
309 ram_mode = 0b01000000;
312 ram_mode = 0b11100000;
315 ram_mode = 0b10000000;
318 ram_mode = 0b00000000;
321 ram_mode = 0b01100000;
324 ram_mode = 0b11000000;
327 ram_mode = 0b10100000;
330 s_offset_x = ((s_rotation & 0x03) == 3 ? 32 : 0);
331 s_offset_y = ((s_rotation & 0x03) == 2 ? 32 : 0);
342 static void st7735_setBlock(lcduint_t x, lcduint_t y, lcduint_t w)
367 static void st7735_setBlock2(lcduint_t x, lcduint_t y, lcduint_t w)
402 s_rotation = mode ? (s_rotation & 0x03) : (s_rotation | 0x04);
411 s_rgb_bit = 0b00000000;
void st7735_128x160_init(void)
Inits 128x160 RGB OLED display (based on st7735 controller).
void ssd1306_configureSpiDisplay2(const uint8_t *config, uint8_t configSize)
Sends configuration being passed to lcd display spi controller.
void ssd1306_configureSpiDisplay(const uint8_t *config, uint8_t configSize)
Sends configuration being passed to lcd display spi controller.
void st7735_128x160_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Inits 128x160 RGB TFT display over spi (based on st7735 controller).
void(* send)(uint8_t data)
uint32_t s_ssd1306_spi_clock
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 il9163_setRotation(uint8_t rotation)
Sets screen orientation (rotation)
void il9163_128x128_init(void)
Inits 128x128 RGB OLED display (based on il9163 controller).
void ssd1306_spiInit(int8_t cesPin, int8_t dcPin)
ssd1306_lcd_t ssd1306_lcd
void il9163_setOffset(lcdint_t x, lcdint_t y)
Sets screen offset (refer to datasheet of your display)
ssd1306_interface_t ssd1306_intf
void il9163_128x128_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Inits 128x128 RGB TFT display over spi (based on il9163 controller).
void il9163_setMode(lcd_mode_t mode)
Sets GDRAM autoincrement mode.
void(* set_mode)(lcd_mode_t mode)
Sets library display mode for direct draw functions.