Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
Initialization and configuration of the MT9F002 CMOS Chip. More...
Go to the source code of this file.
Data Structures | |
struct | mt9f002_t |
Macros | |
#define | MT9F002_OUTPUT_HEIGHT 822 |
#define | MT9F002_OUTPUT_WIDTH 1152 |
#define | MT9F002_INITIAL_OFFSET_X 0. |
#define | MT9F002_INITIAL_OFFSET_Y 0. |
#define | MT9F002_OUTPUT_SCALER 1. |
Our output is only OUTPUT_SCALER of the pixels we take of the sensor It is programmable in 1/16 steps determined by ScaleFactor = 16/scale_m. More... | |
#define | MT9F002_TARGET_EXPOSURE 30 |
Exposure of the front camera of the bebop. More... | |
#define | MT9F002_TARGET_FPS 15 |
#define | MT9F002_GAIN_GREEN1 3.0 |
#define | MT9F002_GAIN_GREEN2 3.0 |
#define | MT9F002_GAIN_RED 3.0 |
#define | MT9F002_GAIN_BLUE 4.0 |
#define | MT9F002_X_ODD_INC_VAL 1 |
#define | MT9F002_Y_ODD_INC_VAL 1 |
Enumerations | |
enum | mt9f002_interface { MT9F002_MIPI, MT9F002_HiSPi, MT9F002_PARALLEL } |
Functions | |
void | mt9f002_init (struct mt9f002_t *mt) |
Initialisation of the Aptina MT9F002 CMOS sensor (front camera) More... | |
void | mt9f002_set_resolution (struct mt9f002_t *mt) |
void | mt9f002_set_exposure (struct mt9f002_t *mt) |
Set the exposure configuration Depends on the blanking (and therefore the FPS) More... | |
void | mt9f002_set_gains (struct mt9f002_t *mt) |
Sets the GreenR, Blue, Red and GreenB gains. More... | |
Initialization and configuration of the MT9F002 CMOS Chip.
Definition in file mt9f002.h.
struct mt9f002_t |
Data Fields | ||
---|---|---|
uint16_t | frame_length | Calculated frame length of blanking. |
float | gain_blue | Gain for the Blue pixels [1.5 -> 63.50]. |
float | gain_green1 | Gain for the GreenR pixels [1.5 -> 63.50]. |
float | gain_green2 | Gain for the GreenB pixels [1.5 -> 63.50]. |
float | gain_red | Gain for the Red pixels [1.5 -> 63.50]. |
struct i2c_periph * | i2c_periph | I2C peripheral used to communicate over. |
struct i2c_transaction | i2c_trans | I2C transaction for comminication with CMOS chip. |
float | input_clk_freq | Input clock frequency. |
enum mt9f002_interface | interface | Interface used to connect. |
uint16_t | line_length | Calculated line length of blanking. |
float | offset_x | Offset from left in pixels. |
float | offset_y | Offset from top in pixels. |
float | op_pix_clk | Calculated based on PLL. |
uint16_t | op_pix_clk_div | Fixed PLL config from calculator tool. |
uint16_t | op_sys_clk_div | Fixed PLL config from calculator tool. |
uint16_t | output_height | Output height. |
float | output_scaler | Output scale. |
uint16_t | output_width | Output width. |
uint16_t | pll_multiplier | Fixed PLL config from calculator tool. |
uint16_t | pre_pll_clk_div | Fixed PLL config from calculator tool. |
float | real_exposure | Real exposure time in ms. |
float | real_fps | Real calculated FPS. |
uint8_t | row_speed_10_8 | Fixed PLL config from calculator tool. |
uint8_t | rowSpeed_2_0 | Fixed PLL config from calculator tool. |
uint16_t | scaled_height | Height after corrected scaling. |
uint16_t | scaled_width | Width after corrected scaling. |
uint8_t | shift_vt_pix_clk_div | Fixed PLL config from calculator tool. |
float | target_exposure | Target exposure time in ms. |
float | target_fps | FPS wanted. |
float | vt_pix_clk | Calculated based on PLL. |
uint16_t | vt_pix_clk_div | Fixed PLL config from calculator tool. |
uint16_t | vt_sys_clk_div | Fixed PLL config from calculator tool. |
uint8_t | x_odd_inc | X increment for subsampling (1,3,7,15,31 accepted) |
uint8_t | y_odd_inc | Y increment for subsampling (1,3,7 accepted) |
#define MT9F002_OUTPUT_SCALER 1. |
Our output is only OUTPUT_SCALER of the pixels we take of the sensor It is programmable in 1/16 steps determined by ScaleFactor = 16/scale_m.
Legal values for scale_m are 16 through 128, giving you the ability to scale from 1:1 to 1:8 (with m=128). Example: output_width = 512 output_height = 830 output_scaler = 0.25 We now get an image of 512 by 830 which contains a "compressed version" of what would normally be an image of 2048 by 3320 ISP (4608H x 2592V sensor)
#define MT9F002_TARGET_EXPOSURE 30 |
enum mt9f002_interface |
void mt9f002_init | ( | struct mt9f002_t * | mt | ) |
Initialisation of the Aptina MT9F002 CMOS sensor (front camera)
Definition at line 856 of file mt9f002.c.
References mt9f002_t::i2c_trans, I2CTransDone, mt9f002_t::interface, MT9F002_HiSPi, MT9F002_MIPI, mt9f002_mipi_stage1(), mt9f002_mipi_stage2(), mt9f002_mipi_stage3(), MT9F002_MODE_SELECT, mt9f002_parallel_stage1(), mt9f002_parallel_stage2(), mt9f002_set_blanking(), mt9f002_set_exposure(), mt9f002_set_gains(), mt9f002_set_pll(), mt9f002_set_resolution(), MT9F002_SOFTWARE_RESET, i2c_transaction::status, and write_reg().
Referenced by board_init2().
void mt9f002_set_exposure | ( | struct mt9f002_t * | mt | ) |
Set the exposure configuration Depends on the blanking (and therefore the FPS)
Definition at line 659 of file mt9f002.c.
References mt9f002_t::frame_length, mt9f002_t::line_length, MT9F002_COARSE_INTEGRATION_TIME, MT9F002_COARSE_INTEGRATION_TIME_MAX_MARGIN, MT9F002_COARSE_INTEGRATION_TIME_MIN, MT9F002_FINE_INTEGRATION_TIME_, MT9F002_FINE_INTEGRATION_TIME_MAX_MARGIN, MT9F002_FINE_INTEGRATION_TIME_MIN, read_reg(), mt9f002_t::real_exposure, mt9f002_t::target_exposure, mt9f002_t::vt_pix_clk, and write_reg().
Referenced by bebop_ae_awb_periodic(), and mt9f002_init().
void mt9f002_set_gains | ( | struct mt9f002_t * | mt | ) |
Sets the GreenR, Blue, Red and GreenB gains.
Definition at line 765 of file mt9f002.c.
References mt9f002_t::gain_blue, mt9f002_t::gain_green1, mt9f002_t::gain_green2, mt9f002_t::gain_red, MT9F002_BLUE_GAIN, mt9f002_calc_gain(), MT9F002_GREEN1_GAIN, MT9F002_GREEN2_GAIN, MT9F002_RED_GAIN, and write_reg().
Referenced by bebop_ae_awb_periodic(), and mt9f002_init().
void mt9f002_set_resolution | ( | struct mt9f002_t * | mt | ) |
Definition at line 773 of file mt9f002.c.
References BAYERSTATS_STATX, BAYERSTATS_STATY, avi_isp_statistics_yuv_regs::increments_log2, isp_config, MT9F002_MAX_HEIGHT, MT9F002_MAX_WIDTH, MT9F002_SCALE_M, MT9F002_SCALER_N, MT9F002_SCALING_MODE, MT9F002_X_ADDR_END, MT9F002_X_ADDR_START, MT9F002_X_OUTPUT_SIZE, MT9F002_Y_ADDR_END, MT9F002_Y_ADDR_START, MT9F002_Y_OUTPUT_SIZE, mt9f002_t::offset_x, mt9f002_t::offset_y, mt9f002_t::output_height, mt9f002_t::output_scaler, mt9f002_t::output_width, mt9f002_t::scaled_height, mt9f002_t::scaled_width, libisp_config::statistics_bayer, libisp_config::statistics_yuv, avi_isp_statistics_yuv_regs::window_pos_x, avi_isp_statistics_yuv_regs::window_pos_y, avi_isp_statistics_bayer_regs::window_x, avi_isp_statistics_bayer_regs::window_y, write_reg(), mt9f002_t::x_odd_inc, and mt9f002_t::y_odd_inc.
Referenced by mt9f002_init().