use ssd1312 display (soldered)
This commit is contained in:
parent
a1590577d2
commit
4820010ef1
@ -6,8 +6,8 @@ TARGET_MCU_PACKAGE := CH32X035F8U6
|
|||||||
|
|
||||||
# include u8g2
|
# include u8g2
|
||||||
U8G2_DIR:=u8g2/csrc
|
U8G2_DIR:=u8g2/csrc
|
||||||
# U8G2_SRC:=u8g2/csrc/u8x8_d_ssd1312.c $(filter-out $(U8G2_DIR)/u8x8_d_%.c, $(wildcard $(U8G2_DIR)/*.c))
|
U8G2_SRC:=u8g2/csrc/u8x8_d_ssd1312.c $(filter-out $(U8G2_DIR)/u8x8_d_%.c, $(wildcard $(U8G2_DIR)/*.c))
|
||||||
U8G2_SRC:=u8g2/csrc/u8x8_d_ssd1306_128x32.c $(filter-out $(U8G2_DIR)/u8x8_d_%.c, $(wildcard $(U8G2_DIR)/*.c))
|
# U8G2_SRC:=u8g2/csrc/u8x8_d_ssd1306_128x32.c $(filter-out $(U8G2_DIR)/u8x8_d_%.c, $(wildcard $(U8G2_DIR)/*.c))
|
||||||
|
|
||||||
EXTRA_CFLAGS += -I$(U8G2_DIR)
|
EXTRA_CFLAGS += -I$(U8G2_DIR)
|
||||||
|
|
||||||
|
|||||||
@ -165,7 +165,7 @@ u8g2_t* display_init(void)
|
|||||||
u8g2_Setup_ssd1306_i2c_128x32_univision_f(&u8g2, U8G2_R0, u8x8_byte_i2c, u8x8_gpio_and_delay);
|
u8g2_Setup_ssd1306_i2c_128x32_univision_f(&u8g2, U8G2_R0, u8x8_byte_i2c, u8x8_gpio_and_delay);
|
||||||
#elif SSD1312_96X16 && SSD1312_96X16 == 1
|
#elif SSD1312_96X16 && SSD1312_96X16 == 1
|
||||||
// NOTE: display size is wrong, hardware is 96x16, but driver is configured for 120x28
|
// NOTE: display size is wrong, hardware is 96x16, but driver is configured for 120x28
|
||||||
u8g2_Setup_ssd1312_i2c_120x28_f(&u8g2, U8G2_R0, u8x8_byte_i2c, u8x8_gpio_and_delay);
|
u8g2_Setup_ssd1312_i2c_128x32_f(&u8g2, U8G2_R0, u8x8_byte_i2c, u8x8_gpio_and_delay);
|
||||||
#else
|
#else
|
||||||
static_assert(0, "unsupported display size");
|
static_assert(0, "unsupported display size");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include <u8g2.h>
|
#include <u8g2.h>
|
||||||
|
|
||||||
#define SSD1306_128X32 1
|
// #define SSD1306_128X32 1
|
||||||
// #define SSD1312_96X16 1
|
#define SSD1312_96X16 1
|
||||||
#define PIN_DISP_RST PA7 // display reset
|
#define PIN_DISP_RST PA7 // display reset
|
||||||
|
|
||||||
u8g2_t* display_init(void);
|
u8g2_t* display_init(void);
|
||||||
|
|||||||
20
fw/main.c
20
fw/main.c
@ -6,6 +6,7 @@
|
|||||||
#include "lib_i2c.h"
|
#include "lib_i2c.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
#include "u8g2.h"
|
||||||
|
|
||||||
|
|
||||||
// Pin definitions
|
// Pin definitions
|
||||||
@ -215,18 +216,17 @@ __attribute__((noreturn)) int main(void)
|
|||||||
u8g2_SetBitmapMode(u8g2, 1);
|
u8g2_SetBitmapMode(u8g2, 1);
|
||||||
u8g2_SetFontMode(u8g2, 1);
|
u8g2_SetFontMode(u8g2, 1);
|
||||||
u8g2_SetFont(u8g2, u8g2_font_5x8_tr);
|
u8g2_SetFont(u8g2, u8g2_font_5x8_tr);
|
||||||
u8g2_DrawStr(u8g2, 0, 7, "TIP:");
|
#define x_off 0
|
||||||
u8g2_DrawStr(u8g2, 20, 7, u8x8_u16toa(tip_mv, 4));
|
#define y_off 8
|
||||||
u8g2_DrawStr(u8g2, 0, 15, "VBUS:");
|
u8g2_DrawStr(u8g2, x_off+0, y_off+7, "TIP:");
|
||||||
u8g2_DrawStr(u8g2, 25, 15, u8x8_u16toa(vbus_mv, 4));
|
u8g2_DrawStr(u8g2, x_off+20, y_off+7, u8x8_u16toa(tip_mv, 4));
|
||||||
u8g2_DrawLine(u8g2, 62, 19, 62, 0);
|
u8g2_DrawStr(u8g2, x_off+0, y_off+15, "VBUS:");
|
||||||
u8g2_DrawStr(u8g2, 71, 6, "TEMP:");
|
u8g2_DrawStr(u8g2, x_off+25, y_off+15, u8x8_u16toa(vbus_mv, 4));
|
||||||
u8g2_DrawStr(u8g2, 96, 6, u8x8_u16toa(temp_k, 2));
|
u8g2_DrawStr(u8g2, x_off+51, y_off+7, "TEMP:");
|
||||||
u8g2_DrawFrame(u8g2, 0, 22, 128, 10);
|
u8g2_DrawStr(u8g2, x_off+75, y_off+7, u8x8_u16toa(temp_k, 2));
|
||||||
encoder = encoder < -61 ? -61 : (encoder > 61 ? 61 : encoder);
|
|
||||||
u8g2_DrawBox(u8g2, 61+encoder, 23, 4, 8);
|
|
||||||
u8g2_SendBuffer(u8g2);
|
u8g2_SendBuffer(u8g2);
|
||||||
|
|
||||||
|
|
||||||
printf("VBUS=%d, CURRENT=%d, TEMP=%d, TIP=%d, COUNTER=%d\n", vbus_mv, current_ma, temp_k, tip_mv, encoder);
|
printf("VBUS=%d, CURRENT=%d, TEMP=%d, TIP=%d, COUNTER=%d\n", vbus_mv, current_ma, temp_k, tip_mv, encoder);
|
||||||
|
|
||||||
u32 elapsed = funSysTick32() - start;
|
u32 elapsed = funSysTick32() - start;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user