Microchip SPI SRAM (23LC1024, 23LC512) access library.
Diff: 23LCxx_SPI.cpp
- Revision:
- 1:56e01e806364
- Parent:
- 0:625ac56d810e
--- a/23LCxx_SPI.cpp Thu Nov 26 16:24:04 2015 +0000 +++ b/23LCxx_SPI.cpp Fri Nov 27 03:46:10 2015 +0000 @@ -2,21 +2,10 @@ #include <mbed.h> #include "23LCxx_SPI.h" -/** SPI COMMAND (Microchip 23LC1024, 23K256 SPI SRAM) */ -enum Microchip23LC1024Commnd { - READ = 0x03u, - WRITE = 0x02u, - EDIO = 0x3bu, - EQIO = 0x38u, - RSTIO = 0xffu, - RDMR = 0x05u, - WRMR = 0x01u, -}; - -Microchip23LCxx::Microchip23LCxx(PinName mosi, PinName miso, PinName sck, PinName cs, uint32_t hz) : _spi(mosi, miso, sck), _cs(cs) { +Microchip23LCxx::Microchip23LCxx(const PinName mosi, const PinName miso, const PinName sck, const PinName cs, const uint32_t hz): +_spi(mosi, miso, sck), _cs(cs, 1) { _spi.format(8, 0); // 8bit, mode=0 - _spi.frequency(hz); // max 20MHz (20*1000*1000) in 23LC1024. - _cs = 1; + _spi.frequency(hz); } uint8_t