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.h
- Revision:
- 13:210f4bbd0cd6
- Parent:
- 11:61a025e8ab68
- Child:
- 17:756fb618c0ed
diff -r 614be3290c47 -r 210f4bbd0cd6 MARY_CAMERA.h --- a/MARY_CAMERA.h Mon Mar 10 01:41:23 2014 +0000 +++ b/MARY_CAMERA.h Tue Mar 11 03:25:00 2014 +0000 @@ -10,52 +10,57 @@ * * Example: * @code - * + * * #include "mbed.h" * #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 ); - * + * * #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) - * + * * int main() * { * led = 0x3; - * + * * oled1.cls(); - * + * * short buf[ MARMEX_OB_oled::WIDTH ]; - * + * * while ( 1 ) { - * + * * led = 0x1; * camera.open_transfer(); - * + * * for ( int line = 0; line < 128; line++ ) { * camera.transfer_a_line( buf, line + Y_OFFSET, X_OFFSET, 128 ); * oled1.blit565( 0, line, 128, 1, buf ); * } - * + * * camera.close_transfer(); * led = 0x2; * } * } * @endcode */ - - + + class MARY_CAMERA { public: /** General parameters for MARY_CAMERA */ enum { +#if 0 PIXEL_PER_LINE = 176, /**< pixels in a line */ LINE_PER_FRAME = 144, /**< pixels in a line */ +#else + PIXEL_PER_LINE = 640, /**< pixels in a line */ + LINE_PER_FRAME = 480, /**< pixels in a line */ +#endif BYTE_PER_PIXEL = 2, /**< bytes per pixel */ BYTE_PER_LINE = (PIXEL_PER_LINE * BYTE_PER_PIXEL) /**< data size of 1 line */ }; @@ -89,9 +94,9 @@ /** Initialization * * Performs MARY_CAMERA reset and initializations - * This function is called from MARY_CAMERA constoructor. So user don't have to call in the user code. + * This function is called from MARY_CAMERA constoructor. So user don't have to call in the user code. * - * This function takes about 2 seconds because there is 99 times I2C access with 20ms interval. + * This function takes about 2 seconds because there is 99 times I2C access with 20ms interval. */ int init( void ); @@ -100,7 +105,7 @@ * Returns last I2C access result * This returns non-zero value id the camera initialization failed * - * This function takes about 2 seconds because there is 99 times I2C access with 20ms interval. + * This function takes about 2 seconds because there is 99 times I2C access with 20ms interval. * * @return error code in init function (I2C API return value) */ @@ -108,8 +113,8 @@ /** Open transfer * - * Let the MARY_CAMERA get ready to transfer the data. - * When this function is called, the camera will stop updating buffer at end of frame. + * Let the MARY_CAMERA get ready to transfer the data. + * When this function is called, the camera will stop updating buffer at end of frame. * * @return error code in init function (I2C API return value) */ @@ -117,16 +122,16 @@ /** Close transfer * - * Letting the MARY_CAMERA to know the data transfer done. + * Letting the MARY_CAMERA to know the data transfer done. * This function should be called when the data transfer done to resume the buffer update by camera */ void close_transfer( void ); - + /** Transfer a line * * Reads 1 line data from MARY_CAMERA * This function should be called when the data transfer done to resume the buffer update by camera - * + * * @param *p pointer to array of short * @param line_number to select which line want to read * @param x_offset holizontal offset (from left) to start the read