Cypress F-RAM FM25W256 library

Dependents:   Hello-FM25W256 Hello-FM25W256

Revision:
0:5a552209903c
Child:
1:bb2b1e4bfb6e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FM25W256.h	Fri Mar 04 15:49:51 2016 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+
+#ifndef __FM25W256_HEAD__
+#define __FM25W256_HEAD__
+
+#define CMD_WREN   0x06
+#define CMD_WRDI   0x04
+#define CMD_RDSR   0x05
+#define CMD_WRSR   0x01
+#define CMD_READ   0x03
+#define CMD_WRITE  0x02
+
+class FM25W256 {
+public:
+    FM25W256(PinName mosi, PinName miso, PinName clk, PinName cs);
+    FM25W256(SPI &spi, PinName cs);
+    void write(uint16_t address, uint8_t data);
+    void write(uint16_t address, uint8_t *data, uint16_t size);
+    uint8_t read(uint16_t address);
+    void read(uint16_t address, uint8_t *data, uint16_t size);
+
+protected:
+    SPI _spi;
+    DigitalOut _cs;
+};
+
+#endif