From 7b1ff7190758e12b49982073d3e3e788ad1d002f Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Tue, 29 Jul 2025 21:49:28 +0200 Subject: [PATCH] tests: platform: cleanup deprecated tesuites --- tests/platform/MD380_FM_simpleRtx.c | 80 ---------------- tests/platform/MDx_display_benchmark.c | 94 ------------------- tests/platform/channel_knob_test.c | 42 --------- tests/platform/codeplug_demo.c | 86 ----------------- tests/platform/display_test_SDL.c | 80 ---------------- tests/platform/dumpEeprom_GDx.c | 63 ------------- tests/platform/dumpExtFlash_MDx.c | 53 ----------- tests/platform/dumpSecurityRegs_MDx.c | 70 -------------- tests/platform/gps_test_MDx.c | 123 ------------------------- tests/platform/gui_demo.c | 72 --------------- tests/platform/hello_world.c | 37 -------- tests/platform/kek_demo.c | 114 ----------------------- tests/platform/layout_demo.c | 52 ----------- tests/platform/overwriteExtFlash_MDx.c | 106 --------------------- tests/platform/printContacts_MDx.c | 52 ----------- tests/platform/printHwInfo.c | 44 --------- tests/platform/rx_test.c | 60 ------------ tests/platform/volume_knob_test.c | 39 -------- tests/platform/writeExtFlash_MDx.c | 87 ----------------- 19 files changed, 1354 deletions(-) delete mode 100644 tests/platform/MD380_FM_simpleRtx.c delete mode 100644 tests/platform/MDx_display_benchmark.c delete mode 100644 tests/platform/channel_knob_test.c delete mode 100644 tests/platform/codeplug_demo.c delete mode 100644 tests/platform/display_test_SDL.c delete mode 100644 tests/platform/dumpEeprom_GDx.c delete mode 100644 tests/platform/dumpExtFlash_MDx.c delete mode 100644 tests/platform/dumpSecurityRegs_MDx.c delete mode 100644 tests/platform/gps_test_MDx.c delete mode 100644 tests/platform/gui_demo.c delete mode 100644 tests/platform/hello_world.c delete mode 100644 tests/platform/kek_demo.c delete mode 100644 tests/platform/layout_demo.c delete mode 100644 tests/platform/overwriteExtFlash_MDx.c delete mode 100644 tests/platform/printContacts_MDx.c delete mode 100644 tests/platform/printHwInfo.c delete mode 100644 tests/platform/rx_test.c delete mode 100644 tests/platform/volume_knob_test.c delete mode 100644 tests/platform/writeExtFlash_MDx.c diff --git a/tests/platform/MD380_FM_simpleRtx.c b/tests/platform/MD380_FM_simpleRtx.c deleted file mode 100644 index 72fd740d..00000000 --- a/tests/platform/MD380_FM_simpleRtx.c +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 -#include -#include -#include -#include -#include "hwconfig.h" -#include "toneGenerator_MDx.h" - -OS_MUTEX mutex; -OS_ERR err; - -static const freq_t rptFreq = 430100000; -static const freq_t rptShift = 1600000; -static const tone_t ctcss = 719; - -int main(void) -{ - platform_init(); - toneGen_init(); - - OSMutexCreate(&mutex, "", &err); - - rtx_init(&mutex); - - - rtxStatus_t cfg; - - /* Take mutex and update the RTX configuration */ - OSMutexPend(&mutex, 0, OS_OPT_PEND_BLOCKING, NULL, &err); - - cfg.opMode = OPMODE_FM; - cfg.bandwidth = BW_25; - cfg.rxFrequency = rptFreq; - cfg.txFrequency = rptFreq + rptShift; - cfg.txPower = 1.0f; - cfg.sqlLevel = 3; - cfg.rxTone = 0; - cfg.txTone = ctcss; - - OSMutexPost(&mutex, OS_OPT_POST_NONE, &err); - - /* After mutex has been released, post the new configuration */ - rtx_configure(&cfg); - - while (1) - { - rtx_taskFunc(); - - /* You can also resync the cfg */ - cfg = rtx_getCurrentStatus(); - - OSTimeDlyHMSM(0u, 0u, 0u, 10u, OS_OPT_TIME_HMSM_STRICT, &err); - } - - return 0; -} diff --git a/tests/platform/MDx_display_benchmark.c b/tests/platform/MDx_display_benchmark.c deleted file mode 100644 index 31c4e017..00000000 --- a/tests/platform/MDx_display_benchmark.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 -#include -#include - -uint64_t benchmark(uint32_t n); - -int main() -{ - platform_init(); - platform_setBacklightLevel(255); - - gfx_init(); - kbd_init(); - - /* - * Setup timer for time measurement: input clock is twice the APB2 clock, so - * is 168MHz. Setting the prescaler to 33 we get a tick frequency of - * 5,09090909091 MHz, that is a resolution of 0.196 us per tick. - * Considering that the timer has a 16-bit counter, we have rollover in - * 12.87 ms. - */ - - static const uint32_t clkDivider = 33; - - RCC->APB2ENR |= RCC_APB2ENR_TIM9EN; - - TIM9->PSC = clkDivider - 1; - TIM9->ARR = 0xFFFF; - TIM9->CR1 = TIM_CR1_CEN; - - uint32_t numIterations = 128; - - while(1) - { - getchar(); - - uint64_t tot_ticks = benchmark(numIterations); - - float totalTime_s = ((float)(tot_ticks * clkDivider))/168000000.0f; - printf("Average values over %ld iterations:\r\n", numIterations); - printf("- %lld ticks\r\n- %f ms\r\n", tot_ticks, totalTime_s*1000.0f); - - } -} - -uint64_t benchmark(uint32_t n) -{ - uint64_t totalTime = 0; - uint32_t dummy = 0; - - for(uint32_t i = 0; i < n; i++) - { - gfx_clearScreen(); - point_t origin = {0, i % 128}; - color_t color_red = {255, 0, 0, 255}; - color_t color_white = {255, 255, 255, 255}; - gfx_drawRect(origin, 160, 20, color_red, 1); - gfx_print(origin, buffer, FONT_SIZE_24PT, TEXT_ALIGN_LEFT, - color_white, "KEK"); - - dummy += kbd_getKeys(); - - /* Measure the time taken by gfx_render() */ - TIM9->CNT = 0; - gfx_render(); - totalTime += TIM9->CNT; - } - - return totalTime/n; -} diff --git a/tests/platform/channel_knob_test.c b/tests/platform/channel_knob_test.c deleted file mode 100644 index 4f8ee899..00000000 --- a/tests/platform/channel_knob_test.c +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - platform_init(); - - gpio_setMode(CH_SELECTOR_0, INPUT_PULL_UP); - gpio_setMode(CH_SELECTOR_1, INPUT_PULL_UP); - - while(1) - { - iprintf("%d %d\r\n", gpio_readPin(CH_SELECTOR_0), - gpio_readPin(CH_SELECTOR_1)); - delayMs(1000); - } - - return 0; -} diff --git a/tests/platform/codeplug_demo.c b/tests/platform/codeplug_demo.c deleted file mode 100644 index 03a27696..00000000 --- a/tests/platform/codeplug_demo.c +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - nvm_init(); - - getchar(); - printf("Codeplug Demo!\r\n\r\n"); - printf("Channels:\r\n"); - for(int pos=0,result=0; result != -1; pos++) - { - channel_t ch; - result = cps_readChannel(&ch, pos); - if(result != -1) - { - printf("Channel n.%d:\r\n", pos+1); - printf(" %s\r\n TX: %ld\r\n RX: %ld\r\n Mode: %s\r\n Bandwidth: %s\r\n", - ch.name, - ch.tx_frequency, - ch.rx_frequency, - (ch.mode == 1) ? "DMR" : "FM", - (ch.bandwidth == BW_12_5) ? "12.5kHz" : ((ch.bandwidth == BW_20) - ? "20kHz" : "25kHz")); - } - puts("\r"); - } - printf("Zones:\r\n"); - for(int pos=0,result=0; result != -1; pos++) - { - zone_t bank; - result = cps_readZoneData(&bank, pos); - if(result != -1) - { - printf("Zone n.%d:\r\n", pos+1); - printf(" %s\r\n", bank.name); - for(int x=0; x < 64; x++) - { - if(bank.member[x] != 0) - { - printf(" - Index: %d, Channel %d\r\n", x, bank.member[x]); - } - } - } - puts("\r"); - } - printf("Contacts:\r\n"); - for(int pos=0,result=0; result != -1; pos++) - { - contact_t contact; - result = cps_readContact(&contact, pos); - if(result != -1) - { - printf("Contact n.%d:\r\n", pos+1); - printf(" %s\r\n", contact.name); - printf(" - DMR ID:%lu\r\n", contact.id); - printf(" - Type:%d\r\n", contact.type); - printf(" - Receive Tone:%s\r\n", contact.receive_tone ? "True" : "False"); - } - puts("\r"); - } - return 0; -} diff --git a/tests/platform/display_test_SDL.c b/tests/platform/display_test_SDL.c deleted file mode 100644 index d06286a8..00000000 --- a/tests/platform/display_test_SDL.c +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * 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 * - ***************************************************************************/ - -/** - * Testing module for SDL-based display driver, serves both to check that - * everything is fine and as a simple example on how to use both the driver and - * the SDL platform. - * - * To adjust screen dimensions you have to adjust the corresponding constants in - * the driver source file. - */ - -#include -#include -#include -#include -#include -#undef main //necessary to avoid conflicts with SDL_main - - -void drawRect(int x, int y, int width, int height, uint16_t color) -{ - int x_max = x + width; - int y_max = y + height; - uint16_t *buf = (uint16_t *)(display_getFrameBuffer()); - - for(int i=y; i < y_max; i++) - { - for(int j=x; j < x_max; j++) - { - buf[j + i * SCREEN_WIDTH] = color; - } - } -} - -int main() -{ - display_init(); - - /* Horizontal red line */ - drawRect(0, 10, SCREEN_WIDTH, 20, 0xF800); - - /* Vertical blue line */ - drawRect(10, 0, 20, SCREEN_HEIGHT, 0x001F); - - /* Vertical green line */ - drawRect(80, 0, 20, SCREEN_HEIGHT, 0x07e0); - - /* - * Use SDL event listener to check if window close button has been pressed, - * in this case quit. - */ - SDL_Event eventListener; - - while(1) - { - display_render(); - SDL_PollEvent(&eventListener); - if(eventListener.type == SDL_QUIT) break; - } - - display_terminate(); - return 0; -} diff --git a/tests/platform/dumpEeprom_GDx.c b/tests/platform/dumpEeprom_GDx.c deleted file mode 100644 index 76d9a362..00000000 --- a/tests/platform/dumpEeprom_GDx.c +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -void printChunk(void *chunk) -{ - uint8_t *ptr = ((uint8_t *) chunk); - for(size_t i = 0; i < 16; i++) printf("%02x ", ptr[i]); - for(size_t i = 0; i < 16; i++) - { - if((ptr[i] > 0x22) && (ptr[i] < 0x7f)) - { - printf("%c", ptr[i]); - } - else - { - printf("."); - } - } -} - -int main() -{ - - AT24Cx_init(); - - while(1) - { - getchar(); - - for(uint16_t addr = 0; addr < 0x10000; addr += 16) - { - uint8_t buf[16]; - AT24Cx_readData(addr, buf, 16); - printf("\r\n%lx: ", addr); - printChunk(buf); - puts("\r"); - } - } - - return 0; -} diff --git a/tests/platform/dumpExtFlash_MDx.c b/tests/platform/dumpExtFlash_MDx.c deleted file mode 100644 index fce5ef8f..00000000 --- a/tests/platform/dumpExtFlash_MDx.c +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 "W25Qx.h" -#include - -void printChunk(void *chunk) -{ - uint8_t *ptr = ((uint8_t *) chunk); - for(size_t i = 0; i < 16; i++) printf("%02x ", ptr[i]); - for(size_t i = 0; i < 16; i++) - { - if((ptr[i] > 0x22) && (ptr[i] < 0x7f)) printf("%c", ptr[i]); - else printf("."); - } -} - -int main() -{ - delayMs(5000); - W25Qx_init(); - W25Qx_wakeup(); - - for(uint32_t addr = 0; addr < 0xFFFFFF; addr += 16) - { - uint8_t buf[16]; - (void) W25Qx_readData(addr, buf, 16); - printf("\r\n%08lx: ", addr); - printChunk(buf); - } - - return 0; -} diff --git a/tests/platform/dumpSecurityRegs_MDx.c b/tests/platform/dumpSecurityRegs_MDx.c deleted file mode 100644 index b6ed5a34..00000000 --- a/tests/platform/dumpSecurityRegs_MDx.c +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -void printChunk(void *chunk) -{ - uint8_t *ptr = ((uint8_t *) chunk); - for(size_t i = 0; i < 16; i++) printf("%02x ", ptr[i]); - for(size_t i = 0; i < 16; i++) - { - if((ptr[i] > 0x22) && (ptr[i] < 0x7f)) printf("%c", ptr[i]); - else printf("."); - } -} - -void printSecurityRegister(uint32_t reg) -{ - uint8_t secRegister[256] = {0}; - W25Qx_wakeup(); - W25Qx_readSecurityRegister(reg, secRegister, 256); - W25Qx_sleep(); - - for(uint32_t addr = 0; addr < 256; addr += 16) - { - printf("\r\n%02lx: ", addr); - printChunk(&(secRegister[addr])); - } -} - -int main() -{ - W25Qx_init(); - - while(1) - { - getchar(); - - printf("0x1000:"); - printSecurityRegister(0x1000); - - printf("\r\n\r\n0x2000:"); - printSecurityRegister(0x2000); - - printf("\r\n\r\n0x3000:"); - printSecurityRegister(0x3000); - } - - return 0; -} diff --git a/tests/platform/gps_test_MDx.c b/tests/platform/gps_test_MDx.c deleted file mode 100644 index 02b638fc..00000000 --- a/tests/platform/gps_test_MDx.c +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 -#include -#include -#include - -char line[MINMEA_MAX_LENGTH*10]; - -int main() -{ - platform_init(); - - printf("Checking for GPS... "); - bool hasGps = gps_detect(5000); - printf(" %s.\r\n", hasGps ? "OK" : "TIMEOUT"); - - gps_init(9600); - gps_enable(); - - while(1) - { - int len = gps_getNmeaSentence(line, MINMEA_MAX_LENGTH*10); - if(len != -1) - { - printf("Got sentence with length %d:\r\n", len); - printf("%s\r\n", line); - switch (minmea_sentence_id(line, false)) { - case MINMEA_SENTENCE_RMC: - { - struct minmea_sentence_rmc frame; - if (minmea_parse_rmc(&frame, line)) { - printf("$RMC: raw coordinates and speed: (%d/%d,%d/%d) %d/%d\n\r", - frame.latitude.value, frame.latitude.scale, - frame.longitude.value, frame.longitude.scale, - frame.speed.value, frame.speed.scale); - printf("$RMC fixed-point coordinates and speed scaled to three decimal places: (%d,%d) %d\n\r", - minmea_rescale(&frame.latitude, 1000), - minmea_rescale(&frame.longitude, 1000), - minmea_rescale(&frame.speed, 1000)); - printf("$RMC floating point degree coordinates and speed: (%f,%f) %f\n\r", - minmea_tocoord(&frame.latitude), - minmea_tocoord(&frame.longitude), - minmea_tofloat(&frame.speed)); - } - } break; - - case MINMEA_SENTENCE_GGA: - { - struct minmea_sentence_gga frame; - if (minmea_parse_gga(&frame, line)) { - printf("$GGA: fix quality: %d\n\r", frame.fix_quality); - } - } break; - - case MINMEA_SENTENCE_GSV: - { - struct minmea_sentence_gsv frame; - if (minmea_parse_gsv(&frame, line)) { - printf("$GSV: message %d of %d\n\r", frame.msg_nr, frame.total_msgs); - printf("$GSV: satellites in view: %d\n\r", frame.total_sats); - for (int i = 0; i < 4; i++) - printf("$GSV: sat nr %d, elevation: %d, azimuth: %d, snr: %d dbm\n\r", - frame.sats[i].nr, - frame.sats[i].elevation, - frame.sats[i].azimuth, - frame.sats[i].snr); - } - } break; - - case MINMEA_SENTENCE_VTG: - { - - } break; - - // Ignore this message as we take data from RMC - case MINMEA_SENTENCE_GLL: - ; - break; - - // These messages are never sent by the Jumpstar JS-M710 Module - case MINMEA_SENTENCE_GSA: break; - case MINMEA_SENTENCE_GST: break; - case MINMEA_SENTENCE_ZDA: break; - - // Error handling - case MINMEA_INVALID: - { - printf("Error: Invalid NMEA sentence!\n\r"); - } break; - - case MINMEA_UNKNOWN: - { - printf("Error: Unsupported NMEA sentence!\n\r"); - } break; - } - } - } - - return 0; -} diff --git a/tests/platform/gui_demo.c b/tests/platform/gui_demo.c deleted file mode 100644 index ac9fb439..00000000 --- a/tests/platform/gui_demo.c +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * 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 -#include -#include "hwconfig.h" -#include -#include "state.h" -#include -#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}; - gfx_clearScreen(); - gfx_print(splash_origin, FONT_SIZE_4, TEXT_ALIGN_CENTER, - color_yellow_fab413, "OpenRTX"); - 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(); - keyboard_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/hello_world.c b/tests/platform/hello_world.c deleted file mode 100644 index edba4641..00000000 --- a/tests/platform/hello_world.c +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - platform_init(); - - while(1) - { - OS_ERR err; - printf("Hello world\n"); - OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &err); - } - - return 0; -} diff --git a/tests/platform/kek_demo.c b/tests/platform/kek_demo.c deleted file mode 100644 index 05c96bb9..00000000 --- a/tests/platform/kek_demo.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#undef main - -#include - -static OS_TCB App_TaskStartTCB; -static CPU_STK_SIZE App_TaskStartStk[APP_CFG_TASK_START_STK_SIZE]; -static void App_TaskStart(void *p_arg); - -static OS_TCB gfxTCB; -static CPU_STK_SIZE gfxStk[APP_CFG_TASK_START_STK_SIZE]; -static void gfxThread(void *arg); - -static int running = 0; - -int main (void) -{ - OS_ERR err; - running = 1; - - OSInit(&err); - OS_CPU_SysTickInit(); - - OSTaskCreate((OS_TCB *)&App_TaskStartTCB, - (CPU_CHAR *)"App Task Start", - (OS_TASK_PTR ) App_TaskStart, - (void *) 0, - (OS_PRIO ) APP_CFG_TASK_START_PRIO, - (CPU_STK *)&App_TaskStartStk[0], - (CPU_STK )(APP_CFG_TASK_START_STK_SIZE / 10u), - (CPU_STK_SIZE) APP_CFG_TASK_START_STK_SIZE, - (OS_MSG_QTY ) 0, - (OS_TICK ) 0, - (void *) 0, - (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR), - (OS_ERR *)&err); - - OSTaskCreate((OS_TCB *)&gfxTCB, - (CPU_CHAR *)"gfx", - (OS_TASK_PTR ) gfxThread, - (void *) 0, - (OS_PRIO ) APP_CFG_TASK_START_PRIO, - (CPU_STK *)&gfxStk[0], - (CPU_STK )(APP_CFG_TASK_START_STK_SIZE / 10u), - (CPU_STK_SIZE) APP_CFG_TASK_START_STK_SIZE, - (OS_MSG_QTY ) 0, - (OS_TICK ) 0, - (void *) 0, - (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR), - (OS_ERR *)&err); - - OSStart(&err); - - printf("OSStart returned, quitting\n"); - return 0; -} - -static void App_TaskStart(void *p_arg) -{ - - (void) p_arg; - OS_ERR os_err; - -// OS_CPU_SysTickInit(); - - while (running) - { - printf("uCOS-III is running.\n"); - OSTimeDlyHMSM(0u, 0u, 1u, 0u, OS_OPT_TIME_HMSM_STRICT, &os_err); - } - - exit(1); -} - -static void gfxThread(void *arg) -{ - (void) arg; - OS_ERR os_err; - - int pos = 0; - SDL_Event eventListener; - - gfx_init(); - - while(1) - { - SDL_PollEvent(&eventListener); - if(eventListener.type == SDL_QUIT) break; - - gfx_clearScreen(); - point_t origin = {0, pos}; - color_t color_red = {255, 0, 0}; - color_t color_white = {255, 255, 255}; - gfx_drawRect(origin, SCREEN_WIDTH, 20, color_red, 1); - gfx_print(origin, FONT_SIZE_4, TEXT_ALIGN_LEFT, - color_white, "KEK"); - gfx_render(); - while(gfx_renderingInProgress()) ; - pos += 20; - if(pos > SCREEN_HEIGHT - 20) pos = 0; - - OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err); - } - - running = 0; - OSTimeDlyHMSM(0u, 0u, 0u, 100u, OS_OPT_TIME_HMSM_STRICT, &os_err); - gfx_terminate(); -} diff --git a/tests/platform/layout_demo.c b/tests/platform/layout_demo.c deleted file mode 100644 index 4d75a3ed..00000000 --- a/tests/platform/layout_demo.c +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * 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 -#include "ui.h" - - -int main(void) -{ - platform_init(); - // Init the graphic stack - gfx_init(); - gfx_clearScreen(); - gfx_render(); - platform_setBacklightLevel(255); - - while(1) - { - for(int tot=1; tot<=10; tot++) - { - gfx_clearScreen(); - for(int cur=1; cur<=tot; cur++) - { - gfx_printLine(cur, tot, 0, 0, 0, FONT_SIZE_8PT, TEXT_ALIGN_CENTER, - color_white, "Line %2d of %2d", cur, tot); - } - gfx_render(); - // Sleep for 1 second - sleepFor(1u, 0u); - } - } -} diff --git a/tests/platform/overwriteExtFlash_MDx.c b/tests/platform/overwriteExtFlash_MDx.c deleted file mode 100644 index d2ff6562..00000000 --- a/tests/platform/overwriteExtFlash_MDx.c +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 * - ***************************************************************************/ - - // ####### DISCLAIMER ######### - // This test overwrites a portion of the SPI flash memory - // Run this only if you know what you are doing! - -#include -#include -#include -#include "W25Qx.h" - -void printChunk(void *chunk) -{ - uint8_t *ptr = ((uint8_t *) chunk); - for(size_t i = 0; i < 16; i++) printf("%02x ", ptr[i]); - for(size_t i = 0; i < 16; i++) - { - if((ptr[i] > 0x22) && (ptr[i] < 0x7f)) printf("%c", ptr[i]); - else printf("."); - } -} - -int main() -{ - W25Qx_init(); - W25Qx_wakeup(); - - uint8_t testData[16] = {0}; - uint8_t buffer[256] = {0}; - - while(1) - { - getchar(); - - // On UV380 flash at 0x6000 there are 36032 bytes of 0xFF - uint32_t addr = 0x6000; - printf("Read memory @ 0x%x\r\n", addr); - W25Qx_readData(addr, buffer, 256); - for (int offset = 0; offset < 256; offset += 16) - { - printf("\r\n%lx: ", addr + offset); - printChunk(buffer + offset); - } - // Prepare test data - for(int i = 0; i < 16; i++) - { - testData[i] = 'a' + (i % 16); - } - printf("\r\nOverwrite memory @ 0x6000... "); - bool success = W25Qx_writeData(addr, testData, 16); - printf("%s\r\n", success ? "success" : "failed"); - - printf("Read memory @ 0x%x\r\n", addr); - W25Qx_readData(addr, buffer, 256); - for (int offset = 0; offset < 256; offset += 16) - { - printf("\r\n%lx: ", addr + offset); - printChunk(buffer + offset); - } - - uint32_t blockAddr = addr / 4096 * 4096; - printf("\r\nErase memory @ 0x%x... ", blockAddr); - success = W25Qx_eraseSector(blockAddr); - printf("%s\r\n", success ? "success" : "failed"); - - printf("Read memory @ 0x%x\r\n", addr); - W25Qx_readData(addr, buffer, 256); - for (int offset = 0; offset < 256; offset += 16) - { - printf("\r\n%lx: ", addr + offset); - printChunk(buffer + offset); - } - - printf("\r\nWrite memory @ 0x%x... ", addr); - success = W25Qx_writePage(addr, testData, 16); - printf("%s\r\n", success ? "success" : "failed"); - - printf("Read memory @ 0x%x\r\n", addr); - W25Qx_readData(addr, buffer, 256); - for (int offset = 0; offset < 256; offset += 16) - { - printf("\r\n%lx: ", addr + offset); - printChunk(buffer + offset); - } - } - - return 0; -} diff --git a/tests/platform/printContacts_MDx.c b/tests/platform/printContacts_MDx.c deleted file mode 100644 index f5da2bf4..00000000 --- a/tests/platform/printContacts_MDx.c +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - nvm_init(); - - uint16_t pos = 0; - - while(1) - { - getchar(); - - channel_t ch; - cps_readChannel(&ch, pos); - printf("Contact entry %d:\r\n", pos+1); - printf(" %s\r\n TX: %ld\r\n RX: %ld\r\n Mode: %s\r\n Bandwidth: %s\r\n", - ch.name, - ch.tx_frequency, - ch.rx_frequency, - (ch.mode == 1) ? "DMR" : "FM", - (ch.bandwidth == BW_12_5) ? "12.5kHz" : ((ch.bandwidth == BW_20) - ? "20kHz" : "25kHz")); - puts("\r"); - pos += 1; - } - - return 0; -} diff --git a/tests/platform/printHwInfo.c b/tests/platform/printHwInfo.c deleted file mode 100644 index ad02112a..00000000 --- a/tests/platform/printHwInfo.c +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - platform_init(); - - const hwInfo_t *info = platform_getHwInfo(); - - while(1) - { - getchar(); - puts("** Hardware information **\r\n\r"); - printf("- Hardware name: %s\r\n", info->name); - printf("- Band support: VHF %s, UHF %s\r\n", info->vhf_band ? "yes" : "no", - info->uhf_band ? "yes" : "no"); - printf("- VHF band range: %d - %d MHz\r\n", info->vhf_minFreq, info->vhf_maxFreq); - printf("- UHF band range: %d - %d MHz\r\n", info->uhf_minFreq, info->uhf_maxFreq); - printf("- Display type: %d\r\n\r\n", info->hw_version); - } - - return 0; -} diff --git a/tests/platform/rx_test.c b/tests/platform/rx_test.c deleted file mode 100644 index 34ffcfd4..00000000 --- a/tests/platform/rx_test.c +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2021 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 -#include -#include -#include - -int main() -{ - platform_init(); - - static const size_t numSamples = 45*1024; // 90kB - stream_sample_t *sampleBuf = ((stream_sample_t *) malloc(numSamples * - sizeof(stream_sample_t))); - - audio_enableMic(); - streamId id = inputStream_start(SOURCE_RTX, PRIO_TX, sampleBuf, numSamples, - BUF_LINEAR, 24000); - - sleepFor(3u, 0u); - platform_ledOn(GREEN); - - dataBlock_t audio = inputStream_getData(id); - - platform_ledOff(GREEN); - platform_ledOn(RED); - sleepFor(10u, 0u); - - uint16_t *ptr = ((uint16_t *) audio.data); - for(size_t i = 0; i < audio.len; i++) - { - iprintf("%04x ", __builtin_bswap16(ptr[i])); - } - - while(1) ; - - return 0; -} diff --git a/tests/platform/volume_knob_test.c b/tests/platform/volume_knob_test.c deleted file mode 100644 index 59c348fe..00000000 --- a/tests/platform/volume_knob_test.c +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 - -int main() -{ - platform_init(); - - - while(1) - { - printf("%f\r\n", platform_getVolumeLevel()); - delayMs(500); - } - - return 0; -} diff --git a/tests/platform/writeExtFlash_MDx.c b/tests/platform/writeExtFlash_MDx.c deleted file mode 100644 index 6993055b..00000000 --- a/tests/platform/writeExtFlash_MDx.c +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2020 - 2025 by Federico Amedeo Izzo IU2NUO, * - * Niccolò Izzo IU2KIN * - * Frederik Saraci IU2NRO * - * 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 "W25Qx.h" - - -//static const uint32_t sector_address = 0x80000; -static const uint32_t block_address = 0x3f000; - - -uint8_t block[256] = {0}; - -void printChunk(void *chunk) -{ - uint8_t *ptr = ((uint8_t *) chunk); - for(size_t i = 0; i < 16; i++) printf("%02x ", ptr[i]); - for(size_t i = 0; i < 16; i++) - { - if((ptr[i] > 0x22) && (ptr[i] < 0x7f)) printf("%c", ptr[i]); - else printf("."); - } -} - -int main() -{ - W25Qx_init(); - W25Qx_wakeup(); - - while(1) - { - getchar(); - - printf("Attempting write... "); - - for(size_t i = 0; i < 256; i++) - { - //block[i] = 'a' + (i % 16); - block[i] = 0x00; - } - - - for(uint32_t i = 0; i < 16; i++) - W25Qx_writePage(block_address+i * 256, block, 256); - - for(uint32_t pos = 0; pos < 0x1000; pos += 16) - { - uint8_t buf[16]; - (void) W25Qx_readData(block_address + pos, buf, 16); - printf("\r\n%02lx: ", block_address + pos); - printChunk(buf); - } - - //printf("\r\n\r\nAttempting erase... "); - //bool ok = W25Qx_eraseSector(sector_address); - //printf("%d\r\n", ok); - - //for(uint32_t pos = 0; pos < 0xFF; pos += 16) - //{ - // uint8_t buf[16]; - // (void) W25Qx_readData(block_address + pos, buf, 16); - // printf("\r\n%02lx: ", pos); - // printChunk(buf); - //} - } - - return 0; -}