summaryrefslogtreecommitdiff
path: root/src/drivers/Spi.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-08-22 15:59:59 (GMT)
committerJF <jf@codingfield.com>2020-08-22 15:59:59 (GMT)
commitf7e40b1b5879242b4ce59854dbbadb44fe5f75e4 (patch)
treec90d927a985d1b13f48af1d6e9aeb6d4c0e7cc0f /src/drivers/Spi.cpp
parentecbbeb6283178696ae36891225e086d3154e8a8a (diff)
Re-implement sleep/wakeup for touch panel, display, NOR Flash, SPI and TWI.
Diffstat (limited to 'src/drivers/Spi.cpp')
-rw-r--r--src/drivers/Spi.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp
index bf08178..2d8aa3b 100644
--- a/src/drivers/Spi.cpp
+++ b/src/drivers/Spi.cpp
@@ -1,4 +1,5 @@
#include <hal/nrf_gpio.h>
+#include <nrfx_log.h>
#include "Spi.h"
using namespace Pinetime::Drivers;
@@ -18,8 +19,12 @@ bool Spi::Read(uint8_t* cmd, size_t cmdSize, uint8_t *data, size_t dataSize) {
}
void Spi::Sleep() {
- // TODO sleep spi
nrf_gpio_cfg_default(pinCsn);
+ NRF_LOG_INFO("[SPI] Sleep")
+}
+
+bool Spi::WriteCmdAndBuffer(const uint8_t *cmd, size_t cmdSize, const uint8_t *data, size_t dataSize) {
+ return spiMaster.WriteCmdAndBuffer(pinCsn, cmd, cmdSize, data, dataSize);
}
bool Spi::Init() {
@@ -27,8 +32,10 @@ bool Spi::Init() {
return true;
}
-bool Spi::WriteCmdAndBuffer(const uint8_t *cmd, size_t cmdSize, const uint8_t *data, size_t dataSize) {
- return spiMaster.WriteCmdAndBuffer(pinCsn, cmd, cmdSize, data, dataSize);
+void Spi::Wakeup() {
+ nrf_gpio_cfg_output(pinCsn);
+ nrf_gpio_pin_set(pinCsn);
+ NRF_LOG_INFO("[SPI] Wakeup")
}