MARMEX-VB : "Mary Camera module" library

Dependents:   MARMEX_VB_test MARMEX_VB_Hello

Embed: (wiki syntax)

« Back to documentation index

MARMEX_VB Class Reference

MARMEX_VB Class Reference

MARMEX_VB Camera control library. More...

#include <MARMEX_VB.h>

Public Types

enum  CameraResolution { QCIF = 1, VGA, QVGA, QQVGA }
enum  SwitchState { OFF = 0, ON }
enum  {
  BYTE_PER_PIXEL = 2, QCIF_PIXEL_PER_LINE = 176, QCIF_LINE_PER_FRAME = 144, VGA_PIXEL_PER_LINE = 640,
  VGA_LINE_PER_FRAME = 480
}
 

General parameters for MARMEX_VB.

More...
enum  { NO_ERROR = 0 }
 

General parameters for MARMEX_OB_oled.

More...

Public Member Functions

 MARMEX_VB (PinName SPI_mosi, PinName SPI_miso, PinName SPI_sck, PinName SPI_cs, PinName cam_reset, PinName I2C_sda, PinName I2C_scl)
 Create a MARMEX_VB instance connected to specified SPI, DigitalOut and I2C pins.
int init (CameraResolution res=QCIF)
 Initialization.
void colorbar (SwitchState sw)
 Color bar ON/OFF.
int get_horizontal_size (void)
 Get holizontal size.
int get_vertical_size (void)
 Get vertical size.
int ready (void)
 Check camera availability.
void open_transfer (void)
 Open transfer.
void close_transfer (void)
 Close transfer.
void read_a_line (short *p, int line_number, int x_offset, int n_of_pixels)
 Read one line data.
int read_order_change (void)
 Read order change.

Detailed Description

MARMEX_VB Camera control library.

Version:
0.5
Date:
20-Jun-2014

Released under the Apache License, Version 2.0 : http://mbed.org/handbook/Apache-Licence

MARMEX_VB Camera control library for mbed

Version:
0.3
Date:
16-Jun-2014

Released under the Apache License, Version 2.0 : http://mbed.org/handbook/Apache-Licence

MARMEX_VB Camera control library for mbed

Definition at line 66 of file MARMEX_VB.h.


Member Enumeration Documentation

anonymous enum

General parameters for MARMEX_VB.

Enumerator:
BYTE_PER_PIXEL 

bytes per pixel

QCIF_PIXEL_PER_LINE 

pixels in a line (QCIF horizontal size)

QCIF_LINE_PER_FRAME 

lines in a frame (QCIF vertical size)

VGA_PIXEL_PER_LINE 

pixels in a line (VGA horizontal size)

VGA_LINE_PER_FRAME 

lines in a frame (VGA vertical size)

Definition at line 82 of file MARMEX_VB.h.

anonymous enum

General parameters for MARMEX_OB_oled.

Enumerator:
NO_ERROR 

zero

Definition at line 92 of file MARMEX_VB.h.

Enumerator:
QCIF 

QCIF.

VGA 

VGA.

QVGA 

QVGA.

QQVGA 

QQVGA.

Definition at line 69 of file MARMEX_VB.h.

Enumerator:
OFF 

ON.

ON 

OFF.

Definition at line 76 of file MARMEX_VB.h.


Constructor & Destructor Documentation

MARMEX_VB ( PinName  SPI_mosi,
PinName  SPI_miso,
PinName  SPI_sck,
PinName  SPI_cs,
PinName  cam_reset,
PinName  I2C_sda,
PinName  I2C_scl 
)

Create a MARMEX_VB instance connected to specified SPI, DigitalOut and I2C pins.

Parameters:
SPI_mosiSPI-bus MOSI pin
SPI_misoSPI-bus MISO pin
SPI_sclkSPI-bus SCLK pin
SPI_csSPI-bus Chip Select pin
cam_resetCamera reset pin
I2C_sdaI2C-bus SDA pin
I2C_sclI2C-bus SCL pin

Definition at line 62 of file MARMEX_VB.cpp.


Member Function Documentation

void close_transfer ( void   )

Close transfer.

Letting the MARMEX_VB to know the data transfer done. This function should be called when the data transfer done to resume the buffer update by camera

Definition at line 508 of file MARMEX_VB.cpp.

void colorbar ( SwitchState  sw )

Color bar ON/OFF.

Set colorbar ON/OFF

Parameters:
swturn-ON or -OFF colorbar : ON or OFF

Definition at line 247 of file MARMEX_VB.cpp.

int get_horizontal_size ( void   )

Get holizontal size.

Returns horizontal image size (pixels)

Returns:
holizontal size

Definition at line 257 of file MARMEX_VB.cpp.

int get_vertical_size ( void   )

Get vertical size.

Returns vertical image size (pixels)

Returns:
vertical size

Definition at line 262 of file MARMEX_VB.cpp.

int init ( CameraResolution  res = QCIF )

Initialization.

Performs MARMEX_VB reset and initializations This function is called from MARMEX_VB 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.

Parameters:
resselect camera resolution : QCIF(default), VGA, QVGA or QQVGA

Definition at line 102 of file MARMEX_VB.cpp.

void open_transfer ( void   )

Open transfer.

Let the MARMEX_VB get ready to transfer the data. When this function is called, the camera will stop updating buffer (on camera board) at end of frame.

Returns:
error code in init function (I2C API return value)

Definition at line 495 of file MARMEX_VB.cpp.

void read_a_line ( short *  p,
int  line_number,
int  x_offset,
int  n_of_pixels 
)

Read one line data.

Reads 1 line data from MARMEX_VB This function should be called when the data transfer done to resume the buffer update by camera

Parameters:
*ppointer to array of short
line_numberto select which line want to read
x_offsetholizontal offset (from left) to start the read
n_of_pixelspixels to be read

Definition at line 274 of file MARMEX_VB.cpp.

int read_order_change ( void   )

Read order change.

Toggles flag for read order of 2 byte data.

Returns:
new status of the read order flag (false = normal / true = swapped)

Definition at line 521 of file MARMEX_VB.cpp.

int ready ( void   )

Check camera availability.

Returns last I2C access result This returns non-zero value if the camera initialization failed

Returns:
error code in init function (I2C API return value)

Definition at line 267 of file MARMEX_VB.cpp.