Paparazzi UAS  v5.15_devel-46-gd23ed71
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mt9v117.c File Reference

Initialization of MT9V117 chip and options to change settings. More...

#include "std.h"
#include "mt9v117.h"
#include "mt9v117_regs.h"
#include "boards/bebop.h"
#include "generated/airframe.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/i2c-dev.h>
#include <linux/videodev2.h>
#include <linux/v4l2-mediabus.h>
+ Include dependency graph for mt9v117.c:

Go to the source code of this file.

Data Structures

struct  mt9v117_patch_t
 

Macros

#define MT9V117_TARGET_FPS   0
 
#define MT9V117_FOCAL_X   347.22f
 
#define MT9V117_FOCAL_Y   347.22f
 
#define MT9V117_CENTER_X   120.0f
 
#define MT9V117_CENTER_Y   120.0f
 
#define MT9V117_DHANE_K   1.0f
 
#define MT9V117_PATCH_LINE_NUM   13
 

Functions

static void write_reg (struct mt9v117_t *mt, uint16_t addr, uint32_t val, uint16_t len)
 Write multiple bytes to a single register. More...
 
static uint32_t read_reg (struct mt9v117_t *mt, uint16_t addr, uint16_t len)
 Read multiple bytes from a register. More...
 
static void write_var (struct mt9v117_t *mt, uint16_t var, uint16_t offset, uint32_t val, uint16_t len)
 
static uint32_t read_var (struct mt9v117_t *mt, uint16_t var, uint16_t offset, uint16_t len)
 
static void mt9v117_write_patch (struct mt9v117_t *mt)
 
static void mt9v117_config (struct mt9v117_t *mt)
 
void mt9v117_init (struct mt9v117_t *mt)
 Initialisation of the Aptina MT9V117 CMOS sensor (1/6 inch VGA, bottom camera) More...
 

Variables

struct video_config_t bottom_camera
 
struct mt9v117_t mt9v117
 
static uint8_t patch_line1 []
 
static uint8_t patch_line2 []
 
static uint8_t patch_line3 []
 
static uint8_t patch_line4 []
 
static uint8_t patch_line5 []
 
static uint8_t patch_line6 []
 
static uint8_t patch_line7 []
 
static uint8_t patch_line8 []
 
static uint8_t patch_line9 []
 
static uint8_t patch_line10 []
 
static uint8_t patch_line11 []
 
static uint8_t patch_line12 []
 
static uint8_t patch_line13 []
 
static const struct mt9v117_patch_t mt9v117_patch_lines [MT9V117_PATCH_LINE_NUM]
 

Detailed Description

Initialization of MT9V117 chip and options to change settings.

Definition in file mt9v117.c.


Data Structure Documentation

struct mt9v117_patch_t

Definition at line 204 of file mt9v117.c.

Data Fields
uint8_t * data
uint16_t len

Macro Definition Documentation

#define MT9V117_CENTER_X   120.0f

Definition at line 53 of file mt9v117.c.

#define MT9V117_CENTER_Y   120.0f

Definition at line 56 of file mt9v117.c.

#define MT9V117_DHANE_K   1.0f

Definition at line 59 of file mt9v117.c.

#define MT9V117_FOCAL_X   347.22f

Definition at line 47 of file mt9v117.c.

#define MT9V117_FOCAL_Y   347.22f

Definition at line 50 of file mt9v117.c.

#define MT9V117_PATCH_LINE_NUM   13

Definition at line 101 of file mt9v117.c.

Referenced by mt9v117_write_patch().

#define MT9V117_TARGET_FPS   0

Definition at line 42 of file mt9v117.c.

Function Documentation

static void mt9v117_config ( struct mt9v117_t mt)
inlinestatic
static uint32_t read_reg ( struct mt9v117_t mt,
uint16_t  addr,
uint16_t  len 
)
static

Read multiple bytes from a register.

Definition at line 255 of file mt9v117.c.

References i2c_transaction::buf, i2c_blocking_transceive(), mt9v117_t::i2c_periph, mt9v117_t::i2c_trans, mt9v117_patch_t::len, and MT9V117_ADDRESS.

Referenced by mt9v117_init(), mt9v117_write_patch(), and read_var().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint32_t read_var ( struct mt9v117_t mt,
uint16_t  var,
uint16_t  offset,
uint16_t  len 
)
static

Definition at line 279 of file mt9v117.c.

References read_reg().

Referenced by mt9v117_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void write_reg ( struct mt9v117_t mt,
uint16_t  addr,
uint32_t  val,
uint16_t  len 
)
static

Write multiple bytes to a single register.

Definition at line 228 of file mt9v117.c.

References i2c_transaction::buf, i2c_blocking_transmit(), mt9v117_t::i2c_periph, mt9v117_t::i2c_trans, and MT9V117_ADDRESS.

Referenced by mt9v117_config(), mt9v117_init(), mt9v117_write_patch(), and write_var().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void write_var ( struct mt9v117_t mt,
uint16_t  var,
uint16_t  offset,
uint32_t  val,
uint16_t  len 
)
static

Definition at line 272 of file mt9v117.c.

References write_reg().

Referenced by mt9v117_config(), mt9v117_init(), and mt9v117_write_patch().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct video_config_t bottom_camera

Definition at line 63 of file mt9v117.c.

struct mt9v117_t mt9v117
Initial value:
= {
.i2c_periph = &i2c0
}

Definition at line 95 of file mt9v117.c.

const struct mt9v117_patch_t mt9v117_patch_lines[MT9V117_PATCH_LINE_NUM]
static
Initial value:
= {
}
static uint8_t patch_line11[]
Definition: mt9v117.c:182
static uint8_t patch_line7[]
Definition: mt9v117.c:150
static uint8_t patch_line3[]
Definition: mt9v117.c:118
static uint8_t patch_line1[]
Definition: mt9v117.c:102
static uint8_t patch_line9[]
Definition: mt9v117.c:166
static uint8_t patch_line6[]
Definition: mt9v117.c:142
static uint8_t patch_line8[]
Definition: mt9v117.c:158
static uint8_t patch_line4[]
Definition: mt9v117.c:126
static uint8_t patch_line12[]
Definition: mt9v117.c:190
static uint8_t patch_line2[]
Definition: mt9v117.c:110
static uint8_t patch_line13[]
Definition: mt9v117.c:198
static uint8_t patch_line10[]
Definition: mt9v117.c:174
static uint8_t patch_line5[]
Definition: mt9v117.c:134

Definition at line 209 of file mt9v117.c.

uint8_t patch_line1[]
static
Initial value:
= {
0xf0, 0x00, 0x72, 0xcf, 0xff, 0x00, 0x3e, 0xd0, 0x92, 0x00,
0x71, 0xcf, 0xff, 0xff, 0xf2, 0x18, 0xb1, 0x10, 0x92, 0x05,
0xb1, 0x11, 0x92, 0x04, 0xb1, 0x12, 0x70, 0xcf, 0xff, 0x00,
0x30, 0xc0, 0x90, 0x00, 0x7f, 0xe0, 0xb1, 0x13, 0x70, 0xcf,
0xff, 0xff, 0xe7, 0x1c, 0x88, 0x36, 0x09, 0x0f, 0x00, 0xb3
}

Definition at line 102 of file mt9v117.c.

uint8_t patch_line10[]
static
Initial value:
= {
0xf1, 0xb0, 0x8d, 0x16, 0x76, 0xcf, 0xff, 0xff, 0xe5, 0x48,
0x8d, 0x37, 0x08, 0x0d, 0x00, 0x81, 0x96, 0x40, 0x09, 0x15,
0x00, 0x80, 0x0f, 0xd6, 0x01, 0x00, 0x8d, 0x16, 0xb7, 0x00,
0x8d, 0x17, 0xb6, 0x00, 0xff, 0xb0, 0xff, 0xbc, 0x00, 0x41,
0x03, 0xc0, 0xc0, 0xf1, 0x0d, 0x9e, 0x01, 0x00, 0xe8, 0x04
}

Definition at line 174 of file mt9v117.c.

uint8_t patch_line11[]
static
Initial value:
= {
0xf1, 0xe0, 0xff, 0x88, 0xf0, 0x0a, 0x0d, 0x6a, 0x01, 0x00,
0x0d, 0x8e, 0x01, 0x00, 0xe8, 0x7e, 0xff, 0x85, 0x0d, 0x72,
0x01, 0x00, 0xff, 0x8c, 0xff, 0xa7, 0xff, 0xb2, 0xd8, 0x00,
0x73, 0xcf, 0xff, 0xff, 0xf2, 0x40, 0x23, 0x15, 0x00, 0x01,
0x81, 0x41, 0xe0, 0x02, 0x81, 0x20, 0x08, 0xf7, 0x81, 0x34
}

Definition at line 182 of file mt9v117.c.

uint8_t patch_line12[]
static
Initial value:
= {
0xf2, 0x10, 0xa1, 0x40, 0xd8, 0x00, 0xc0, 0xd1, 0x7e, 0xe0,
0x53, 0x51, 0x30, 0x34, 0x20, 0x6f, 0x6e, 0x5f, 0x73, 0x74,
0x61, 0x72, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x69, 0x6e, 0x67, 0x20, 0x25, 0x64, 0x20, 0x25, 0x64, 0x0a,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

Definition at line 190 of file mt9v117.c.

uint8_t patch_line13[]
static
Initial value:
= {
0xf2, 0x40, 0xff, 0xff, 0xe8, 0x28, 0xff, 0xff, 0xf0, 0xe8,
0xff, 0xff, 0xe8, 0x08, 0xff, 0xff, 0xf1, 0x54
}

Definition at line 198 of file mt9v117.c.

uint8_t patch_line2[]
static
Initial value:
= {
0xf0, 0x30, 0x69, 0x13, 0xe1, 0x80, 0xd8, 0x08, 0x20, 0xca,
0x03, 0x22, 0x71, 0xcf, 0xff, 0xff, 0xe5, 0x68, 0x91, 0x35,
0x22, 0x0a, 0x1f, 0x80, 0xff, 0xff, 0xf2, 0x18, 0x29, 0x05,
0x00, 0x3e, 0x12, 0x22, 0x11, 0x01, 0x21, 0x04, 0x0f, 0x81,
0x00, 0x00, 0xff, 0xf0, 0x21, 0x8c, 0xf0, 0x10, 0x1a, 0x22
}

Definition at line 110 of file mt9v117.c.

uint8_t patch_line3[]
static
Initial value:
= {
0xf0, 0x60, 0x10, 0x44, 0x12, 0x20, 0x11, 0x02, 0xf7, 0x87,
0x22, 0x4f, 0x03, 0x83, 0x1a, 0x20, 0x10, 0xc4, 0xf0, 0x09,
0xba, 0xae, 0x7b, 0x50, 0x1a, 0x20, 0x10, 0x84, 0x21, 0x45,
0x01, 0xc1, 0x1a, 0x22, 0x10, 0x44, 0x70, 0xcf, 0xff, 0x00,
0x3e, 0xd0, 0xb0, 0x60, 0xb0, 0x25, 0x7e, 0xe0, 0x78, 0xe0
}

Definition at line 118 of file mt9v117.c.

uint8_t patch_line4[]
static
Initial value:
= {
0xf0, 0x90, 0x71, 0xcf, 0xff, 0xff, 0xf2, 0x18, 0x91, 0x12,
0x72, 0xcf, 0xff, 0xff, 0xe7, 0x1c, 0x8a, 0x57, 0x20, 0x04,
0x0f, 0x80, 0x00, 0x00, 0xff, 0xf0, 0xe2, 0x80, 0x20, 0xc5,
0x01, 0x61, 0x20, 0xc5, 0x03, 0x22, 0xb1, 0x12, 0x71, 0xcf,
0xff, 0x00, 0x3e, 0xd0, 0xb1, 0x04, 0x7e, 0xe0, 0x78, 0xe0
}

Definition at line 126 of file mt9v117.c.

uint8_t patch_line5[]
static
Initial value:
= {
0xf0, 0xc0, 0x70, 0xcf, 0xff, 0xff, 0xe7, 0x1c, 0x88, 0x57,
0x71, 0xcf, 0xff, 0xff, 0xf2, 0x18, 0x91, 0x13, 0xea, 0x84,
0xb8, 0xa9, 0x78, 0x10, 0xf0, 0x03, 0xb8, 0x89, 0xb8, 0x8c,
0xb1, 0x13, 0x71, 0xcf, 0xff, 0x00, 0x30, 0xc0, 0xb1, 0x00,
0x7e, 0xe0, 0xc0, 0xf1, 0x09, 0x1e, 0x03, 0xc0, 0xc1, 0xa1
}

Definition at line 134 of file mt9v117.c.

uint8_t patch_line6[]
static
Initial value:
= {
0xf0, 0xf0, 0x75, 0x08, 0x76, 0x28, 0x77, 0x48, 0xc2, 0x40,
0xd8, 0x20, 0x71, 0xcf, 0x00, 0x03, 0x20, 0x67, 0xda, 0x02,
0x08, 0xae, 0x03, 0xa0, 0x73, 0xc9, 0x0e, 0x25, 0x13, 0xc0,
0x0b, 0x5e, 0x01, 0x60, 0xd8, 0x06, 0xff, 0xbc, 0x0c, 0xce,
0x01, 0x00, 0xd8, 0x00, 0xb8, 0x9e, 0x0e, 0x5a, 0x03, 0x20
}

Definition at line 142 of file mt9v117.c.

uint8_t patch_line7[]
static
Initial value:
= {
0xf1, 0x20, 0xd9, 0x01, 0xd8, 0x00, 0xb8, 0x9e, 0x0e, 0xb6,
0x03, 0x20, 0xd9, 0x01, 0x8d, 0x14, 0x08, 0x17, 0x01, 0x91,
0x8d, 0x16, 0xe8, 0x07, 0x0b, 0x36, 0x01, 0x60, 0xd8, 0x07,
0x0b, 0x52, 0x01, 0x60, 0xd8, 0x11, 0x8d, 0x14, 0xe0, 0x87,
0xd8, 0x00, 0x20, 0xca, 0x02, 0x62, 0x00, 0xc9, 0x03, 0xe0
}

Definition at line 150 of file mt9v117.c.

uint8_t patch_line8[]
static
Initial value:
= {
0xf1, 0x50, 0xc0, 0xa1, 0x78, 0xe0, 0xc0, 0xf1, 0x08, 0xb2,
0x03, 0xc0, 0x76, 0xcf, 0xff, 0xff, 0xe5, 0x40, 0x75, 0xcf,
0xff, 0xff, 0xe5, 0x68, 0x95, 0x17, 0x96, 0x40, 0x77, 0xcf,
0xff, 0xff, 0xe5, 0x42, 0x95, 0x38, 0x0a, 0x0d, 0x00, 0x01,
0x97, 0x40, 0x0a, 0x11, 0x00, 0x40, 0x0b, 0x0a, 0x01, 0x00
}

Definition at line 158 of file mt9v117.c.

uint8_t patch_line9[]
static
Initial value:
= {
0xf1, 0x80, 0x95, 0x17, 0xb6, 0x00, 0x95, 0x18, 0xb7, 0x00,
0x76, 0xcf, 0xff, 0xff, 0xe5, 0x44, 0x96, 0x20, 0x95, 0x15,
0x08, 0x13, 0x00, 0x40, 0x0e, 0x1e, 0x01, 0x20, 0xd9, 0x00,
0x95, 0x15, 0xb6, 0x00, 0xff, 0xa1, 0x75, 0xcf, 0xff, 0xff,
0xe7, 0x1c, 0x77, 0xcf, 0xff, 0xff, 0xe5, 0x46, 0x97, 0x40
}

Definition at line 166 of file mt9v117.c.