Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MARY_CAMERA.h
- Committer:
- okano
- Date:
- 2014-02-17
- Revision:
- 2:ee71ffdf317e
- Parent:
- 0:f4584dba3bac
- Child:
- 3:e5752853eb26
File content as of revision 2:ee71ffdf317e:
#ifndef MBED_MARY_CAMERA #define MBED_MARY_CAMERA #define PIXEL_PER_LINE 176 #define BYTE_PER_PIXEL 2 #define BYTE_PER_LINE (PIXEL_PER_LINE * BYTE_PER_PIXEL) #define SPI_FREQUENCY 10000000 // sample MARY_CAMERA camera( p5, p6, p7, p22, p9, p26, p28, p27 ) class MARY_CAMERA { public: /** Create a MARY_CAMERA instance connected to specified SPI and DigitalOut pins with specified address * * @param I2C_sda I2C-bus SDA pin * @param I2C_scl I2C-bus SCL pin * @param steps_per_rotation motor specific setting. This determines how many steps are needed to execute one full turn of motor shaft (360°). * @param I2C_address I2C-bus address (default: 0x42) */ MARY_CAMERA( PinName spi_mosi, PinName spi_miso, PinName spi_sck, PinName spi_cs, PinName cam_reset, PinName i2c_sda, PinName i2c_scl ); void init( void ); void open_transfer( void ); void close_transfer( void ); void transfer_a_line( short *p, int line_number, int x_offset, int n_of_pixels ); private: int send_spi( char data ); void write_register( char reg, char value ); int read_register( char reg ); void set_address( int address ); void very_short_wait( void ); SPI spi; DigitalOut cs; DigitalOut reset; I2C i2c; }; #endif // MBED_MARY_CAMERA