diff --git a/meson.build b/meson.build index 6d73855e..ddaae0c7 100644 --- a/meson.build +++ b/meson.build @@ -11,7 +11,7 @@ project('OpenRTX', 'c', ## OpenRTX -openrtx_src = ['openrtx/src/main.c', +openrtx_src = ['tests/platform/printCalib_MDUV380.c', 'openrtx/src/bootstrap.c', 'openrtx/src/state.c', 'openrtx/src/ui.c', @@ -20,6 +20,7 @@ openrtx_src = ['openrtx/src/main.c', openrtx_inc = ['openrtx/include/interfaces', 'openrtx/include', 'platform/drivers/ADC', + 'platform/drivers/NVM', 'platform/drivers/tones', 'openrtx/include/fonts/adafruit'] @@ -161,6 +162,7 @@ md390_def = def + stm32f405_def ## TYT MD-UV380 mduv380_src = src + stm32f405_src + ['platform/drivers/display/HX83XX_MDx.c', 'platform/drivers/keyboard/keyboard_MDx.c', + 'platform/drivers/NVM/extFlash_MDx.c', 'platform/drivers/ADC/ADC1_MDx.c', 'platform/targets/MD-UV380/platform.c', 'openrtx/src/graphics/graphics_rgb565.c'] diff --git a/platform/targets/MD-UV380/hwconfig.h b/platform/targets/MD-UV380/hwconfig.h index 466894e6..dd0864a0 100644 --- a/platform/targets/MD-UV380/hwconfig.h +++ b/platform/targets/MD-UV380/hwconfig.h @@ -72,6 +72,12 @@ #define MONI_SW LCD_D6 #define FUNC_SW LCD_D7 +/* External flash */ +#define FLASH_CS GPIOD,7 +#define FLASH_CLK GPIOB,3 +#define FLASH_SDO GPIOB,4 +#define FLASH_SDI GPIOB,5 + /* * To enable pwm for display backlight dimming uncomment this directive. * diff --git a/tests/platform/printCalib_MDUV380.c b/tests/platform/printCalib_MDUV380.c new file mode 100644 index 00000000..aaec1273 --- /dev/null +++ b/tests/platform/printCalib_MDUV380.c @@ -0,0 +1,38 @@ + +#include +#include +#include +#include "extFlash_MDx.h" + +int main() +{ + extFlash_init(); + extFlash_wakeup(); + + while(1) + { + getchar(); + + uint8_t buf[16]; + uint32_t addr = 0x1000; + for(; addr < 0x1100; addr += sizeof(buf)) + { + (void) extFlash_readSecurityRegister(addr, buf, sizeof(buf)); + printf("\r\n%lx: ", addr); + for(unsigned int i = 0; i < sizeof(buf); i++) printf("%03d ", buf[i]); + } + + puts("\r"); + + for(addr = 0x2000; addr < 0x2100; addr += sizeof(buf)) + { + (void) extFlash_readSecurityRegister(addr, buf, sizeof(buf)); + printf("\r\n%lx: ", addr); + for(unsigned int i = 0; i < sizeof(buf); i++) printf("%03d ", buf[i]); + } + + puts("\r"); + } + + return 0; +}