stm32-camera  1.0
ov7670.c
Go to the documentation of this file.
1 /**
2  * @file ov7670.c
3  * @brief Main source file for the OV7670 camera module.
4  *
5  * @details pinkeee @ j.t0dd@protonmail.com
6  * @note See README for contributing guides and info.
7  * @copyright See License file.
8  */
9 
10 #include "ov7670.h"
11 
12 /* Global I2C for driver so user never has to pass handler again. */
13 I2C_HandleTypeDef *OV7670_I2C;
14 
15 bool OV7670_init(I2C_HandleTypeDef *hi2c)
16 {
17  /* Set driver handler to argument. */
18  assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
19  OV7670_I2C = hi2c;
20 
21  /* Start setting registers. This is using pure I2C not SCCB, don't have hardware yet.
22  * Additionally, this is transmitting without DMA, very bad for a camera driver but
23  * just get it to work first then add things like DMA and interrupts.
24  *
25  * I have a feeling that this can get much better, maybe make one big buffer
26  * and then transmit that instead??!?!?!? this looks so so so bad it hurts.
27  */
32 
39 
43 }
Main header file for the OV7670 camera module.
static uint8_t OV7670_CLKRC_RESET_VALUE
CLKRC 30fps clock scale.
Definition: ov7670.h:1656
static uint8_t OV7670_VSTOP_RESET_VALUE
VSTOP reset, this makes more sense compared to HSTOP.
Definition: ov7670.h:1705
static uint8_t OV7670_VSTART_RESET_VALUE
VSTART reset.
Definition: ov7670.h:1698
static uint8_t OV7670_COM7_SOFT_RESET
Values for registers to be set at camera init.
Definition: ov7670.h:1648
static uint32_t OV7670_TIMEOUT
Timeout for whole driver coms.
Definition: ov7670.h:32
static uint8_t OV7670_VREF_RESET_VALUE
VREF reset, start low 2 bits from VSTOP/START.
Definition: ov7670.h:1712
static uint8_t OV7670_HSTOP_RESET_VALUE
HSTOP reset, value from OV doesn't make sense at all.
Definition: ov7670.h:1684
static uint8_t OV7670_SCALING_XSC_RESET_VALUE
SCALING_XSC reset value.
Definition: ov7670.h:1726
static uint8_t OV7670_COM14_RESET_VALUE
COM3 reset value.
Definition: ov7670.h:1719
static uint8_t OV7670_SCALING_PCLK_DIV_RESET_VALUE
SCALING_PCLK_DIV reset value.
Definition: ov7670.h:1733
static uint8_t OV7670_COM7_RESET_VALUE
COM7 YUV reset value.
Definition: ov7670.h:1670
static uint8_t OV7670_HSTART_RESET_VALUE
HSTART reset, value from OV doesn't make sense at all.
Definition: ov7670.h:1677
bool OV7670_init(I2C_HandleTypeDef *hi2c)
Definition: ov7670.c:15
I2C_HandleTypeDef * OV7670_I2C
Functions and other variables!
Definition: ov7670.c:13
static uint8_t OV7670_WRITE_ADDRESS
SCCB camera write slave address.
Definition: ov7670.h:20
static uint8_t OV7670_TSLB_RESET_VALUE
TSLB magic reserved bit.
Definition: ov7670.h:1663
static uint8_t OV7670_HREF_RESET_VALUE
HREF reset, MSB bits from HSTART AND HSTOP.
Definition: ov7670.h:1691