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.
Dependencies: MARY_CAMERA NokiaLCD mbed
Diff: main.cpp
- Revision:
- 26:4e4f954a2e2a
- Parent:
- 25:185159c780d6
- Child:
- 27:625e40d60c7b
--- a/main.cpp Tue Mar 11 09:44:12 2014 +0000 +++ b/main.cpp Wed Mar 12 00:47:00 2014 +0000 @@ -3,27 +3,26 @@ #include "MARY_CAMERA.h" #if defined( TARGET_MBED_LPC1768 ) || defined( TARGET_LPC11U24_401 ) || defined( TARGET_LPC11XX ) - MARMEX_OB_oled oled1( p5, p7, p20, p16, p15 ); // mosi, sclk, cs, rst, power_control -- maple-mini-type-b-slot1 MARY_CAMERA camera( p5, p6, p7, p22, p26, p28, p27 ); // mosi, miso, sclk, cs, reset, I2C_SDA, I2C_SCL - #endif #if defined( TARGET_LPC11U35_401 ) - MARMEX_OB_oled oled1( P0_9, P0_10, P0_16, P0_12, P0_11 ); // mosi, sclk, cs, rst, power_control -- maple-mini-type-b-slot1 MARY_CAMERA camera( P0_9, P0_8, P0_10, P0_2, P1_15, P0_5, P0_4 ); // mosi, miso, sclk, cs, reset, I2C_SDA, I2C_SCL - #endif BusOut led( LED4, LED3, LED2, LED1 ); +void test_camera_QCIF_video_with_colorbar( void ); +void test_camera_resolution_change( void ); + void copy_image_to_oled( void ); void line_mirroring( short *buf ); void save_still_image( char *file_name ); void oled_test_screen( void ); -#define SIZES_OF_STILL_PICTURE +//#define SAVE_EACH_SIZES_OF_STILL_IMAGE int main() { @@ -34,37 +33,62 @@ #if defined( TARGET_MBED_LPC1768 ) -#ifdef SIZES_OF_STILL_PICTURE +#ifdef SAVE_EACH_SIZES_OF_STILL_IMAGE led = 0x1; - camera.init( MARY_CAMERA::QCIF ); + camera.resolution( MARY_CAMERA::QCIF ); save_still_image( "i_qcif.bmp" ); led = 0x2; - camera.init( MARY_CAMERA::QQVGA ); + camera.resolution( MARY_CAMERA::QQVGA ); save_still_image( "i_qqvga.bmp" ); led = 0x4; - camera.init( MARY_CAMERA::QVGA ); + camera.resolution( MARY_CAMERA::QVGA ); save_still_image( "i_qvga.bmp" ); led = 0x8; - camera.init( MARY_CAMERA::VGA ); + camera.resolution( MARY_CAMERA::VGA ); save_still_image( "i_vga.bmp" ); - camera.init( MARY_CAMERA::QCIF ); + camera.resolution( MARY_CAMERA::QCIF ); #endif #endif +// test_camera_QCIF_video_with_colorbar(); // doesn't return + test_camera_resolution_change(); // doesn't return +} + + +void test_camera_QCIF_video_with_colorbar( void ) +{ int count = 0; while ( 1 ) { led = 0x1; copy_image_to_oled(); + camera.colorbar( ((count++ >> 2) & 0x1) ? MARY_CAMERA::ON : MARY_CAMERA::OFF ); + led = 0x2; + } +} - camera.colorbar( ((count++ >> 2) & 0x1) ? MARY_CAMERA::ON : MARY_CAMERA::OFF ); + +void test_camera_resolution_change( void ) +{ + int count = (3 << 3); + int setting; + + while ( 1 ) { - led = 0x2; + if ( !(count & 0x7) ) { + setting = (count >> 3) & 0x3; + camera.resolution( (MARY_CAMERA::CameraResolution)(setting + 1) ); + led = 0x1 << setting; + } + + count++; + + copy_image_to_oled(); } } @@ -76,7 +100,7 @@ camera.open_transfer(); for ( int line = 0; line < MARMEX_OB_oled::HEIGHT; line++ ) { - camera.transfer_a_line( buf, line + (camera.vertical_size() - MARMEX_OB_oled::HEIGHT) / 2, (camera.horizontal_size() - MARMEX_OB_oled::WIDTH ) / 2, MARMEX_OB_oled::WIDTH ); + camera.transfer_a_line( buf, line + (camera.vertical_size() - (int)MARMEX_OB_oled::HEIGHT) / 2, (camera.horizontal_size() - (int)MARMEX_OB_oled::WIDTH ) / 2, MARMEX_OB_oled::WIDTH ); line_mirroring( buf ); oled1.blit565( 0, line, MARMEX_OB_oled::WIDTH, 1, buf ); }