#include "../../gpio/gpio.h"
Go to the source code of this file.
Defines | |
| #define | PO3030K_FULL 1 |
| #define | PO3030K_DEVICE_ID 0x6E |
| #define | ARRAY_WIDTH 640 |
| #define | ARRAY_HEIGHT 480 |
| #define | GREY_SCALE_MODE 0 |
| #define | RGB_565_MODE 1 |
| #define | YUV_MODE 2 |
| #define | MODE_VGA 0x44 |
| #define | MODE_QVGA 0x11 |
| #define | MODE_QQVGA 0x33 |
| #define | SPEED_2 0x00 |
| #define | SPEED_2_3 0x10 |
| #define | SPEED_4 0x20 |
| #define | SPEED_8 0x30 |
| #define | SPEED_16 0x40 |
| #define | SPEED_32 0x50 |
| #define | SPEED_64 0x60 |
| #define | SPEED_128 0x70 |
Enumerations | |
| enum | po3030k_errors { PO3030K_ERROR_BASE = 0x0B00, PO3030K_INVALID_ZOOM, PO3030K_ARRAY_OUT_OF_BOUND, PO3030K_NONMULTIPLE_SIZE, PO3030K_UNKNOW_COLOR_MODE, PO3030K_INTERNAL_ERROR, PO3030K_NOMEM, PO3030K_IO_ERROR } |
| Errors po3030k can throw. | |
Functions | |
| void | po3030k_config_cam (unsigned int sensor_x1, unsigned int sensor_y1, unsigned int sensor_width, unsigned int sensor_height, unsigned int zoom_fact_width, unsigned int zoom_fact_height, int color_mode) |
| int | po3030k_get_bytes_per_pixel (int color_mode) |
| void | po3030k_init_cam (unsigned char *port, gpio cam_reset, int timer, int ic, int priority) |
| void | po3030k_write_cam_registers (void) |
| void | po3030k_launch_capture (char *buf) |
| int | po3030k_apply_timer_config (int pixel_row, int pixel_col, int bpp, int pbp, int bbl) |
| int | po3030k_is_img_ready (void) |
| int | po3030k_set_color_mode (int mode) |
| int | po3030k_set_sampling_mode (int mode) |
| int | po3030k_set_speed (int mode) |
| int | po3030k_set_wx (unsigned int start, unsigned int stop) |
| int | po3030k_set_wy (unsigned int start, unsigned int stop) |
| int | po3030k_set_vsync (unsigned int start, unsigned int stop, unsigned int col) |
| void | po3030k_read_cam_registers (void) |
| int | po3030k_set_register (unsigned char adr, unsigned char value) |
| int | po3030k_get_register (unsigned char adr, unsigned char *value) |
| void | po3030k_set_bias (unsigned char pixbias, unsigned char opbias) |
| void | po3030k_set_integr_time (unsigned long time) |
| void | po3030k_set_mirror (int vertical, int horizontal) |
| void | po3030k_set_adc_offset (unsigned char offset) |
| void | po3030k_set_sepia (int status) |
| void | po3030k_set_lens_gain (unsigned char red, unsigned char green, unsigned char blue) |
| void | po3030k_set_edge_prop (unsigned char gain, unsigned char tresh) |
| void | po3030k_set_gamma_coef (unsigned char array[12], char color) |
| void | po3030k_write_gamma_coef (void) |
| int | po3030k_sync_register_array (unsigned char start, unsigned char stop) |
| void | po3030k_set_color_matrix (unsigned char array[3 *3]) |
| void | po3030k_set_cb_cr_gain (unsigned char cg11c, unsigned char cg22c) |
| void | po3030k_set_brigh_contr (unsigned char bright, unsigned char contrast) |
| void | po3030k_set_sepia_tone (unsigned char cb, unsigned char cr) |
| void | po3030k_set_ww (unsigned char ww) |
| void | po3030k_set_awb_ae_tol (unsigned char awbm, unsigned char aem) |
| void | po3030k_set_ae_speed (unsigned char b, unsigned char d) |
| void | po3030k_set_exposure (long t) |
| void | po3030k_set_ref_exposure (unsigned char exp) |
| void | po3030k_set_max_min_exp (unsigned int min, unsigned int max) |
| void | po3030k_set_max_min_awb (unsigned char minb, unsigned char maxb, unsigned char minr, unsigned char maxr, unsigned char ratior, unsigned char ratiob) |
| int | po3030k_set_weight_win (unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2) |
| void | po3030k_set_awb_ae (int awb, int ae) |
| int | po3030k_set_color_gain (unsigned char global, unsigned char red, unsigned char green1, unsigned char green2, unsigned char blue) |
| void | po3030k_set_flicker_mode (int manual) |
| void | po3030k_set_flicker_detection (int hz50, int hz60) |
| int | po3030k_set_flicker_man_set (int hz50, int hz60, int fdm, int fk, int tol) |
| #define PO3030K_FULL 1 |
If you set this at 0, you save about 168 bytes of memory But you loose all advanced camera functions
| int po3030k_apply_timer_config | ( | int | pixel_row, | |
| int | pixel_col, | |||
| int | bpp, | |||
| int | pbp, | |||
| int | bbl | |||
| ) |
Modify the interrupt configuration
| pixel_row | The number of row to take | |
| pixel_col | The number of pixel to take each pixel_row | |
| bpp | The number of byte per pixel | |
| pbp | The number of pixel to ignore between each pixel | |
| bbl | The number of row to ignore between each line |
| void po3030k_config_cam | ( | unsigned int | sensor_x1, | |
| unsigned int | sensor_y1, | |||
| unsigned int | sensor_width, | |||
| unsigned int | sensor_height, | |||
| unsigned int | zoom_fact_width, | |||
| unsigned int | zoom_fact_height, | |||
| int | color_mode | |||
| ) |
This function setup the internal timing of the camera to match the zoom, color mode and interest area.
| sensor_x1 | The X coordinate of the window's corner | |
| sensor_y1 | The Y coordinate of the window's corner | |
| sensor_width | the Width of the interest area, in FULL sampling scale | |
| sensor_height | The Height of the insterest area, in FULL sampling scale | |
| zoom_fact_width | The subsampling to apply for the window's Width | |
| zoom_fact_height | The subsampling to apply for the window's Height | |
| color_mode | The color mode in which the camera should be configured |
| int po3030k_get_bytes_per_pixel | ( | int | color_mode | ) |
Return the number of bytes per pixel in the given color mode
| color_mode | The given color mode |
| int po3030k_get_register | ( | unsigned char | adr, | |
| unsigned char * | value | |||
| ) |
Get the register adr value
| adr | The address | |
| value | The pointer to the value to write to |
| void po3030k_init_cam | ( | unsigned char * | port, | |
| gpio | cam_reset, | |||
| int | timer, | |||
| int | ic, | |||
| int | priority | |||
| ) |
Initialize the camera, must be called before any other function
| int po3030k_is_img_ready | ( | void | ) |
Check if the current capture is finished
| void po3030k_launch_capture | ( | char * | buf | ) |
Launch a capture in the buf buffer
| buf | The buffer to write to |
| void po3030k_read_cam_registers | ( | void | ) |
Read the camera register
| void po3030k_set_adc_offset | ( | unsigned char | offset | ) |
Set the Analog to Digital Converter offset
| offset | The offset |
| void po3030k_set_ae_speed | ( | unsigned char | b, | |
| unsigned char | d | |||
| ) |
Set AE speed
| b | AE speed factor when exposure time is decreasing ( 4 lower bits only ) | |
| d | AE speed factor when exposure time is increasing ( 4 lower bits only ) |
| void po3030k_set_awb_ae | ( | int | awb, | |
| int | ae | |||
| ) |
Enable/Disable AWB and AE
| awb | 1 mean AWB enabled, 0 mean disabled | |
| ae | 1 mean AE enabled, 0 mean disabled |
| void po3030k_set_awb_ae_tol | ( | unsigned char | awbm, | |
| unsigned char | aem | |||
| ) |
Set AWB/AE tolerence margin
| awbm | AWV Margin ( 4 lower bits only ) | |
| aem | AW Margin ( 4 lower bits only ) |
| void po3030k_set_bias | ( | unsigned char | pixbias, | |
| unsigned char | opbias | |||
| ) |
Set the Pixel and amplificator bias Increasing the bias produce better image quality, but increase camera's power consumption
| pixbias | The pixel bias | |
| opbias | The Amplificator bias |
| void po3030k_set_brigh_contr | ( | unsigned char | bright, | |
| unsigned char | contrast | |||
| ) |
Set the Brightness & Contrast
| bright | The Brightness ( signed 1+7bits fixed point format ) | |
| contrast | The Contrast |
| void po3030k_set_cb_cr_gain | ( | unsigned char | cg11c, | |
| unsigned char | cg22c | |||
| ) |
Set The color gain ( Cb/Cr )
| cg11c | Cb gain ( Sign[7] | Integer[6:5] | fractional[4:0] ) | |
| cg22c | Cr gain ( Sign[7] | Integer[6:5] | fractional[4:0] ) |
| int po3030k_set_color_gain | ( | unsigned char | global, | |
| unsigned char | red, | |||
| unsigned char | green1, | |||
| unsigned char | green2, | |||
| unsigned char | blue | |||
| ) |
Set the gains of the camera
| global | The global gain | |
| red | The red pixel's gain (fixed point [2:6] format) | |
| green1 | The green pixel near read one gain ([2:6] format) | |
| green2 | The green pixel near blue one gain ([2:6] format) | |
| blue | The blue pixel's gain ([2:6] format) |
| int po3030k_set_color_mode | ( | int | mode | ) |
Set the camera color mode
| mode | The color mode |
| void po3030k_set_edge_prop | ( | unsigned char | gain, | |
| unsigned char | tresh | |||
| ) |
Set Edge properties
| gain | Edge gain & moire factor (fixed point [2:3] format) | |
| tresh | Edge Enhancement threshold |
| void po3030k_set_exposure | ( | long | t | ) |
Set exposure time
| t | Exposure time, LSB is in 1/64 line time |
| void po3030k_set_flicker_detection | ( | int | hz50, | |
| int | hz60 | |||
| ) |
Set the 50/60Hz flicker detection
| hz50 | Non-zero mean 50Hz flicker detection enabled (default disabled) | |
| hz60 | Non-zero mean 60Hz flicker detection enabled (default disabled) |
| int po3030k_set_flicker_man_set | ( | int | hz50, | |
| int | hz60, | |||
| int | fdm, | |||
| int | fk, | |||
| int | tol | |||
| ) |
Set the camera's manual flicker's detection setting
| hz50 | The Hz for the 50Hz detection | |
| hz60 | The Hz for the 60Hz detection | |
| fdm | Flicker duration mode | |
| fk | Flicker count step | |
| tol | Flicker tolerance |
| void po3030k_set_flicker_mode | ( | int | manual | ) |
Set flicker detection mode
| manual | Non-zero mean manual mode is enabled ( default automatic mode enabled ) |
| void po3030k_set_gamma_coef | ( | unsigned char | array[12], | |
| char | color | |||
| ) |
Set gamma coefficient
| array | Gamma coefficient array | |
| color | First two bytes : - 0b01 => Green
|
| void po3030k_set_integr_time | ( | unsigned long | time | ) |
Set the pixel intergration time This is counted in line-time interval. See dataseet p.25 for more information
| time | The integration time ( fixed point [14:6] format ) |
| void po3030k_set_lens_gain | ( | unsigned char | red, | |
| unsigned char | green, | |||
| unsigned char | blue | |||
| ) |
Set lens shading gain
| red | Lens gain for red pixel | |
| green | Lens gain for green pixel | |
| blue | Lens gain for blue pixel |
| void po3030k_set_max_min_awb | ( | unsigned char | minb, | |
| unsigned char | maxb, | |||
| unsigned char | minr, | |||
| unsigned char | maxr, | |||
| unsigned char | ratior, | |||
| unsigned char | ratiob | |||
| ) |
Set the minimum and maximum red and blue gain in AWB mode
| minb | The minimum blue gain | |
| maxb | The maximum blue gain | |
| minr | The minimum red gain | |
| maxr | The maximum red gain | |
| ratior | The red gain ratio | |
| ratiob | The blue gain ratio |
| void po3030k_set_max_min_exp | ( | unsigned int | max, | |
| unsigned int | min | |||
| ) |
Set the minimum and maximum exposure time in AE mode
| min | The minimum exposure time | |
| max | The maximum exposure time |
| void po3030k_set_mirror | ( | int | vertical, | |
| int | horizontal | |||
| ) |
Enable/Disable horizontal or vertical mirror
| vertical | Set to 1 when vertical mirror is enabled, 0 if disabled | |
| horizontal | Set to 1 when horizontal mirror is enabled, 0 if disabled |
| void po3030k_set_ref_exposure | ( | unsigned char | exp | ) |
Set the reference exposure. The average brightness which the AE should have
| exp | The target exposure level |
| int po3030k_set_register | ( | unsigned char | adr, | |
| unsigned char | value | |||
| ) |
Set the register adr to value value
| adr | The address | |
| value | The value |
| int po3030k_set_sampling_mode | ( | int | mode | ) |
Set the camera sampling mode
| mode | The given sampling mode |
| void po3030k_set_sepia | ( | int | status | ) |
Enable/Disable Sepia color
| status | Set status to 1 to enable, 0 to disable |
| void po3030k_set_sepia_tone | ( | unsigned char | cb, | |
| unsigned char | cr | |||
| ) |
Set The color tone at sepia color condition
| cb | Cb tone | |
| cr | Cr tone |
| int po3030k_set_speed | ( | int | mode | ) |
Set the camera speed
| mode | The given speed |
| int po3030k_set_vsync | ( | unsigned int | start, | |
| unsigned int | stop, | |||
| unsigned int | col | |||
| ) |
Set the camera window VSYNC coordinate
| start | The start row | |
| stop | The stop row | |
| col | The start/stop column |
| int po3030k_set_weight_win | ( | unsigned int | x1, | |
| unsigned int | x2, | |||
| unsigned int | y1, | |||
| unsigned int | y2 | |||
| ) |
Set the Weighting Window coordinate
| x1 | The X1 coordinate | |
| x2 | The X2 coordinate | |
| y1 | The Y1 coordinate | |
| y2 | The Y2 coordinate |
| void po3030k_set_ww | ( | unsigned char | ww | ) |
Set the Center weight (Back Light compensation) Control parameter
| ww | Center weight ( 4 lower bits only ) |
| int po3030k_set_wx | ( | unsigned int | start, | |
| unsigned int | stop | |||
| ) |
Set the camera window X coordinate
| start | The start column | |
| stop | The stop column |
| int po3030k_set_wy | ( | unsigned int | start, | |
| unsigned int | stop | |||
| ) |
Set the camera window Y coordinate
| start | The start row | |
| stop | The stop row |
| int po3030k_sync_register_array | ( | unsigned char | start, | |
| unsigned char | stop | |||
| ) |
Write every known register between address start and stop (inclusivly).
| start | The beginning address of the write | |
| stop | The last write address |
| void po3030k_write_cam_registers | ( | void | ) |
The Po3030k module keep in memory the state of each register the camera has. When you configure the camera, it only alter the internal register state, not the camera one. This function write the internal register state in the camera.
| void po3030k_write_gamma_coef | ( | void | ) |
This special function write directly the Gamma coefficient and Gamma color select into camera register.
1.5.1