|
@@ -32,6 +32,7 @@ static i2c_inst_t *gpio_inst_i2c = i2c1;
|
32
|
32
|
static const uint gpio_num_i2c[2] = { 14, 15 };
|
33
|
33
|
|
34
|
34
|
static ssd1306_t lcd = {0};
|
|
35
|
+static bool found = false;
|
35
|
36
|
|
36
|
37
|
void lcd_init(void) {
|
37
|
38
|
i2c_init(gpio_inst_i2c, 2UL * 1000UL * 1000UL);
|
|
@@ -41,10 +42,20 @@ void lcd_init(void) {
|
41
|
42
|
gpio_pull_up(gpio_num_i2c[i]);
|
42
|
43
|
}
|
43
|
44
|
|
44
|
|
- ssd1306_init(&lcd, LCD_WIDTH, LCD_HEIGHT, LCD_I2C_ADDR, gpio_inst_i2c);
|
|
45
|
+ found = ssd1306_init(&lcd, LCD_WIDTH, LCD_HEIGHT, LCD_I2C_ADDR, gpio_inst_i2c);
|
|
46
|
+
|
|
47
|
+ if (found) {
|
|
48
|
+ debug("SSD1306 OLED is connected");
|
|
49
|
+ } else {
|
|
50
|
+ debug("No SSD1306 OLED found!");
|
|
51
|
+ }
|
45
|
52
|
}
|
46
|
53
|
|
47
|
|
-void lcd_splash(void) {
|
|
54
|
+void lcd_splash_version(void) {
|
|
55
|
+ if (!found) {
|
|
56
|
+ return;
|
|
57
|
+ }
|
|
58
|
+
|
48
|
59
|
ssd1306_clear(&lcd);
|
49
|
60
|
|
50
|
61
|
ssd1306_draw_string(&lcd, 0, 0, 2,
|