From 7ef248f488bc1e5e85f50e972fa5a90f0d5906dd Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Sat, 14 Nov 2020 15:16:23 +0100 Subject: [PATCH] Renamed tests to better describe their function --- tests/platform/{print_gpio.c => gpio_demo.c} | 0 tests/platform/gui_demo.c | 71 +++++++++++++++++++ tests/platform/{x64_uC.c => kek_demo.c} | 0 .../{print_keys.c => keyboard_demo.c} | 0 .../{platform_test.c => platform_demo.c} | 0 5 files changed, 71 insertions(+) rename tests/platform/{print_gpio.c => gpio_demo.c} (100%) create mode 100644 tests/platform/gui_demo.c rename tests/platform/{x64_uC.c => kek_demo.c} (100%) rename tests/platform/{print_keys.c => keyboard_demo.c} (100%) rename tests/platform/{platform_test.c => platform_demo.c} (100%) diff --git a/tests/platform/print_gpio.c b/tests/platform/gpio_demo.c similarity index 100% rename from tests/platform/print_gpio.c rename to tests/platform/gpio_demo.c diff --git a/tests/platform/gui_demo.c b/tests/platform/gui_demo.c new file mode 100644 index 00000000..26b2ab36 --- /dev/null +++ b/tests/platform/gui_demo.c @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2020 by Federico Izzo IU2NUO, Niccolò Izzo IU2KIN and * + * Silvano Seva IU2KWO * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#include +#include +#include +#include +#include "gpio.h" +#include "graphics.h" +#include "hwconfig.h" +#include "platform.h" +#include "state.h" +#include "keyboard.h" +#include "ui.h" + + +int main(void) +{ + OS_ERR os_err; + + // Initialize the radio state + state_init(); + + // Init the graphic stack + gfx_init(); + platform_setBacklightLevel(255); + + // Print splash screen + point_t splash_origin = {0, SCREEN_HEIGHT / 2}; + color_t color_yellow_fab413 = {250, 180, 19}; + char *splash_buf = "OpenRTX"; + gfx_clearScreen(); + gfx_print(splash_origin, splash_buf, FONT_SIZE_4, TEXT_ALIGN_CENTER, color_yellow_fab413); + gfx_render(); + while(gfx_renderingInProgress()); + OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err); + + // Clear screen + gfx_clearScreen(); + gfx_render(); + while(gfx_renderingInProgress()); + + // UI update infinite loop + while(1) + { + state_t state = state_update(); + uint32_t keys = kbd_getKeys(); + bool renderNeeded = ui_update(state, keys); + if(renderNeeded) + { + gfx_render(); + while(gfx_renderingInProgress()); + } + OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err); + } +} diff --git a/tests/platform/x64_uC.c b/tests/platform/kek_demo.c similarity index 100% rename from tests/platform/x64_uC.c rename to tests/platform/kek_demo.c diff --git a/tests/platform/print_keys.c b/tests/platform/keyboard_demo.c similarity index 100% rename from tests/platform/print_keys.c rename to tests/platform/keyboard_demo.c diff --git a/tests/platform/platform_test.c b/tests/platform/platform_demo.c similarity index 100% rename from tests/platform/platform_test.c rename to tests/platform/platform_demo.c