Tedd OKANO / MARY_CAMERA
Committer:
okano
Date:
Mon Feb 17 05:57:10 2014 +0000
Revision:
2:ee71ffdf317e
Parent:
0:f4584dba3bac
Child:
3:e5752853eb26
working but still having line noise

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 0:f4584dba3bac 1 #ifndef MBED_MARY_CAMERA
okano 0:f4584dba3bac 2 #define MBED_MARY_CAMERA
okano 0:f4584dba3bac 3
okano 0:f4584dba3bac 4 #define PIXEL_PER_LINE 176
okano 0:f4584dba3bac 5 #define BYTE_PER_PIXEL 2
okano 0:f4584dba3bac 6 #define BYTE_PER_LINE (PIXEL_PER_LINE * BYTE_PER_PIXEL)
okano 0:f4584dba3bac 7
okano 2:ee71ffdf317e 8 #define SPI_FREQUENCY 10000000
okano 0:f4584dba3bac 9
okano 0:f4584dba3bac 10 // sample MARY_CAMERA camera( p5, p6, p7, p22, p9, p26, p28, p27 )
okano 0:f4584dba3bac 11
okano 0:f4584dba3bac 12
okano 0:f4584dba3bac 13 class MARY_CAMERA
okano 0:f4584dba3bac 14 {
okano 0:f4584dba3bac 15 public:
okano 0:f4584dba3bac 16
okano 0:f4584dba3bac 17 /** Create a MARY_CAMERA instance connected to specified SPI and DigitalOut pins with specified address
okano 0:f4584dba3bac 18 *
okano 0:f4584dba3bac 19 * @param I2C_sda I2C-bus SDA pin
okano 0:f4584dba3bac 20 * @param I2C_scl I2C-bus SCL pin
okano 0:f4584dba3bac 21 * @param steps_per_rotation motor specific setting. This determines how many steps are needed to execute one full turn of motor shaft (360°).
okano 0:f4584dba3bac 22 * @param I2C_address I2C-bus address (default: 0x42)
okano 0:f4584dba3bac 23 */
okano 0:f4584dba3bac 24
okano 0:f4584dba3bac 25 MARY_CAMERA(
okano 0:f4584dba3bac 26 PinName spi_mosi,
okano 0:f4584dba3bac 27 PinName spi_miso,
okano 0:f4584dba3bac 28 PinName spi_sck,
okano 0:f4584dba3bac 29 PinName spi_cs,
okano 0:f4584dba3bac 30 PinName cam_reset,
okano 0:f4584dba3bac 31 PinName i2c_sda,
okano 0:f4584dba3bac 32 PinName i2c_scl
okano 0:f4584dba3bac 33 );
okano 0:f4584dba3bac 34 void init( void );
okano 0:f4584dba3bac 35 void open_transfer( void );
okano 0:f4584dba3bac 36 void close_transfer( void );
okano 0:f4584dba3bac 37 void transfer_a_line( short *p, int line_number, int x_offset, int n_of_pixels );
okano 0:f4584dba3bac 38
okano 0:f4584dba3bac 39 private:
okano 0:f4584dba3bac 40 int send_spi( char data );
okano 0:f4584dba3bac 41 void write_register( char reg, char value );
okano 0:f4584dba3bac 42 int read_register( char reg );
okano 0:f4584dba3bac 43 void set_address( int address );
okano 2:ee71ffdf317e 44 void very_short_wait( void );
okano 0:f4584dba3bac 45
okano 0:f4584dba3bac 46 SPI spi;
okano 0:f4584dba3bac 47 DigitalOut cs;
okano 0:f4584dba3bac 48 DigitalOut reset;
okano 0:f4584dba3bac 49 I2C i2c;
okano 0:f4584dba3bac 50 };
okano 0:f4584dba3bac 51
okano 0:f4584dba3bac 52
okano 0:f4584dba3bac 53
okano 0:f4584dba3bac 54 #endif // MBED_MARY_CAMERA