Add support for SpiNorFlash and FS (#30)
The external SPI flash is implemented as a 4MB on the local filesystem. This allows the FS (littleFS) and settings to work properly. Remove the simulated `FS.h` and `FS.cpp`, because we can now use the files from InfiniTime directly as the heavy lifting is done in the simulated `SpiNorFlash.h` and cpp files. `SpiNorFlash.h` provides read and write functions with `uint8_t` buffer, but `fs::fstream` expects `char` buffer. Use `reinterpret_cast` and check if by any chance the `char` type on a platform is implemented with more than one byte. Then the `reinterpret_cast<char *>(buffer)` would change the meaning of the `size` parameter, which could lead to garbage data. Co-authored-by: Reinhold Gschweicher <pyro4hell@gmail.com>
This commit is contained in:
6
main.cpp
6
main.cpp
@@ -224,7 +224,7 @@ Pinetime::Drivers::Spi lcdSpi {spi, Pinetime::PinMap::SpiLcdCsn};
|
||||
Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand};
|
||||
|
||||
Pinetime::Drivers::Spi flashSpi {spi, Pinetime::PinMap::SpiFlashCsn};
|
||||
Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi};
|
||||
Pinetime::Drivers::SpiNorFlash spiNorFlash {"spiNorFlash.raw"};
|
||||
|
||||
// The TWI device should work @ up to 400Khz but there is a HW bug which prevent it from
|
||||
// respecting correct timings. According to erratas heet, this magic value makes it run
|
||||
@@ -252,7 +252,7 @@ Pinetime::Controllers::Ble bleController;
|
||||
Pinetime::Controllers::HeartRateController heartRateController;
|
||||
Pinetime::Applications::HeartRateTask heartRateApp(heartRateSensor, heartRateController);
|
||||
|
||||
Pinetime::Controllers::FS fs; // {spiNorFlash};
|
||||
Pinetime::Controllers::FS fs {spiNorFlash};
|
||||
Pinetime::Controllers::Settings settingsController {fs};
|
||||
Pinetime::Controllers::MotorController motorController {};
|
||||
|
||||
@@ -837,6 +837,8 @@ int main(int argc, char **argv)
|
||||
/*Initialize the HAL (display, input devices, tick) for LVGL*/
|
||||
hal_init();
|
||||
|
||||
fs.Init();
|
||||
|
||||
// initialize the core of our Simulator
|
||||
Framework fw(fw_status_window_visible, 240,240);
|
||||
|
||||
|
Reference in New Issue
Block a user