fix(MP/daemon): oled
- change device tree of the nanopi to use i2c
This commit is contained in:
@@ -53,7 +53,7 @@ int main(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// init_oled(&oled_cbs);
|
||||
init_oled(&oled_cbs);
|
||||
|
||||
btn_set_led(led_power);
|
||||
init_animations();
|
||||
|
||||
@@ -26,26 +26,26 @@ static void display(int mode, float temp, uint32_t period_ms) {
|
||||
/* Static header rows */
|
||||
ssd1306_set_position(0, 0);
|
||||
ssd1306_puts("CSEL1a - SP.07");
|
||||
// ssd1306_set_position(0, 1);
|
||||
// ssd1306_puts(" WATCHDOG CPU ");
|
||||
// ssd1306_set_position(0, 2);
|
||||
// ssd1306_puts("--------------");
|
||||
ssd1306_set_position(0, 1);
|
||||
ssd1306_puts(" WATCHDOG CPU ");
|
||||
ssd1306_set_position(0, 2);
|
||||
ssd1306_puts("--------------");
|
||||
|
||||
// /* Mode display: switches between AUTO and MANU strings */
|
||||
// ssd1306_set_position(0, 3);
|
||||
// snprintf(buffer, sizeof(buffer), "Mode: %s", mode ? "AUTO" : "MANU");
|
||||
// ssd1306_puts(buffer);
|
||||
/* Mode display: switches between AUTO and MANU strings */
|
||||
ssd1306_set_position(0, 3);
|
||||
snprintf(buffer, sizeof(buffer), "Mode: %s", mode ? "AUTO " : "MANUAL");
|
||||
ssd1306_puts(buffer);
|
||||
|
||||
// /* Temperature display: formatted with one decimal precision */
|
||||
// ssd1306_set_position(0, 4);
|
||||
// snprintf(buffer, sizeof(buffer), "Temp: %.1f'C", temp);
|
||||
// ssd1306_puts(buffer);
|
||||
/* Temperature display: formatted with one decimal precision */
|
||||
ssd1306_set_position(0, 4);
|
||||
snprintf(buffer, sizeof(buffer), "Temp: %.1f'C", temp);
|
||||
ssd1306_puts(buffer);
|
||||
|
||||
// /* Period/Frequency display: shows the value in milliseconds */
|
||||
// ssd1306_set_position(0, 5);
|
||||
// float freq = 1.0f / (period_ms / 1000.0f);
|
||||
// snprintf(buffer, sizeof(buffer), "Freq: %.1fHz", freq);
|
||||
// ssd1306_puts(buffer);
|
||||
/* Period/Frequency display: shows the value in milliseconds */
|
||||
ssd1306_set_position(0, 5);
|
||||
float freq = 1.0f / (period_ms / 1000.0f);
|
||||
snprintf(buffer, sizeof(buffer), "Freq: %.1fHz", freq);
|
||||
ssd1306_puts(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ static void *update_oled_thread(void* arg) {
|
||||
);
|
||||
}
|
||||
/* Sleep to control refresh rate and save CPU cycles */
|
||||
usleep(1000000);
|
||||
usleep(250000);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#define ARRAY_OF(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
#define I2C_BUS "/dev/i2c-1"
|
||||
#define I2C_BUS "/dev/i2c-0"
|
||||
#define OLED_ADDR 0x3c
|
||||
#define OLED_COMMAND_MODE 0x00
|
||||
#define OLED_DATA_MODE 0x40
|
||||
|
||||
Reference in New Issue
Block a user