OV7670 + 23LC1024 + Bluetooth

Dependencies:   FastPWM MODSERIAL mbed

Committer:
sampullman
Date:
Tue Jul 23 06:36:50 2013 +0000
Revision:
2:a7f5fa80a385
Parent:
1:6e4d2cff76e8
Fixed OV7670.cpp file name

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sampullman 1:6e4d2cff76e8 1 #include "mbed.h"
sampullman 1:6e4d2cff76e8 2
sampullman 1:6e4d2cff76e8 3 #ifndef SPI_RAM_H
sampullman 1:6e4d2cff76e8 4 #define SPI_RAM_H
sampullman 1:6e4d2cff76e8 5
sampullman 1:6e4d2cff76e8 6 // Mode codes
sampullman 1:6e4d2cff76e8 7 #define BYTE_MODE 0x00
sampullman 1:6e4d2cff76e8 8 #define SEQUENTIAL_MODE 0x40
sampullman 1:6e4d2cff76e8 9
sampullman 1:6e4d2cff76e8 10 // Command codes
sampullman 1:6e4d2cff76e8 11 #define READ 0x03
sampullman 1:6e4d2cff76e8 12 #define WRITE 0x02
sampullman 1:6e4d2cff76e8 13 #define READ_STATUS 0x05
sampullman 1:6e4d2cff76e8 14 #define WRITE_STATUS 0x01
sampullman 1:6e4d2cff76e8 15
sampullman 1:6e4d2cff76e8 16 // Underlying SPI constants
sampullman 1:6e4d2cff76e8 17 #define TFE 0x02
sampullman 1:6e4d2cff76e8 18 #define TNF 0x02
sampullman 1:6e4d2cff76e8 19 #define RNE 0x04
sampullman 1:6e4d2cff76e8 20
sampullman 1:6e4d2cff76e8 21 class SRAM {
sampullman 1:6e4d2cff76e8 22 public:
sampullman 1:6e4d2cff76e8 23
sampullman 1:6e4d2cff76e8 24 SRAM(SPI& spiDef, PinName csiPin);
sampullman 1:6e4d2cff76e8 25
sampullman 1:6e4d2cff76e8 26 char readStatus();
sampullman 1:6e4d2cff76e8 27 void writeStatus(char status);
sampullman 1:6e4d2cff76e8 28 void startWriteSequence();
sampullman 1:6e4d2cff76e8 29 void startReadSequence();
sampullman 1:6e4d2cff76e8 30 void writeSequence0(char c);
sampullman 1:6e4d2cff76e8 31 void writeSequence1(char c);
sampullman 1:6e4d2cff76e8 32 char readSequence0();
sampullman 1:6e4d2cff76e8 33 char readSequence1();
sampullman 1:6e4d2cff76e8 34 void stopSequence();
sampullman 1:6e4d2cff76e8 35
sampullman 1:6e4d2cff76e8 36 private:
sampullman 1:6e4d2cff76e8 37 SPI& spi;
sampullman 1:6e4d2cff76e8 38 DigitalOut csi;
sampullman 1:6e4d2cff76e8 39 void prepareCommand(char command, int address);
sampullman 1:6e4d2cff76e8 40 void select();
sampullman 1:6e4d2cff76e8 41 void deselect();
sampullman 1:6e4d2cff76e8 42 };
sampullman 1:6e4d2cff76e8 43
sampullman 1:6e4d2cff76e8 44 #endif