OV7670 + 23LC1024 + Bluetooth

Dependencies:   FastPWM MODSERIAL mbed

Revision:
1:6e4d2cff76e8
diff -r f309a2b2f27b -r 6e4d2cff76e8 spi_ram/spi_ram.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spi_ram/spi_ram.h	Tue Jul 23 06:33:27 2013 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+
+#ifndef  SPI_RAM_H
+#define  SPI_RAM_H
+
+// Mode codes
+#define BYTE_MODE       0x00
+#define SEQUENTIAL_MODE 0x40
+
+// Command codes
+#define READ            0x03
+#define WRITE           0x02
+#define READ_STATUS     0x05
+#define WRITE_STATUS    0x01
+
+// Underlying SPI constants
+#define TFE             0x02
+#define TNF             0x02
+#define RNE             0x04
+
+class SRAM {
+public:
+
+    SRAM(SPI& spiDef, PinName csiPin);
+
+    char readStatus();
+    void writeStatus(char status);
+    void startWriteSequence();
+    void startReadSequence();
+    void writeSequence0(char c);
+    void writeSequence1(char c);
+    char readSequence0();
+    char readSequence1();
+    void stopSequence();
+
+private:
+    SPI& spi;
+    DigitalOut csi;
+    void prepareCommand(char command, int address);
+    void select();
+    void deselect();
+};
+
+#endif
\ No newline at end of file