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:
- 9:68408189efde
- Parent:
- 7:380026dd09fd
- Child:
- 10:3c8fc9569377
- Child:
- 13:52f7b692e00d
--- a/main.cpp Mon Feb 17 06:24:42 2014 +0000 +++ b/main.cpp Mon Feb 17 23:44:53 2014 +0000 @@ -2,13 +2,14 @@ #include "MARMEX_OB_oled.h" #include "MARY_CAMERA.h" - 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 +BusOut led( LED3, LED4 ); -BusOut led( LED3, LED4 ); -#define X_OFFSET 24 -#define Y_OFFSET 8 +#define X_OFFSET ((MARY_CAMERA::PIXEL_PER_LINE - MARMEX_OB_oled::WIDTH ) / 2) +#define Y_OFFSET ((MARY_CAMERA::LINE_PER_FRAME - MARMEX_OB_oled::HEIGHT) / 2) + +void line_mirroring( short *buf ); int main() { @@ -16,7 +17,7 @@ oled1.cls(); - short buf[ 128 ]; + short buf[ MARMEX_OB_oled::WIDTH ]; while ( 1 ) { @@ -25,6 +26,7 @@ for ( int line = 0; line < 128; line++ ) { camera.transfer_a_line( buf, line + Y_OFFSET, X_OFFSET, 128 ); + line_mirroring( buf ); oled1.blit565( 0, line, 128, 1, buf ); } @@ -33,3 +35,14 @@ } } + +void line_mirroring( short *buf ) +{ + short tmp; + + for ( int i = 0; i < (MARMEX_OB_oled::WIDTH / 2); i++ ) { + tmp = buf[ i ]; + buf[ i ] = buf[ (MARMEX_OB_oled::WIDTH - 1) - i ]; + buf[ (MARMEX_OB_oled::WIDTH - 1) - i ] = tmp; + } +} \ No newline at end of file