From f7e40b1b5879242b4ce59854dbbadb44fe5f75e4 Mon Sep 17 00:00:00 2001 From: JF Date: Sat, 22 Aug 2020 17:59:59 +0200 Subject: Re-implement sleep/wakeup for touch panel, display, NOR Flash, SPI and TWI. --- src/drivers/Spi.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/drivers/Spi.cpp') diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp index bf08178d..2d8aa3b8 100644 --- a/src/drivers/Spi.cpp +++ b/src/drivers/Spi.cpp @@ -1,4 +1,5 @@ #include +#include #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") } -- cgit v1.2.3-70-g09d2