#include "../../I2C/e_I2C_protocol.h"
#include "e_po3030k.h"
Defines | |
| #define | MCLK ((long) 14745600) |
| #define | MCLK_P_NS 0.067816840278 |
| #define | ARRAY_ORIGINE_X 210 |
| #define | ARRAY_ORIGINE_Y 7 |
| #define | BASE_D1 0 |
| #define | BASE_D2 0 |
| #define | BASE_D3 0 |
| #define | BASE_D4 0 |
| #define | DEVICE_ID 0xDC |
| #define | FRAME_WIDTH 0x0353 |
| #define | FRAME_HEIGTH 0x01e8 |
| #define | WINDOW_X1_BASE 9 |
| #define | WINDOW_Y1_BASE 13 |
| #define | WINDOW_X2_BASE 17 |
| #define | WINDOW_Y2_BASE 21 |
| #define | BIAS_BASE 25 |
| #define | COLGAIN_BASE 29 |
| #define | INTEGR_BASE 39 |
| #define | SPEED_ADDR (45 - BASE_D1) |
| #define | MIRROR_BASE 47 |
| #define | SAMPLING_ADDR ( 51 - BASE_D2 ) |
| #define | ADCOFF_BASE ( 53 - BASE_D2 ) |
| #define | FLICKM_BASE ( 55 - BASE_D2 ) |
| #define | FLICKP_BASE 59 |
| #define | COLOR_M_ADDR (67 - BASE_D3) |
| #define | MODE_R5G6B5 0x08 |
| #define | MODE_YUV 0x02 |
| #define | MODE_GRAYSCALE 0x0c |
| #define | SEPIA_BASE 69 |
| #define | LENSG_BASE 73 |
| #define | EDGE_BASE 79 |
| #define | GAMMA_BASE 83 |
| #define | COLOR_COEF_BASE 107 |
| #define | CBCRGAIN_BASE 125 |
| #define | BRICTR_BASE 129 |
| #define | SEPIATONE_BASE 133 |
| #define | VSYNCSTART_BASE (145 - BASE_D4) |
| #define | VSYNCSTOP_BASE (149 - BASE_D4) |
| #define | VSYNCCOL_BASE (153 - BASE_D4) |
| #define | WW_BASE 157 |
| #define | AWVAETOL_BASE 159 |
| #define | AESPEED_BASE 161 |
| #define | EXPOSURE_BASE 163 |
| #define | REFREPO_BASE 169 |
| #define | MINMAXEXP_BASE 175 |
| #define | MINMAXAWB_BASE 183 |
| #define | WEIGHWIN_BASE 195 |
| #define | AWBAEENABLE_BASE 211 |
| #define | GAMMASELCOL_BASE 215 |
| #define | NB_REGISTERS (sizeof(cam_reg)/(2*sizeof(cam_reg[0]))) |
Functions | |
| void | e_po3030k_write_cam_registers (void) |
| void | e_po3030k_read_cam_registers (void) |
| int | e_po3030k_set_color_mode (int mode) |
| int | e_po3030k_set_sampling_mode (int mode) |
| int | e_po3030k_set_speed (int mode) |
| int | e_po3030k_set_wx (unsigned int start, unsigned int stop) |
| int | e_po3030k_set_wy (unsigned int start, unsigned int stop) |
| int | e_po3030k_set_vsync (unsigned int start, unsigned int stop, unsigned int col) |
| void | e_po3030k_set_mirror (int vertical, int horizontal) |
| int | e_po3030k_set_register (unsigned char adr, unsigned char value) |
| int | e_po3030k_get_register (unsigned char adr, unsigned char *value) |
| void | e_po3030k_set_bias (unsigned char pixbias, unsigned char opbias) |
| int | e_po3030k_set_color_gain (unsigned char global, unsigned char red, unsigned char green1, unsigned char green2, unsigned char blue) |
| void | e_po3030k_set_integr_time (unsigned long time) |
| void | e_po3030k_set_adc_offset (unsigned char offset) |
| void | e_po3030k_set_sepia (int status) |
| void | e_po3030k_set_lens_gain (unsigned char red, unsigned char green, unsigned char blue) |
| void | e_po3030k_set_edge_prop (unsigned char gain, unsigned char tresh) |
| void | e_po3030k_set_gamma_coef (unsigned char array[12], char color) |
| void | e_po3030k_write_gamma_coef (void) |
| int | e_po3030k_sync_register_array (unsigned char start, unsigned char stop) |
| void | e_po3030k_SetColorMatrix (unsigned char array[3 *3]) |
| void | e_po3030k_set_cb_cr_gain (unsigned char cg11c, unsigned char cg22c) |
| void | e_po3030k_set_brigh_contr (unsigned char bright, unsigned char contrast) |
| void | e_po3030k_set_sepia_tone (unsigned char cb, unsigned char cr) |
| void | e_po3030k_set_ww (unsigned char ww) |
| void | e_po3030k_set_awb_ae_tol (unsigned char awbm, unsigned char aem) |
| void | e_po3030k_set_ae_speed (unsigned char b, unsigned char d) |
| void | e_po3030k_set_exposure (long t) |
| void | e_po3030k_set_ref_exposure (unsigned char exp) |
| void | e_po3030k_set_max_min_exp (unsigned int max, unsigned int min) |
| void | e_po3030k_set_max_min_awb (unsigned char minb, unsigned char maxb, unsigned char minr, unsigned char maxr, unsigned char ratior, unsigned char ratiob) |
| int | e_po3030k_set_weight_win (unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2) |
| void | e_po3030k_set_awb_ae (int awb, int ae) |
| void | e_po3030k_set_flicker_mode (int manual) |
| void | e_po3030k_set_flicker_detection (int hz50, int hz60) |
| static long | po3030k_get_pixelclock (void) |
| int | e_po3030k_set_flicker_man_set (int hz50, int hz60, int fdm, int fk, int tol) |
Variables | |
| static unsigned char | cam_reg [] |
| #define ADCOFF_BASE ( 53 - BASE_D2 ) |
| #define AESPEED_BASE 161 |
| #define ARRAY_ORIGINE_X 210 |
| #define ARRAY_ORIGINE_Y 7 |
| #define AWBAEENABLE_BASE 211 |
| #define AWVAETOL_BASE 159 |
| #define BASE_D1 0 |
| #define BASE_D2 0 |
| #define BASE_D3 0 |
| #define BASE_D4 0 |
| #define BIAS_BASE 25 |
| #define BRICTR_BASE 129 |
| #define CBCRGAIN_BASE 125 |
| #define COLGAIN_BASE 29 |
| #define COLOR_COEF_BASE 107 |
| #define COLOR_M_ADDR (67 - BASE_D3) |
| #define DEVICE_ID 0xDC |
| #define EDGE_BASE 79 |
| #define EXPOSURE_BASE 163 |
| #define FLICKM_BASE ( 55 - BASE_D2 ) |
| #define FLICKP_BASE 59 |
| #define FRAME_HEIGTH 0x01e8 |
| #define FRAME_WIDTH 0x0353 |
| #define GAMMA_BASE 83 |
| #define GAMMASELCOL_BASE 215 |
| #define INTEGR_BASE 39 |
| #define LENSG_BASE 73 |
| #define MCLK ((long) 14745600) |
| #define MCLK_P_NS 0.067816840278 |
| #define MINMAXAWB_BASE 183 |
| #define MINMAXEXP_BASE 175 |
| #define MIRROR_BASE 47 |
| #define MODE_GRAYSCALE 0x0c |
| #define MODE_R5G6B5 0x08 |
| #define MODE_YUV 0x02 |
| #define REFREPO_BASE 169 |
| #define SAMPLING_ADDR ( 51 - BASE_D2 ) |
| #define SEPIA_BASE 69 |
| #define SEPIATONE_BASE 133 |
| #define SPEED_ADDR (45 - BASE_D1) |
| #define VSYNCCOL_BASE (153 - BASE_D4) |
| #define VSYNCSTART_BASE (145 - BASE_D4) |
| #define VSYNCSTOP_BASE (149 - BASE_D4) |
| #define WEIGHWIN_BASE 195 |
| #define WINDOW_X1_BASE 9 |
| #define WINDOW_X2_BASE 17 |
| #define WINDOW_Y1_BASE 13 |
| #define WINDOW_Y2_BASE 21 |
| #define WW_BASE 157 |
| int e_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 e_po3030k_read_cam_registers | ( | void | ) |
Read the camera register
| void e_po3030k_set_adc_offset | ( | unsigned char | offset | ) |
Set the Analog to Digital Converter offset
| offset | The offset |
| void e_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 e_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 e_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 e_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 e_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 e_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 e_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 e_po3030k_set_color_mode | ( | int | mode | ) |
Set the camera color mode
| mode | The color mode |
| void e_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 e_po3030k_set_exposure | ( | long | t | ) |
Set exposure time
| t | Exposure time, LSB is in 1/64 line time |
| void e_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 e_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 e_po3030k_set_flicker_mode | ( | int | manual | ) |
Set flicker detection mode
| manual | Non-zero mean manual mode is enabled ( default automatic mode enabled ) |
| void e_po3030k_set_gamma_coef | ( | unsigned char | array[12], | |
| char | color | |||
| ) |
Set gamma coefficient
| array | Gamma coefficient array | |
| color | First two bytes : - 0b01 => Green
|
| void e_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 e_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 e_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 e_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 e_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 e_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 e_po3030k_set_register | ( | unsigned char | adr, | |
| unsigned char | value | |||
| ) |
Set the register adr to value value
| adr | The address | |
| value | The value |
| int e_po3030k_set_sampling_mode | ( | int | mode | ) |
Set the camera sampling mode
| mode | The given sampling mode |
| void e_po3030k_set_sepia | ( | int | status | ) |
Enable/Disable Sepia color
| status | Set status to 1 to enable, 0 to disable |
| void e_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 e_po3030k_set_speed | ( | int | mode | ) |
Set the camera speed
| mode | The given speed |
| int e_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 e_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 e_po3030k_set_ww | ( | unsigned char | ww | ) |
Set the Center weight (Back Light compensation) Control parameter
| ww | Center weight ( 4 lower bits only ) |
| int e_po3030k_set_wx | ( | unsigned int | start, | |
| unsigned int | stop | |||
| ) |
Set the camera window X coordinate
| start | The start column | |
| stop | The stop column |
| int e_po3030k_set_wy | ( | unsigned int | start, | |
| unsigned int | stop | |||
| ) |
Set the camera window Y coordinate
| start | The start row | |
| stop | The stop row |
| void e_po3030k_SetColorMatrix | ( | unsigned char | array[3 *3] | ) |
Set color correction coefficient
| array | Color coefficient matrix (3x3), sign[7] | integer [6:5] | fractional [4:0] |
| int e_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 e_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 e_po3030k_write_gamma_coef | ( | void | ) |
This special function write directly the Gamma coefficient and Gamma color select into camera register.
| static long po3030k_get_pixelclock | ( | void | ) | [static] |
unsigned char cam_reg[] [static] |
1.5.4