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.
Diff: MARY_CAMERA.cpp
- Revision:
- 10:82394d226c74
- Parent:
- 9:c1e24f1bec19
- Child:
- 11:61a025e8ab68
--- a/MARY_CAMERA.cpp Thu Mar 06 09:54:19 2014 +0000 +++ b/MARY_CAMERA.cpp Thu Mar 06 12:34:25 2014 +0000 @@ -78,12 +78,14 @@ for ( int i = 0; i < PARAM_NUM; i++ ) { -#if 0 +#if 1 _i2c.start(); _i2c.write( CAM_I2C_ADDR ); _i2c.write( param[ 0 ][ i ] ); _i2c.write( param[ 1 ][ i ] ); _i2c.stop(); + + _error_state = 0; #else char s[ 2 ]; @@ -110,15 +112,16 @@ void MARY_CAMERA::transfer_a_line( short *p, int line_number, int x_offset, int n_of_pixels ) { char tmp; - + set_address( line_number * BYTE_PER_LINE + x_offset * BYTE_PER_PIXEL ); read_register( CAMERA_DATA_REGISTER ); - - for( int x = 0; x < n_of_pixels; x++ ) - { +//wait_us( 1 ); + for( int x = 0; x < n_of_pixels; x++ ) { tmp = read_register( CAMERA_DATA_REGISTER ); +//wait_us( 1 ); *p++ = (read_register( CAMERA_DATA_REGISTER ) << 8) | tmp; +//wait_us( 1 ); } } @@ -161,13 +164,21 @@ write_register( MEMORY_ADDR_HIGH_REGISTER, (address >> 16) & 0xFF ); } +#define W_TIME 20 + int MARY_CAMERA::send_spi( char data ) { int tmp; + unsigned long msk; _cs = 0; +#ifdef W_TIME + wait_us( W_TIME ); +#endif tmp = _spi.write( data ); +#ifdef W_TIME + wait_us( W_TIME ); +#endif _cs = 1; - return ( tmp ); }