klips/esp/cpp/07_lcd-panel/main/ssd1306.cpp

24 lines
782 B
C++
Raw Normal View History

2025-02-15 10:11:49 -05:00
#include "ssd1306.h"
// To use LV_COLOR_FORMAT_I1 we need an extra buffer to hold the converted data.
uint8_t SSD1306::oled_buffer_[LCD_H_RES * LCD_V_RES / 8];
2025-02-16 09:38:28 -05:00
SSD1306::SSD1306(I2C &i2c,
2025-02-15 17:12:06 -05:00
esp_lcd_panel_ssd1306_config_t config,
2025-02-15 10:11:49 -05:00
int width,
int height) :
2025-02-15 17:12:06 -05:00
IPanelDevice(i2c,
(esp_lcd_panel_io_i2c_config_t) {
.dev_addr = I2C_HW_ADDR,
.control_phase_bytes = 1,
.dc_bit_offset = 6,
.lcd_cmd_bits = LCD_CMD_BITS,
2025-02-16 09:38:28 -05:00
.lcd_param_bits = LCD_PARAM_BITS,
2025-02-15 17:12:06 -05:00
.scl_speed_hz = LCD_PIXEL_CLOCK_HZ,
2025-02-15 18:16:25 -05:00
},
width,
height
2025-02-15 17:12:06 -05:00
),
2025-02-16 09:38:28 -05:00
ssd1306_config_(config) { }