From aee51faf7562b215d17953ea682d96797b19086d Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Sun, 26 May 2019 15:30:17 +0200 Subject: [PATCH] feat(bmetest): Show values on the screen --- bmetest/Makefile | 3 +-- bmetest/main.c | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/bmetest/Makefile b/bmetest/Makefile index 4ea57074..374255e0 100644 --- a/bmetest/Makefile +++ b/bmetest/Makefile @@ -67,8 +67,6 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS # Source files for this test (add path to VPATH below) SRCS = main.c -SRCS += oled96.c -SRCS += fonts.c SRCS += pmic.c SRCS += bosch.c SRCS += bhy_support.c bhy_uc_driver.c bhy.c @@ -79,6 +77,7 @@ SRCS += LCD_Driver.c SRCS += GUI_Paint.c SRCS += DEV_Config.c SRCS += font24.c +SRCS += font16.c SRCS += font24CN.c SRCS += card10.c SRCS += display.c diff --git a/bmetest/main.c b/bmetest/main.c index b30a471b..93595ffd 100644 --- a/bmetest/main.c +++ b/bmetest/main.c @@ -9,9 +9,10 @@ #include "tmr_utils.h" #include "i2c.h" #include "gpio.h" -#include "oled96.h" #include "bme680.h" #include "bosch.h" +#include "GUI_DEV/GUI_Paint.h" +#include "Fonts/fonts.h" #include "card10.h" @@ -26,12 +27,6 @@ int main(void) card10_init(); card10_diag(); - oledInit(0x3c, 0, 0); - oledFill(0x00); - oledWriteString(0, 0, "Hello", 0); - oledWriteString(0, 2, "my name is", 0); - oledWriteString(0, 4, "card10", 1); - struct bme680_dev gas_sensor; gas_sensor.dev_id = BME680_I2C_ADDR_PRIMARY; gas_sensor.intf = BME680_I2C_INTF; @@ -87,11 +82,26 @@ int main(void) printf("T: %.2f degC, P: %.2f hPa, H %.2f %%rH ", data.temperature / 100.0l, data.pressure / 100.0l, data.humidity / 1000.0l ); + char buf[128]; + sprintf(buf, "T: %.2f degC", data.temperature / 100.0l); + Paint_DrawString_EN(0, 0, buf, &Font16, 0x0000, 0xffff); + + sprintf(buf, "P: %.2f hPa", data.pressure / 100.0l); + Paint_DrawString_EN(0, 16, buf, &Font16, 0x0000, 0xffff); + + sprintf(buf, "H: %.2f %%rH", data.humidity / 1000.0l); + Paint_DrawString_EN(0, 32, buf, &Font16, 0x0000, 0xffff); + //printf("%.2f,%.2f,%.2f\n", data.temperature / 100.0f, // data.pressure / 100.0f, data.humidity / 1000.0f ); /* Avoid using measurements from an unstable heating setup */ - if(data.status & BME680_GASM_VALID_MSK) + if(data.status & BME680_GASM_VALID_MSK) { printf(", G: %d ohms", data.gas_resistance); + sprintf(buf, "G: %d ohms", data.gas_resistance); + Paint_DrawString_EN(0, 48, buf, &Font16, 0x0000, 0xffff); + } + + LCD_Update(); printf("\n"); -- GitLab