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:
- 25:8f6c2a094544
- Parent:
- 24:cc4271d1545f
- Child:
- 26:9a4e95fe0576
--- a/MARY_CAMERA.cpp Thu Mar 13 04:44:34 2014 +0000 +++ b/MARY_CAMERA.cpp Sat Mar 15 12:00:49 2014 +0000 @@ -148,6 +148,73 @@ close_transfer(); } + +void MARY_CAMERA::test0( int res ) +{ +#define OVERWRITE_PARAM_NUM 12 + const char over_write_param[ 5 ][ OVERWRITE_PARAM_NUM ] = { + { 0x17, 0x18, 0x32, 0x19, 0x1a, 0x03, 0x0c, 0x3e, 0x71, 0x72, 0x73, 0xa2 }, // register addr + { 0x39, 0x03, 0x80, 0x03, 0x7b, 0x02, 0x0c, 0x11, 0x35, 0x11, 0xf1, 0x52 }, // QSIF + { 0x13, 0x01, 0xb6, 0x02, 0x7a, 0x0a, 0x00, 0x00, 0x35, 0x11, 0xf0, 0x02 }, // VGA + { 0x16, 0x04, 0x80, 0x02, 0x7a, 0x0a, 0x04, 0x19, 0x35, 0x11, 0xf1, 0x02 }, // QVGA + { 0x16, 0x04, 0xa4, 0x02, 0x7a, 0x0a, 0x04, 0x1A, 0x35, 0x22, 0xf2, 0x02 }, // QQVGA + }; + char d[ 2 ]; + + switch ( res ) { + case QCIF: + _horizontal_size = QCIF_PIXEL_PER_LINE; + _vertical_size = QCIF_LINE_PER_FRAME; + break; + case VGA: + _horizontal_size = VGA_PIXEL_PER_LINE; + _vertical_size = VGA_LINE_PER_FRAME; + break; + case QVGA: + _horizontal_size = VGA_PIXEL_PER_LINE / 2; + _vertical_size = VGA_LINE_PER_FRAME / 2; + break; + case QQVGA: + _horizontal_size = VGA_PIXEL_PER_LINE / 4; + _vertical_size = VGA_LINE_PER_FRAME / 4; + break; + } + + // set camera registers + + for ( int i = 0; i < OVERWRITE_PARAM_NUM; i++ ) { + d[ 0 ] = over_write_param[ 0 ][ i ]; + d[ 1 ] = over_write_param[ res ][ i ]; + + if ( 0 != (_error_state = _i2c.write( CAM_I2C_ADDR, d, 2 )) ) + break; + + wait_ms( 20 ); // camera register writing requires this interval + } + + if ( res == 1 ) { + d[ 0 ] = 0x3E; + d[ 1 ] = 0x1A; + + if ( 0 != (_error_state = _i2c.write( CAM_I2C_ADDR, d, 2 )) ) + return; + + wait_ms( 20 ); // camera register writing requires this interval + + d[ 0 ] = 0x3E; + d[ 1 ] = 0x11; + + if ( 0 != (_error_state = _i2c.write( CAM_I2C_ADDR, d, 2 )) ) + return; + + wait_ms( 20 ); // camera register writing requires this interval + } +// wait 1 frame buffer update + open_transfer(); + close_transfer(); +} + + void MARY_CAMERA::colorbar( SwitchState sw ) { char s[ 2 ];