diff options
| author | JF <jf@codingfield.com> | 2020-05-07 17:53:51 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-05-07 17:53:51 (GMT) |
| commit | 0b8e6c3fa20457bce931b1d289f187e46fc68307 (patch) | |
| tree | 5c2f7ba6c10e380eaa60c2ce15e65637535c8178 /src/drivers/SpiNorFlash.cpp | |
| parent | f96c048debc84bf2ccd10c4e7356e8e20df9bb3a (diff) | |
Add SPI NOR Flash driver, WIP.
Diffstat (limited to 'src/drivers/SpiNorFlash.cpp')
| -rw-r--r-- | src/drivers/SpiNorFlash.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp new file mode 100644 index 0000000..d19548e --- /dev/null +++ b/src/drivers/SpiNorFlash.cpp @@ -0,0 +1,36 @@ +#include <hal/nrf_gpio.h> +#include <libraries/delay/nrf_delay.h> +#include <libraries/log/nrf_log.h> +#include "SpiNorFlash.h" +#include "Spi.h" + +using namespace Pinetime::Drivers; + +SpiNorFlash::SpiNorFlash(Spi& spi) : spi{spi} { + +} + +void SpiNorFlash::Init() { + uint8_t cmd = 0x9F; + spi.Write(&cmd, 1); + + uint8_t data[3]; + data[0] = 0; + data[1] = 0; + data[2] = 0; + spi.Read(data, 3); + + NRF_LOG_INFO("Manufacturer : %d, Device : %d", data[0], (data[1] + (data[2]<<8))); +} + +void SpiNorFlash::Uninit() { + +} + +void SpiNorFlash::Sleep() { + +} + +void SpiNorFlash::Wakeup() { + +} |
