diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c index 1965ba35..a27a3db5 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.c @@ -70,7 +70,6 @@ void flash_read(uint32_t address, size_t bytes, uint8_t *out) { sector_read_cmd[1] = (address >> 16) & 0xFF; sector_read_cmd[2] = (address >> 8) & 0xFF; sector_read_cmd[3] = address & 0xFF; - uint8_t dummy[1]; spiAcquireBus(&SPID3); spiStart(&SPID3, &flash_spicfg); @@ -81,7 +80,7 @@ void flash_read(uint32_t address, size_t bytes, uint8_t *out) { spiReleaseBus(&SPID3); } -void flash_write(uint32_t address, size_t bytes, uint8_t *data) { +void flash_write(uint32_t address, size_t bytes, const uint8_t *data) { static uint8_t flash_write_cmd[4]; flash_write_enable(); @@ -90,7 +89,6 @@ void flash_write(uint32_t address, size_t bytes, uint8_t *data) { flash_write_cmd[1] = (address >> 16) & 0xFF; flash_write_cmd[2] = (address >> 8) & 0xFF; flash_write_cmd[3] = address & 0xFF; - uint8_t dummy[1]; spiAcquireBus(&SPID3); spiStart(&SPID3, &flash_spicfg); @@ -112,14 +110,18 @@ bool flash_tp_calibrated(void) { } void flash_tp_calibration_save(uint16_t instance, const uint8_t *calbuf, size_t sz) { + if (instance) return; flash_sector_erase(0x0F0000); uint8_t calibrated = 0x01; flash_write(0x0F0000, 1, &calibrated); flash_write(0x0F0001, sz, calbuf); } const char *flash_tp_calibration_load(uint16_t instance) { - static char foo[24]; + static uint8_t foo[24]; + + if (instance) return 0; + if (!flash_tp_calibrated()) return 0; flash_read(0x0F0001, 24, foo); - return foo; -} \ No newline at end of file + return (char *)foo; +} diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.h b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.h index 5be7523f..2dcc9206 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.h +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/ChibiOS_Board/flash_memory.h @@ -1,6 +1,6 @@ void flash_sector_erase(uint32_t sector); void flash_read(uint32_t address, size_t bytes, uint8_t *out); -void flash_write(uint32_t address, size_t bytes, uint8_t *data); +void flash_write(uint32_t address, size_t bytes, const uint8_t *data); bool flash_tp_calibrated(void); void flash_tp_calibration_save(uint16_t instance, const uint8_t *calbuf, size_t sz); -const char *flash_tp_calibration_load(uint16_t instance); \ No newline at end of file +const char *flash_tp_calibration_load(uint16_t instance); diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h b/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h index ec7292eb..c73c68a9 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/board_ILI9341.h @@ -36,14 +36,6 @@ static inline void init_board(GDisplay *g) { SET_RD; SET_WR; CLR_CS; - - /* Hardware reset */ - palSetPad(GPIOE, GPIOE_LCD_RST); - chThdSleepMilliseconds(100); - palClearPad(GPIOE, GPIOE_LCD_RST); - chThdSleepMilliseconds(100); - palSetPad(GPIOE, GPIOE_LCD_RST); - chThdSleepMilliseconds(100); break; } } diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/readme.txt b/boards/base/Mikromedia-STM32-M4-ILI9341/readme.txt index 79b430d2..961f9793 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/readme.txt +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/readme.txt @@ -12,5 +12,3 @@ As this is not a standard ChibiOS supported board the necessary board files have been provided in the ChibiOS_Board directory. There is an example Makefile and project in the examples directory. - -Note: The video driver currently has bugs! \ No newline at end of file