Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
mt9v117.c File Reference
#include "std.h"
#include "mt9v117.h"
#include "mt9v117_regs.h"
#include "peripherals/video_device.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 "generated/airframe.h"
#include "boards/bebop.h"
+ Include dependency graph for mt9v117.c:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mt9v117_patch_t
 

Macros

#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

◆ mt9v117_patch_t

struct mt9v117_patch_t

Definition at line 190 of file mt9v117.c.

Data Fields
uint8_t * data
uint16_t len

Macro Definition Documentation

◆ MT9V117_PATCH_LINE_NUM

#define MT9V117_PATCH_LINE_NUM   13

Definition at line 87 of file mt9v117.c.

Function Documentation

◆ mt9v117_config()

static void mt9v117_config ( struct mt9v117_t mt)
inlinestatic

◆ mt9v117_init()

◆ mt9v117_write_patch()

◆ read_reg()

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 241 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:

◆ read_var()

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

Definition at line 265 of file mt9v117.c.

References mt9v117_patch_t::len, offset, and read_reg().

Referenced by mt9v117_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_reg()

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 214 of file mt9v117.c.

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

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:

◆ write_var()

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

Definition at line 258 of file mt9v117.c.

References mt9v117_patch_t::len, offset, val, and 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

◆ bottom_camera

struct video_config_t bottom_camera

Definition at line 49 of file mt9v117.c.

◆ mt9v117

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

Definition at line 81 of file mt9v117.c.

◆ mt9v117_patch_lines

const struct mt9v117_patch_t mt9v117_patch_lines[MT9V117_PATCH_LINE_NUM]
static
Initial value:

Definition at line 195 of file mt9v117.c.

Referenced by mt9v117_write_patch().

◆ patch_line1

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 88 of file mt9v117.c.

◆ patch_line10

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 160 of file mt9v117.c.

◆ patch_line11

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 168 of file mt9v117.c.

◆ patch_line12

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 176 of file mt9v117.c.

◆ patch_line13

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 184 of file mt9v117.c.

◆ patch_line2

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 96 of file mt9v117.c.

◆ patch_line3

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 104 of file mt9v117.c.

◆ patch_line4

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 112 of file mt9v117.c.

◆ patch_line5

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 120 of file mt9v117.c.

◆ patch_line6

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 128 of file mt9v117.c.

◆ patch_line7

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 136 of file mt9v117.c.

◆ patch_line8

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 144 of file mt9v117.c.

◆ patch_line9

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 152 of file mt9v117.c.

patch_line11
static uint8_t patch_line11[]
Definition: mt9v117.c:168
patch_line3
static uint8_t patch_line3[]
Definition: mt9v117.c:104
patch_line7
static uint8_t patch_line7[]
Definition: mt9v117.c:136
patch_line6
static uint8_t patch_line6[]
Definition: mt9v117.c:128
patch_line4
static uint8_t patch_line4[]
Definition: mt9v117.c:112
patch_line1
static uint8_t patch_line1[]
Definition: mt9v117.c:88
patch_line10
static uint8_t patch_line10[]
Definition: mt9v117.c:160
patch_line9
static uint8_t patch_line9[]
Definition: mt9v117.c:152
patch_line8
static uint8_t patch_line8[]
Definition: mt9v117.c:144
patch_line2
static uint8_t patch_line2[]
Definition: mt9v117.c:96
patch_line12
static uint8_t patch_line12[]
Definition: mt9v117.c:176
patch_line13
static uint8_t patch_line13[]
Definition: mt9v117.c:184
patch_line5
static uint8_t patch_line5[]
Definition: mt9v117.c:120