aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/SpiMaster.h
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2020-01-26 15:44:26 +0100
committerGitHub <noreply@github.com>2020-01-26 15:44:26 +0100
commit7c03810f46ff1f7accd2f5adb7404b4f2cb723d9 (patch)
treef720612013c3518b54ecd22ccfc5aef6917d3023 /src/drivers/SpiMaster.h
parent9dc4e32e36eb1167ee241cdf8027089cad593cf1 (diff)
parent6491a7c3a0738d6e6ef3bf57da460f61298d1cd9 (diff)
Merge pull request #19 from JF002/spi-dma
Spi dma
Diffstat (limited to 'src/drivers/SpiMaster.h')
-rw-r--r--src/drivers/SpiMaster.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h
index 073501a8..60013242 100644
--- a/src/drivers/SpiMaster.h
+++ b/src/drivers/SpiMaster.h
@@ -2,7 +2,9 @@
#include <cstdint>
#include <cstddef>
#include <array>
+#include <atomic>
+#include "BufferProvider.h"
namespace Pinetime {
namespace Drivers {
class SpiMaster {
@@ -25,15 +27,26 @@ namespace Pinetime {
bool Init();
bool Write(const uint8_t* data, size_t size);
+ void OnStartedEvent(BufferProvider& provider);
+ void OnEndEvent(BufferProvider& provider);
+
void Sleep();
void Wakeup();
private:
- NRF_SPI_Type * spiBaseAddress;
+ void SetupWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel);
+ void DisableWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel);
+ void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size);
+
+ NRF_SPIM_Type * spiBaseAddress;
uint8_t pinCsn;
SpiMaster::SpiModule spi;
SpiMaster::Parameters params;
+
+ volatile bool busy = false;
+ volatile uint32_t currentBufferAddr = 0;
+ volatile size_t currentBufferSize = 0;
};
}
}