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:
- 8:23d14d5254d2
- Parent:
- 7:942d8d0a1760
- Child:
- 9:c1e24f1bec19
--- a/MARY_CAMERA.cpp Wed Mar 05 06:35:35 2014 +0000 +++ b/MARY_CAMERA.cpp Thu Mar 06 07:28:44 2014 +0000 @@ -43,24 +43,6 @@ #define CONTROL__RESUME_BUFFER_UPDATE 0x00 - - - - - - - - -DigitalIn ready( p25 ); -DigitalOut syncout( p21 ); - - - - - - - - MARY_CAMERA::MARY_CAMERA( PinName SPI_mosi, PinName SPI_miso, @@ -96,7 +78,7 @@ for ( int i = 0; i < PARAM_NUM; i++ ) { -#if 1 +#if 0 _i2c.start(); _i2c.write( CAM_I2C_ADDR ); _i2c.write( param[ 0 ][ i ] ); @@ -109,7 +91,8 @@ s[ 0 ] = param[ 0 ][ i ]; s[ 1 ] = param[ 1 ][ i ]; - _i2c.write( CAM_I2C_ADDR, s, 2 ); + if ( _error_state = _i2c.write( CAM_I2C_ADDR, s, 2 ) ) + break; #endif wait_ms( 20 ); @@ -119,6 +102,11 @@ _spi.frequency( SPI_FREQUENCY ); } +int MARY_CAMERA::ready( void ) +{ + return _error_state; +} + void MARY_CAMERA::transfer_a_line( short *p, int line_number, int x_offset, int n_of_pixels ) { set_address( line_number * BYTE_PER_LINE + x_offset * BYTE_PER_PIXEL ); @@ -148,14 +136,7 @@ read_register( STATUS_REGISTER ); -syncout = 0; -#ifdef USE_READY_SIGNAL - while ( !ready ); -#else - //while ( !(read_register( STATUS_REGISTER ) & 0x1) ); while ( 0x51 != read_register( STATUS_REGISTER ) ); -#endif -syncout = 1; } void MARY_CAMERA::close_transfer( void ) @@ -164,14 +145,7 @@ read_register( STATUS_REGISTER ); -#ifdef USE_READY_SIGNAL - while ( ready ); -#else -// while ( read_register( STATUS_REGISTER ) & 0x1 ); while ( 0x50 != read_register( STATUS_REGISTER ) ); - -#endif - }