main.c: Add Platform test

This commit is contained in:
Federico Amedeo Izzo 2020-10-25 11:54:43 +01:00 committed by Niccolò Izzo
parent adb4995653
commit 1877f92905
1 changed files with 28 additions and 5 deletions

View File

@ -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);
}
}