mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2026-05-05 20:26:39 +02:00
Split port/infinitime.h into multiple files.
SpiNorFlash : use the generic SPI driver instead of the NRF52 one.
This commit is contained in:
parent
2094dbdab3
commit
7d42c99e4d
@ -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
|
||||
|
||||
@ -9,8 +9,7 @@
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
#include "drivers/SpiNorFlash.h"
|
||||
#include "port/infinitime.h"
|
||||
#include "port/SpiNorFlash.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace System {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include "drivers/SpiNorFlash.h"
|
||||
#include "port/infinitime.h"
|
||||
#include "port/SpiNorFlash.h"
|
||||
#include <littlefs/lfs.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "drivers/TwiMaster.h"
|
||||
#include "port/infinitime.h"
|
||||
#include "port/TwiMaster.h"
|
||||
#include <drivers/Bma421_C/bma4_defs.h>
|
||||
|
||||
namespace Pinetime {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "drivers/TwiMaster.h"
|
||||
#include "port/infinitime.h"
|
||||
#include "port/TwiMaster.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include "drivers/Spi.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include "port/infinitime.h"
|
||||
#include "port/Spi.h"
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "drivers/nrf52/Spi.h"
|
||||
#include "drivers/Spi.h"
|
||||
#include "port/Spi.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
16
src/port/Spi.h
Normal file
16
src/port/Spi.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "drivers/Spi.h"
|
||||
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
#include <drivers/nrf52/Spi.h>
|
||||
#endif
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
using Spi = Interface::Spi<Pinetime::Drivers::Nrf52::Spi>;
|
||||
#else
|
||||
#error "No target device specified!"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
16
src/port/SpiMaster.h
Normal file
16
src/port/SpiMaster.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "drivers/SpiMaster.h"
|
||||
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
#include <drivers/nrf52/SpiMaster.h>
|
||||
#endif
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
using SpiMaster = Interface::SpiMaster<Pinetime::Drivers::Nrf52::SpiMaster>;
|
||||
#else
|
||||
#error "No target device specified!"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
16
src/port/SpiNorFlash.h
Normal file
16
src/port/SpiNorFlash.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "drivers/SpiNorFlash.h"
|
||||
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
#include <drivers/spiFlash/SpiNorFlash.h>
|
||||
#endif
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
using SpiNorFlash = Interface::SpiNorFlash<Pinetime::Drivers::SpiFlash::SpiNorFlash>;
|
||||
#else
|
||||
#error "No target device specified!"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
#include "drivers/Spi.h"
|
||||
#include "drivers/SpiMaster.h"
|
||||
#include "drivers/TwiMaster.h"
|
||||
#include <cstdint>
|
||||
#include <drivers/SpiNorFlash.h>
|
||||
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
#include <drivers/nrf52/Spi.h>
|
||||
#include <drivers/nrf52/SpiMaster.h>
|
||||
#include <drivers/nrf52/TwiMaster.h>
|
||||
#include <drivers/spiFlash/SpiNorFlash.h>
|
||||
#endif
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
#ifdef TARGET_DEVICE_PINETIME
|
||||
using SpiMaster = Interface::SpiMaster<Pinetime::Drivers::Nrf52::SpiMaster>;
|
||||
using Spi = Interface::Spi<Pinetime::Drivers::Nrf52::Spi>;
|
||||
using TwiMaster = Interface::TwiMaster<Pinetime::Drivers::Nrf52::TwiMaster>;
|
||||
using SpiNorFlash = Interface::SpiNorFlash<Pinetime::Drivers::SpiFlash::SpiNorFlash>;
|
||||
#else
|
||||
#error "No target device specified!"
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -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};
|
||||
|
||||
@ -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<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime;
|
||||
namespace Pinetime {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user