28 #ifndef _LCD_COMMON_H_ 29 #define _LCD_COMMON_H_ 114 void (*set_block)(lcduint_t x, lcduint_t y, lcduint_t w);
122 void (*next_page)(void);
128 void (*send_pixels1)(uint8_t data);
135 void (*send_pixels_buffer1)(
const uint8_t *buffer, uint16_t len);
142 void (*send_pixels8)(uint8_t data);
149 void (*send_pixels16)(uint16_t data);
176 #define s_displayHeight ssd1306_lcd.height 182 #define s_displayWidth ssd1306_lcd.width 188 #define g_lcd_type ssd1306_lcd.type 215 #define ssd1306_setRamBlock ssd1306_lcd.set_block 224 #define ssd1306_nextRamPage ssd1306_lcd.next_page 231 #define ssd1306_sendPixels ssd1306_lcd.send_pixels1 239 #define ssd1306_sendPixelsBuffer ssd1306_lcd.send_pixels_buffer1 247 #define ssd1306_sendPixel8 ssd1306_lcd.send_pixels8 316 #define SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd) \ 317 static uint8_t __s_column; \ 318 static uint8_t __s_page; \ 319 static void set_block_compat(lcduint_t x, lcduint_t y, lcduint_t w) \ 321 uint8_t rx = w ? (x + w - 1) : (ssd1306_lcd.width - 1); \ 324 ssd1306_intf.start(); \ 325 ssd1306_spiDataMode(0); \ 326 ssd1306_intf.send(column_cmd); \ 327 ssd1306_intf.send(x); \ 328 ssd1306_intf.send(rx < ssd1306_lcd.width ? rx : (ssd1306_lcd.width - 1)); \ 329 ssd1306_intf.send(row_cmd); \ 330 ssd1306_intf.send(y<<3); \ 331 ssd1306_intf.send(((y<<3) + 7) < ssd1306_lcd.height ? ((y<<3) + 7) : (ssd1306_lcd.height - 1)); \ 332 ssd1306_spiDataMode(1); \ 334 static void next_page_compat(void) \ 336 ssd1306_intf.stop(); \ 337 set_block_compat(__s_column,__s_page+1,0); \ 352 #define CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd) \ 353 static void set_block_native(lcduint_t x, lcduint_t y, lcduint_t w) \ 355 uint8_t rx = w ? (x + w - 1) : (ssd1306_lcd.width - 1); \ 356 ssd1306_intf.start(); \ 357 ssd1306_spiDataMode(0); \ 358 ssd1306_intf.send(column_cmd); \ 359 ssd1306_intf.send(x); \ 360 ssd1306_intf.send(rx < ssd1306_lcd.width ? rx : (ssd1306_lcd.width - 1)); \ 361 ssd1306_intf.send(row_cmd); \ 362 ssd1306_intf.send(y); \ 363 ssd1306_intf.send(ssd1306_lcd.height - 1); \ 364 ssd1306_spiDataMode(1); \ 366 static void next_page_native(void) \ 376 #define SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS() \ 377 extern uint16_t ssd1306_color; \ 378 static void send_pixels_compat(uint8_t data) \ 380 for (uint8_t i=8; i>0; i--) \ 384 ssd1306_intf.send( (uint8_t)ssd1306_color ); \ 388 ssd1306_intf.send( 0B00000000 ); \ 393 static void send_pixels_buffer_compat(const uint8_t *buffer, uint16_t len) \ 397 send_pixels_compat(*buffer); \ 408 #define SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS() \ 409 extern uint16_t ssd1306_color; \ 410 static void send_pixels_compat16(uint8_t data) \ 412 for (uint8_t i=8; i>0; i--) \ 416 ssd1306_intf.send( (uint8_t)(ssd1306_color >> 8 ) ); \ 417 ssd1306_intf.send( (uint8_t)(ssd1306_color & 0xFF) ); \ 421 ssd1306_intf.send( 0B00000000 ); \ 422 ssd1306_intf.send( 0B00000000 ); \ 427 static void send_pixels_buffer_compat16(const uint8_t *buffer, uint16_t len) \ 431 send_pixels_compat16(*buffer); \ void ssd1306_setMode(lcd_mode_t mode)
Sets library display mode for direct draw functions.
void ssd1306_configureSpiDisplay(const uint8_t *config, uint8_t configSize)
Sends configuration being passed to lcd display spi controller.
void ssd1306_configureI2cDisplay(const uint8_t *config, uint8_t configSize)
Sends configuration being passed to lcd display i2c/spi controller.
void ssd1306_resetController(int8_t rstPin, uint8_t delayMs)
Does hardware reset for oled controller.
ssd1306_lcd_t ssd1306_lcd
void ssd1306_sendData(uint8_t data) __attribute__((deprecated))