A "Hello" program for MARMEX_VB library. This application may work 40pin type mbed platforms ;) This application expects to have the MARMEX_VB module on a "MAPLE mini type-B (MARM03-BASE)" baseboard (slot2) with a MARMEX_OB module (on slot1)
Dependencies: MARMEX_VB NokiaLCD mbed
Sample code for MARMEX-VB (MARY-VB) camera module.
This is a very simple program just copies the data from camera to OELD.
main.cpp
- Committer:
- nxpfan
- Date:
- 2014-06-09
- Revision:
- 0:139f0c46d0fd
- Child:
- 2:7294334432d4
File content as of revision 0:139f0c46d0fd:
/** Hello program for MARMEX_VB Camera control library * * @version 0.1 * @date 10-Jun-2014 * * Released under the Apache License, Version 2.0 : http://mbed.org/handbook/Apache-Licence * * ** This program may run on 40pin type mbed platfoms ;) ** */ #include "mbed.h" #include "MARMEX_OB_oled.h" #include "MARMEX_VB.h" MARMEX_OB_oled oled1( p5, p7, p20, p16, p15 ); // mosi, sclk, cs, rst, power_control -- maple-mini-type-b-board-slot1 MARMEX_VB camera( p5, p6, p7, p22, p26, p28, p27 ); // mosi, miso, sclk, cs, reset, sda, scl -- maple-mini-type-b-board-slot2 BusOut led( LED3, LED4 ); // image size (default image size) #define CAMERA_WIDTH MARMEX_VB::QCIF_PIXEL_PER_LINE // 176 pixels(default size) #define CAMERA_HEIGHT MARMEX_VB::QCIF_LINE_PER_FRAME // 144 lines (default size) // screen size #define OLED_WIDTH MARMEX_OB_oled::WIDTH // 128 pixels #define OLED_HEIGHT MARMEX_OB_oled::HEIGHT // 128 lines // x/y offset to draw center image of the camera #define X_OFFSET ((CAMERA_WIDTH - OLED_WIDTH ) / 2) #define Y_OFFSET ((CAMERA_HEIGHT - OLED_HEIGHT) / 2) int main() { short buf[ OLED_WIDTH ]; led = 0x3; oled1.cls(); // clear OLED screen while ( 1 ) { led = 0x1; camera.open_transfer(); // pause updating the camera buffer // data transfer from camera to OLED (line by line copy) // for ( int line = 0; line < OLED_HEIGHT; line++ ) { // 1 line (128 pixels) data read from camera camera.read_a_line( buf, line + Y_OFFSET, X_OFFSET, OLED_WIDTH ); // 1 line (128 pixels) data write into OLED oled1.blit565( 0, line, OLED_WIDTH, 1, buf ); } led = 0x2; camera.close_transfer(); // resume updating the camera buffer } }