Paparazzi UAS  v5.12_stable-4-g9b43e9b
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 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 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...
 

Detailed Description

Initialization and configuration of the MT9F002 CMOS Chip.

Definition in file mt9f002.h.


Data Structure Documentation

struct mt9f002_t

Definition at line 114 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.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)

Macro Definition Documentation

#define MT9F002_GAIN_BLUE   4.0

Definition at line 92 of file mt9f002.h.

#define MT9F002_GAIN_GREEN1   3.0

Definition at line 80 of file mt9f002.h.

#define MT9F002_GAIN_GREEN2   3.0

Definition at line 84 of file mt9f002.h.

#define MT9F002_GAIN_RED   3.0

Definition at line 88 of file mt9f002.h.

#define MT9F002_INITIAL_OFFSET_X   0.

Definition at line 43 of file mt9f002.h.

#define MT9F002_INITIAL_OFFSET_Y   0.

Definition at line 47 of file mt9f002.h.

#define MT9F002_OUTPUT_HEIGHT   822

Definition at line 35 of file mt9f002.h.

#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)

Definition at line 62 of file mt9f002.h.

#define MT9F002_OUTPUT_WIDTH   1152

Definition at line 39 of file mt9f002.h.

#define MT9F002_TARGET_EXPOSURE   30

Exposure of the front camera of the bebop.

Experimental values: Outside: 15 Inside well lit: 30 Inside poorly lit: 60

Definition at line 71 of file mt9f002.h.

#define MT9F002_TARGET_FPS   15

Definition at line 75 of file mt9f002.h.

#define MT9F002_X_ODD_INC_VAL   1

Definition at line 98 of file mt9f002.h.

#define MT9F002_Y_ODD_INC_VAL   1

Definition at line 103 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 107 of file mt9f002.h.

Function Documentation

void mt9f002_init ( struct mt9f002_t mt)
void mt9f002_set_exposure ( struct mt9f002_t mt)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: