Cypress F-RAM FM25W256 library
Dependents: Hello-FM25W256 Hello-FM25W256
FM25W256.h@0:5a552209903c, 2016-03-04 (annotated)
- Committer:
- MACRUM
- Date:
- Fri Mar 04 15:49:51 2016 +0000
- Revision:
- 0:5a552209903c
- Child:
- 1:bb2b1e4bfb6e
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:5a552209903c | 1 | #include "mbed.h" |
MACRUM | 0:5a552209903c | 2 | |
MACRUM | 0:5a552209903c | 3 | #ifndef __FM25W256_HEAD__ |
MACRUM | 0:5a552209903c | 4 | #define __FM25W256_HEAD__ |
MACRUM | 0:5a552209903c | 5 | |
MACRUM | 0:5a552209903c | 6 | #define CMD_WREN 0x06 |
MACRUM | 0:5a552209903c | 7 | #define CMD_WRDI 0x04 |
MACRUM | 0:5a552209903c | 8 | #define CMD_RDSR 0x05 |
MACRUM | 0:5a552209903c | 9 | #define CMD_WRSR 0x01 |
MACRUM | 0:5a552209903c | 10 | #define CMD_READ 0x03 |
MACRUM | 0:5a552209903c | 11 | #define CMD_WRITE 0x02 |
MACRUM | 0:5a552209903c | 12 | |
MACRUM | 0:5a552209903c | 13 | class FM25W256 { |
MACRUM | 0:5a552209903c | 14 | public: |
MACRUM | 0:5a552209903c | 15 | FM25W256(PinName mosi, PinName miso, PinName clk, PinName cs); |
MACRUM | 0:5a552209903c | 16 | FM25W256(SPI &spi, PinName cs); |
MACRUM | 0:5a552209903c | 17 | void write(uint16_t address, uint8_t data); |
MACRUM | 0:5a552209903c | 18 | void write(uint16_t address, uint8_t *data, uint16_t size); |
MACRUM | 0:5a552209903c | 19 | uint8_t read(uint16_t address); |
MACRUM | 0:5a552209903c | 20 | void read(uint16_t address, uint8_t *data, uint16_t size); |
MACRUM | 0:5a552209903c | 21 | |
MACRUM | 0:5a552209903c | 22 | protected: |
MACRUM | 0:5a552209903c | 23 | SPI _spi; |
MACRUM | 0:5a552209903c | 24 | DigitalOut _cs; |
MACRUM | 0:5a552209903c | 25 | }; |
MACRUM | 0:5a552209903c | 26 | |
MACRUM | 0:5a552209903c | 27 | #endif |