Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mt9f002.h File Reference

Initialization and configuration of the MT9F002 CMOS Chip. More...

#include "std.h"
#include "mcu_periph/i2c.h"
#include "generated/airframe.h"
+ Include dependency graph for mt9f002.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mt9f002_t
 

Macros

#define CFG_SCALER_M_MIN   16
 
#define CFG_SCALER_M_MAX   128
 
#define CFG_MT9F002_WINDOW_WIDTH_MIN   1
 
#define CFG_MT9F002_WINDOW_HEIGHT_MIN   1
 
#define CFG_MT9F002_PIXEL_ARRAY_HEIGHT   3288
 
#define CFG_MT9F002_PIXEL_ARRAY_WIDTH   4608
 
#define CFG_MT9F002_X_ADDR_MIN   24
 
#define CFG_MT9F002_X_ADDR_MAX   4647
 
#define CFG_MT9F002_Y_ADDR_MIN   0
 
#define CFG_MT9F002_Y_ADDR_MAX   CFG_MT9F002_PIXEL_ARRAY_HEIGHT
 
#define RES_VGA   0
 
#define RES_720p   1
 
#define RES_720p_4_3   2
 
#define RES_1080p   3
 
#define RES_1080p_4_3   4
 
#define RES_FULL   5
 
#define MT9F002_OUTPUT_WIDTH   640
 
#define MT9F002_OUTPUT_HEIGHT   640
 
#define MT9F002_OFFSET_X   0.
 
#define MT9F002_OFFSET_Y   0.
 
#define MT9F002_ZOOM   1.
 
#define MT9F002_TARGET_FPS   30
 
#define MT9F002_FOCAL_X   (MT9F002_ZOOM * MT9F002_OUTPUT_WIDTH / 2.f)
 
#define MT9F002_FOCAL_Y   (MT9F002_ZOOM * MT9F002_OUTPUT_HEIGHT / 2.f)
 
#define MT9F002_CENTER_X   (MT9F002_OUTPUT_WIDTH * (.5f - MT9F002_ZOOM * MT9F002_OFFSET_X))
 
#define MT9F002_CENTER_Y   (MT9F002_OUTPUT_HEIGHT * (.5f - MT9F002_ZOOM * MT9F002_OFFSET_Y))
 
#define MT9F002_DHANE_K   1.25f
 

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_reset_exposure (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_reset_color (struct mt9f002_t *mt)
 
void mt9f002_set_gains (struct mt9f002_t *mt)
 Sets the GreenR, Blue, Red and GreenB gains. More...
 
void mt9f002_setting_update_resolution (float in)
 
void mt9f002_setting_update_color (float in)
 
void mt9f002_setting_update_exposure (float in)
 

Variables

struct mt9f002_t mt9f002
 
float mt9f002_send_resolution
 
float mt9f002_send_color
 
float mt9f002_send_exposure
 

Detailed Description

Initialization and configuration of the MT9F002 CMOS Chip.

Definition in file mt9f002.h.


Data Structure Documentation

struct mt9f002_t

Definition at line 133 of file mt9f002.h.

+ Collaboration diagram for mt9f002_t:
Data Fields
uint16_t frame_length Calculated frame length of blanking.
float gain_blue Gain for the Blue pixels [1., 63.50].
float gain_green1 Gain for the GreenR pixels [1., 63.50].
float gain_green2 Gain for the GreenB pixels [1., 63.50].
float gain_red Gain for the Red pixels [1., 63.50].
struct i2c_periph * i2c_periph I2C peripheral used to communicate over.
struct i2c_transaction i2c_trans I2C transaction for communication 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.
uint16_t offset_x Offset from left in pixels.
uint16_t 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.
uint16_t output_scaler Output scaler.
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.
uint16_t sensor_height
uint16_t sensor_width
float set_offset_x Signed fractional offset from centre of image of original sensor [-0.5,0.5].
float set_offset_y Signed fractional offset from centre of image of original sensor [-0.5,0.5].
float set_zoom Image zoom set point.
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,15,31 accepted)

Macro Definition Documentation

#define CFG_MT9F002_PIXEL_ARRAY_HEIGHT   3288

Definition at line 38 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_setting_update_resolution().

#define CFG_MT9F002_PIXEL_ARRAY_WIDTH   4608

Definition at line 39 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_setting_update_resolution().

#define CFG_MT9F002_WINDOW_HEIGHT_MIN   1

Definition at line 37 of file mt9f002.h.

Referenced by mt9f002_calc_resolution().

#define CFG_MT9F002_WINDOW_WIDTH_MIN   1

Definition at line 36 of file mt9f002.h.

Referenced by mt9f002_calc_resolution().

#define CFG_MT9F002_X_ADDR_MAX   4647

Definition at line 41 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_set_resolution().

#define CFG_MT9F002_X_ADDR_MIN   24

Definition at line 40 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_set_resolution().

#define CFG_MT9F002_Y_ADDR_MAX   CFG_MT9F002_PIXEL_ARRAY_HEIGHT

Definition at line 43 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_set_resolution().

#define CFG_MT9F002_Y_ADDR_MIN   0

Definition at line 42 of file mt9f002.h.

Referenced by mt9f002_calc_resolution(), and mt9f002_set_resolution().

#define CFG_SCALER_M_MAX   128

Definition at line 35 of file mt9f002.h.

Referenced by mt9f002_calc_resolution().

#define CFG_SCALER_M_MIN   16

Definition at line 34 of file mt9f002.h.

#define MT9F002_CENTER_X   (MT9F002_OUTPUT_WIDTH * (.5f - MT9F002_ZOOM * MT9F002_OFFSET_X))

Definition at line 116 of file mt9f002.h.

#define MT9F002_CENTER_Y   (MT9F002_OUTPUT_HEIGHT * (.5f - MT9F002_ZOOM * MT9F002_OFFSET_Y))

Definition at line 119 of file mt9f002.h.

#define MT9F002_DHANE_K   1.25f

Definition at line 122 of file mt9f002.h.

#define MT9F002_FOCAL_X   (MT9F002_ZOOM * MT9F002_OUTPUT_WIDTH / 2.f)

Definition at line 110 of file mt9f002.h.

#define MT9F002_FOCAL_Y   (MT9F002_ZOOM * MT9F002_OUTPUT_HEIGHT / 2.f)

Definition at line 113 of file mt9f002.h.

#define MT9F002_OFFSET_X   0.

Definition at line 91 of file mt9f002.h.

#define MT9F002_OFFSET_Y   0.

Definition at line 96 of file mt9f002.h.

#define MT9F002_OUTPUT_HEIGHT   640

Definition at line 85 of file mt9f002.h.

#define MT9F002_OUTPUT_WIDTH   640

Definition at line 82 of file mt9f002.h.

#define MT9F002_TARGET_FPS   30

Definition at line 105 of file mt9f002.h.

Referenced by init_gazebo().

#define MT9F002_ZOOM   1.

Definition at line 101 of file mt9f002.h.

#define RES_1080p   3

Definition at line 48 of file mt9f002.h.

#define RES_1080p_4_3   4

Definition at line 49 of file mt9f002.h.

#define RES_720p   1

Definition at line 46 of file mt9f002.h.

#define RES_720p_4_3   2

Definition at line 47 of file mt9f002.h.

#define RES_FULL   5

Definition at line 50 of file mt9f002.h.

#define RES_VGA   0

Definition at line 45 of file mt9f002.h.

Enumeration Type Documentation

Enumerator
MT9F002_MIPI 

MIPI type connection.

MT9F002_HiSPi 

HiSPi type connection.

MT9F002_PARALLEL 

Parallel type connection.

Definition at line 126 of file mt9f002.h.

Function Documentation

void mt9f002_reset_color ( struct mt9f002_t mt)

Definition at line 1093 of file mt9f002.c.

References mt9f002_t::gain_blue, mt9f002_t::gain_green1, mt9f002_t::gain_green2, mt9f002_t::gain_red, MT9F002_GAIN_BLUE, MT9F002_GAIN_GREEN1, MT9F002_GAIN_GREEN2, MT9F002_GAIN_RED, and mt9f002_set_gains().

Referenced by update_ae_awb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mt9f002_reset_exposure ( struct mt9f002_t mt)

Definition at line 1102 of file mt9f002.c.

References mt9f002_set_exposure(), MT9F002_TARGET_EXPOSURE, and mt9f002_t::target_exposure.

Referenced by update_ae_awb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mt9f002_set_gains ( struct mt9f002_t mt)

Sets the GreenR, Blue, Red and GreenB gains.

Definition at line 906 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 mt9f002_init(), mt9f002_reset_color(), mt9f002_setting_update_color(), and update_ae_awb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mt9f002_setting_update_color ( float  in)

Definition at line 1133 of file mt9f002.c.

References mt9f002_set_gains().

+ Here is the call graph for this function:

void mt9f002_setting_update_exposure ( float  in)

Definition at line 1138 of file mt9f002.c.

References mt9f002_set_exposure().

+ Here is the call graph for this function:

Variable Documentation

struct mt9f002_t mt9f002

Definition at line 123 of file mt9f002.c.

Referenced by update_ae_awb().

float mt9f002_send_color

Definition at line 193 of file mt9f002.h.

float mt9f002_send_exposure

Definition at line 194 of file mt9f002.h.

float mt9f002_send_resolution

Definition at line 192 of file mt9f002.h.