Low-level driver for the OV7740 CMOS image sensor.
This driver provides access to the main features of the OV7740 CMOS image sensor.
Functions | |
uint32_t | ov_configure (Twihs *const p_twi, const e_ov7740_format format) |
Configure the OV7740 sensor for a specified image size (pixel format). More... | |
uint32_t | ov_configure_finish (Twihs *const p_twi) |
Complete the OV7740 sensor configuration. More... | |
uint32_t | ov_configure_manual (Twihs *const p_twi) |
Configure the OV7740 sensor manually. More... | |
void | ov_dump_registers (Twihs *const p_twi, ov_reg *p_regs) |
Dump all registers. More... | |
static uint32_t | ov_id (Twihs *const p_twi) |
Read PID and VER. More... | |
uint32_t | ov_init (Twihs *const p_twi) |
Initialize the OV7740 sensor. More... | |
static uint32_t | ov_manufacturer (Twihs *const p_twi) |
Read Manufacturer. More... | |
void | ov_power (uint32_t ul_on_off, Pio *const p_pio, const uint32_t ul_mask) |
Turn OV7740 sensor on/off using power pin. More... | |
uint32_t | ov_read_reg (Twihs *const p_twi, twihs_packet_t *const p_packet) |
Read a value from a register in an OV7740 sensor device. More... | |
void | ov_reset (Pio *const p_pio, const uint32_t ul_mask) |
Reset OV7740 sensor using power pin. More... | |
uint32_t | ov_restore_manual (volatile uint32_t *p_backup_addr, uint32_t ul_size) |
Restore backup register manually. More... | |
static void | ov_retrieve_manual (Twihs *const p_twi) |
Retrieve register manually. More... | |
uint32_t | ov_store_manual (Twihs *const p_twi, volatile uint32_t *p_backup_addr, uint32_t ul_size) |
Store back up register manually. More... | |
static uint32_t | ov_test_write (Twihs *const p_twi) |
OV7740 test write. More... | |
uint32_t | ov_write_reg (Twihs *const p_twi, twihs_packet_t *const p_packet) |
Write a specified value to a register of the OV7740 sensor. More... | |
uint32_t | ov_write_regs (Twihs *const p_twi, const ov_reg *p_reg_list) |
Initialize a list of OV7740 registers. More... | |
Variables | |
static ov_reg | regs_manual [] |
Register array for manual operation (given by OmniVision toolkit). More... | |
uint32_t ov_configure | ( | Twihs *const | p_twi, |
const e_ov7740_format | format | ||
) |
Configure the OV7740 sensor for a specified image size (pixel format).
p_twi | TWI interface. |
format | Specific format to configure. |
References NULL, OV7740_QQVGA_RGB888, OV7740_QQVGA_YUV422, OV7740_QVGA_RGB888, OV7740_QVGA_YUV422_10FPS, OV7740_QVGA_YUV422_15FPS, OV7740_QVGA_YUV422_20FPS, OV7740_QVGA_YUV422_30FPS, OV7740_TEST_PATTERN, OV7740_VGA_YUV422_20FPS, ov_write_regs(), QQVGA_RGB888, QQVGA_YUV422, QVGA_RGB888, QVGA_YUV422_10FPS, QVGA_YUV422_15FPS, QVGA_YUV422_20FPS, QVGA_YUV422_30FPS, TEST_PATTERN, and VGA_YUV422_20FPS.
uint32_t ov_configure_finish | ( | Twihs *const | p_twi | ) |
Complete the OV7740 sensor configuration.
p_twi | TWI interface. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, OV_I2C_SENSOR_ADDRESS, and ov_write_reg().
uint32_t ov_configure_manual | ( | Twihs *const | p_twi | ) |
void ov_dump_registers | ( | Twihs *const | p_twi, |
ov_reg * | p_regs | ||
) |
Dump all registers.
p_twi | TWI interface. |
p_regs | Register list to be dumped. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, NULL, OV7740_YUV422CTRL, OV_I2C_SENSOR_ADDRESS, ov_read_reg(), _ov_reg::reg, and _ov_reg::val.
|
static |
Read PID and VER.
p_twi | TWI interface. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, OV7740_PIDH, OV7740_PIDL, OV_I2C_SENSOR_ADDRESS, and ov_read_reg().
Referenced by ov_init().
uint32_t ov_init | ( | Twihs *const | p_twi | ) |
Initialize the OV7740 sensor.
p_twi | TWI interface. |
References OV7740_PIDH_DEFAULT, ov_id(), ov_manufacturer(), and ov_test_write().
|
static |
Read Manufacturer.
p_twi | TWI interface. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, OV7740_MIDH, OV7740_MIDH_DEFAULT, OV7740_MIDL, OV7740_MIDL_DEFAULT, OV_I2C_SENSOR_ADDRESS, and ov_read_reg().
Referenced by ov_init().
void ov_power | ( | uint32_t | ul_on_off, |
Pio *const | p_pio, | ||
const uint32_t | ul_mask | ||
) |
Turn OV7740 sensor on/off using power pin.
on_off | 1 to turn on OV7740 sensor and 0 to turn off. |
p_pio | Pointer to the PIO instance which control OV7740 sensor power. |
ul_mask | Bitmask of OV7740 sensor power pin. |
References pio_clear(), and pio_set().
uint32_t ov_read_reg | ( | Twihs *const | p_twi, |
twihs_packet_t *const | p_packet | ||
) |
Read a value from a register in an OV7740 sensor device.
p_twi | TWI interface. |
p_packet | TWI packet. |
References twihs_master_read().
Referenced by ov_dump_registers(), ov_id(), ov_manufacturer(), ov_retrieve_manual(), and ov_test_write().
void ov_reset | ( | Pio *const | p_pio, |
const uint32_t | ul_mask | ||
) |
Reset OV7740 sensor using power pin.
p_pio | Pointer to the PIO instance which controls the OV7740 sensor power pin. |
ul_mask | Bitmask of the OV7740 sensor power pin. |
References delay_ms, pio_clear(), and pio_set().
uint32_t ov_restore_manual | ( | volatile uint32_t * | p_backup_addr, |
uint32_t | ul_size | ||
) |
Restore backup register manually.
p_backup_addr | Backup register address. |
|
static |
Retrieve register manually.
p_twi | TWI interface. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, OV_I2C_SENSOR_ADDRESS, ov_read_reg(), _ov_reg::reg, regs_manual, and _ov_reg::val.
Referenced by ov_store_manual().
uint32_t ov_store_manual | ( | Twihs *const | p_twi, |
volatile uint32_t * | p_backup_addr, | ||
uint32_t | ul_size | ||
) |
Store back up register manually.
p_twi | TWI interface. |
p_backup_addr | Backup register address. |
References ov_retrieve_manual(), and _ov_reg::val.
|
static |
OV7740 test write.
p_twi | TWI interface. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, twihs_packet::length, OV_I2C_SENSOR_ADDRESS, ov_read_reg(), and ov_write_reg().
Referenced by ov_init().
uint32_t ov_write_reg | ( | Twihs *const | p_twi, |
twihs_packet_t *const | p_packet | ||
) |
Write a specified value to a register of the OV7740 sensor.
p_twi | TWI interface. |
p_packet | TWI packet. |
References twihs_master_write().
Referenced by ov_configure_finish(), ov_test_write(), and ov_write_regs().
uint32_t ov_write_regs | ( | Twihs *const | p_twi, |
const ov_reg * | p_reg_list | ||
) |
Initialize a list of OV7740 registers.
The list of registers is terminated by the pair of values {OV_REG_TERM, OV_VAL_TERM}.
p_twi | TWI interface. |
p_reg_list | Register list to be written. |
References twihs_packet::addr, twihs_packet::addr_length, twihs_packet::buffer, twihs_packet::chip, delay_ms, twihs_packet::length, OV_I2C_SENSOR_ADDRESS, OV_REG_TERM, OV_VAL_TERM, ov_write_reg(), _ov_reg::reg, TWIHS_BUSY, and _ov_reg::val.
Referenced by ov_configure(), and ov_configure_manual().
|
static |
Register array for manual operation (given by OmniVision toolkit).
Referenced by ov_retrieve_manual().