summaryrefslogtreecommitdiff
path: root/src/drivers/SpiMaster.h
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-01-22 21:08:53 +0100
committerJF <jf@codingfield.com>2020-01-22 21:08:53 +0100
commiteb7a1b3ac9cbacb74afb7fcd1d40c51a18c90060 (patch)
treea0f886e007080ce0f3867dd7deb87fecd22ab212 /src/drivers/SpiMaster.h
parentaa3e5c0c6f6f7bb9df02ae5d333dc6c4a6d2e744 (diff)
[WIP] Max SPI speed reached (119ms for a full refresh. Theo max : 240*240*16 = 115.2ms) using IRQ and DMA.
Code needs some cleaning before integration.
Diffstat (limited to 'src/drivers/SpiMaster.h')
-rw-r--r--src/drivers/SpiMaster.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h
index dff63e94..ee03186c 100644
--- a/src/drivers/SpiMaster.h
+++ b/src/drivers/SpiMaster.h
@@ -23,9 +23,9 @@ namespace Pinetime {
SpiMaster(const SpiModule spi, const Parameters& params);
bool Init();
- bool Write(const uint8_t* data, size_t size);
- bool WriteRepeat(const uint8_t *data, size_t size, int repeat);
+ bool Write(const uint8_t* data, size_t size, size_t r = 0);
void setup_workaround_for_ftpan_58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel);
+ void Wait();
void Sleep();
void Wakeup();
@@ -33,7 +33,8 @@ namespace Pinetime {
bool GetStatusEnd();
bool GetStatusStarted();
- void irq();
+ void irqEnd();
+ void irqStarted();
private:
NRF_SPIM_Type * spiBaseAddress;
@@ -42,11 +43,13 @@ namespace Pinetime {
SpiMaster::SpiModule spi;
SpiMaster::Parameters params;
- std::atomic<bool> busy {false};
+ volatile bool busy = false;
uint32_t bufferAddr = 0;
-
+ volatile uint32_t currentBufferAddr = 0;
size_t bufferSize = 0;
+ volatile size_t currentBufferSize = 0;
+ volatile uint32_t repeat = 0;
};
}
}