From 1877f92905a02af36712de424e5057172dc5b7c6 Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sun, 25 Oct 2020 11:54:43 +0100 Subject: [PATCH] main.c: Add Platform test --- openrtx/src/main.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/openrtx/src/main.c b/openrtx/src/main.c index c1e2b22d..65619f54 100644 --- a/openrtx/src/main.c +++ b/openrtx/src/main.c @@ -25,11 +25,33 @@ #include "hwconfig.h" #include "platform.h" +void platform_test() +{ + OS_ERR os_err; + point_t pos_line1 = {0, 0}; + point_t pos_line2 = {0, 9}; + point_t pos_line3 = {0, 17}; + color_t color_white = {255, 255, 255}; + char *buf = "Platform Test"; + gfx_print(pos_line1, buf, FONT_SIZE_1, TEXT_ALIGN_LEFT, color_white); + float vBat = platform_getVbat(); + float micLevel = platform_getMicLevel(); + float volumeLevel = platform_getVolumeLevel(); + uint8_t currentCh = platform_getChSelector(); + bool ptt = platform_getPttStatus(); + char buf2[20] = ""; + snprintf(buf2, sizeof(buf2), "bat:%.2f mic:%.2f", vBat, micLevel); + char buf3[20] = ""; + snprintf(buf3, sizeof(buf3), "vol:%.2f ch:%d ptt:%d", volumeLevel, currentCh, ptt); + gfx_print(pos_line2, buf2, FONT_SIZE_1, TEXT_ALIGN_LEFT, color_white); + gfx_print(pos_line3, buf3, FONT_SIZE_1, TEXT_ALIGN_LEFT, color_white); + gfx_render(); + while(gfx_renderingInProgress()); + OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err); +} + int main(void) { - gpio_setMode(GPIOE, 0, OUTPUT); - gpio_setMode(GPIOE, 1, OUTPUT); - // Init the graphic stack gfx_init(); platform_setBacklightLevel(255); @@ -45,8 +67,9 @@ int main(void) { gfx_clearScreen(); gfx_print(origin, buffer, FONT_SIZE_4, TEXT_ALIGN_CENTER, color_yellow); - gfx_render(); - while(gfx_renderingInProgress()); + //gfx_render(); + //while(gfx_renderingInProgress()); + platform_test(); OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err); } }