diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7520708..be0b7b0c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -588,7 +588,6 @@ set(INCLUDE_FILES BootloaderVersion.h logging/Logger.h logging/NrfLogger.h - port/infinitime.h displayapp/DisplayApp.h displayapp/Messages.h displayapp/TouchEvents.h diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h index f30e213d..d4aed370 100644 --- a/src/components/ble/DfuService.h +++ b/src/components/ble/DfuService.h @@ -9,8 +9,7 @@ #undef max #undef min -#include "drivers/SpiNorFlash.h" -#include "port/infinitime.h" +#include "port/SpiNorFlash.h" namespace Pinetime { namespace System { diff --git a/src/components/fs/FS.h b/src/components/fs/FS.h index 31e59986..9890f505 100644 --- a/src/components/fs/FS.h +++ b/src/components/fs/FS.h @@ -2,7 +2,7 @@ #include #include "drivers/SpiNorFlash.h" -#include "port/infinitime.h" +#include "port/SpiNorFlash.h" #include namespace Pinetime { diff --git a/src/drivers/Bma421.h b/src/drivers/Bma421.h index 0e5fd85d..5f27da15 100644 --- a/src/drivers/Bma421.h +++ b/src/drivers/Bma421.h @@ -1,6 +1,6 @@ #pragma once #include "drivers/TwiMaster.h" -#include "port/infinitime.h" +#include "port/TwiMaster.h" #include namespace Pinetime { diff --git a/src/drivers/Hrs3300.h b/src/drivers/Hrs3300.h index d3dfec44..7372a976 100644 --- a/src/drivers/Hrs3300.h +++ b/src/drivers/Hrs3300.h @@ -1,7 +1,7 @@ #pragma once #include "drivers/TwiMaster.h" -#include "port/infinitime.h" +#include "port/TwiMaster.h" namespace Pinetime { namespace Drivers { diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 8e972d83..5cca48ae 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -2,7 +2,7 @@ #include "drivers/Spi.h" #include #include -#include "port/infinitime.h" +#include "port/Spi.h" namespace Pinetime { namespace Drivers { diff --git a/src/drivers/spiFlash/SpiNorFlash.cpp b/src/drivers/spiFlash/SpiNorFlash.cpp index 51944dbc..40015590 100644 --- a/src/drivers/spiFlash/SpiNorFlash.cpp +++ b/src/drivers/spiFlash/SpiNorFlash.cpp @@ -6,7 +6,7 @@ using namespace Pinetime::Drivers::SpiFlash; -SpiNorFlash::SpiNorFlash(Pinetime::Drivers::Nrf52::Spi& spi) : spi {spi} { +SpiNorFlash::SpiNorFlash(Pinetime::Drivers::Spi& spi) : spi {spi} { } void SpiNorFlash::Init() { diff --git a/src/drivers/spiFlash/SpiNorFlash.h b/src/drivers/spiFlash/SpiNorFlash.h index d7ff9e25..d730fb2e 100644 --- a/src/drivers/spiFlash/SpiNorFlash.h +++ b/src/drivers/spiFlash/SpiNorFlash.h @@ -1,5 +1,6 @@ #pragma once -#include "drivers/nrf52/Spi.h" +#include "drivers/Spi.h" +#include "port/Spi.h" #include #include @@ -8,7 +9,7 @@ namespace Pinetime { namespace SpiFlash { class SpiNorFlash { public: - explicit SpiNorFlash(Pinetime::Drivers::Nrf52::Spi& spi); + explicit SpiNorFlash(Pinetime::Drivers::Spi& spi); SpiNorFlash(const SpiNorFlash&) = delete; SpiNorFlash& operator=(const SpiNorFlash&) = delete; SpiNorFlash(SpiNorFlash&&) = delete; @@ -54,7 +55,7 @@ namespace Pinetime { }; static constexpr uint16_t pageSize = 256; - Pinetime::Drivers::Nrf52::Spi& spi; + Pinetime::Drivers::Spi& spi; Identification device_id; }; } diff --git a/src/main.cpp b/src/main.cpp index 63baa71d..d2b2866c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,7 +58,6 @@ Pinetime::Logging::NrfLogger logger; Pinetime::Logging::DummyLogger logger; #endif -#include "port/infinitime.h" #include "port/TouchPanel.h" static constexpr uint8_t touchPanelTwiAddress = 0x15; @@ -82,7 +81,7 @@ Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; Pinetime::Drivers::Nrf52::Spi flashSpiImpl {spiImpl, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::Spi flashSpi {flashSpiImpl}; -Pinetime::Drivers::SpiFlash::SpiNorFlash spiNorFlashImpl{flashSpiImpl}; +Pinetime::Drivers::SpiFlash::SpiNorFlash spiNorFlashImpl{flashSpi}; Pinetime::Drivers::SpiNorFlash spiNorFlash {spiNorFlashImpl}; // The TWI device should work @ up to 400Khz but there is a HW bug which prevent it from diff --git a/src/port/Spi.h b/src/port/Spi.h new file mode 100644 index 00000000..4e56849b --- /dev/null +++ b/src/port/Spi.h @@ -0,0 +1,16 @@ +#pragma once +#include "drivers/Spi.h" + +#ifdef TARGET_DEVICE_PINETIME + #include +#endif + +namespace Pinetime { + namespace Drivers { +#ifdef TARGET_DEVICE_PINETIME + using Spi = Interface::Spi; +#else + #error "No target device specified!" +#endif + } +} diff --git a/src/port/SpiMaster.h b/src/port/SpiMaster.h new file mode 100644 index 00000000..57e528b1 --- /dev/null +++ b/src/port/SpiMaster.h @@ -0,0 +1,16 @@ +#pragma once +#include "drivers/SpiMaster.h" + +#ifdef TARGET_DEVICE_PINETIME + #include +#endif + +namespace Pinetime { + namespace Drivers { +#ifdef TARGET_DEVICE_PINETIME + using SpiMaster = Interface::SpiMaster; +#else + #error "No target device specified!" +#endif + } +} diff --git a/src/port/SpiNorFlash.h b/src/port/SpiNorFlash.h new file mode 100644 index 00000000..6830ae6f --- /dev/null +++ b/src/port/SpiNorFlash.h @@ -0,0 +1,16 @@ +#pragma once +#include "drivers/SpiNorFlash.h" + +#ifdef TARGET_DEVICE_PINETIME + #include +#endif + +namespace Pinetime { + namespace Drivers { +#ifdef TARGET_DEVICE_PINETIME + using SpiNorFlash = Interface::SpiNorFlash; +#else + #error "No target device specified!" +#endif + } +} diff --git a/src/port/infinitime.h b/src/port/infinitime.h deleted file mode 100644 index 7957039b..00000000 --- a/src/port/infinitime.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "drivers/Spi.h" -#include "drivers/SpiMaster.h" -#include "drivers/TwiMaster.h" -#include -#include - -#ifdef TARGET_DEVICE_PINETIME -#include -#include -#include -#include -#endif - -namespace Pinetime { - namespace Drivers { -#ifdef TARGET_DEVICE_PINETIME - using SpiMaster = Interface::SpiMaster; - using Spi = Interface::Spi; - using TwiMaster = Interface::TwiMaster; - using SpiNorFlash = Interface::SpiNorFlash; -#else - #error "No target device specified!" -#endif - } -} diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index 04d4699d..792442d0 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -28,6 +28,10 @@ Pinetime::Logging::NrfLogger logger; Pinetime::Logging::DummyLogger logger; #endif +#include "port/SpiMaster.h" +#include "port/SpiNorFlash.h" +#include "port/Spi.h" + static constexpr uint8_t displayWidth = 240; static constexpr uint8_t displayHeight = 240; static constexpr uint8_t bytesPerPixel = 2; @@ -52,7 +56,7 @@ Pinetime::Drivers::St7789 lcd {lcdSpi, Pinetime::PinMap::LcdDataCommand}; Pinetime::Drivers::Nrf52::Spi flashSpiImpl {spiImpl, Pinetime::PinMap::SpiFlashCsn}; Pinetime::Drivers::Spi flashSpi {flashSpiImpl}; -Pinetime::Drivers::SpiFlash::SpiNorFlash spiNorFlashImpl{flashSpiImpl}; +Pinetime::Drivers::SpiFlash::SpiNorFlash spiNorFlashImpl{flashSpi}; Pinetime::Drivers::SpiNorFlash spiNorFlash {spiNorFlashImpl}; Pinetime::Components::Gfx gfx {lcd}; diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 4b562786..313435d1 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -35,7 +35,7 @@ #include "drivers/Watchdog.h" #include "systemtask/Messages.h" -#include "port/infinitime.h" +#include "port/SpiMaster.h" extern std::chrono::time_point NoInit_BackUpTime; namespace Pinetime {