ov5640
- group ov5640
Driver for the I²C OV5640 camera sensor.
https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/ The parallel data path is connected to FPGA. The MCU only has access to the I²C configuration interface.
5MP max resolutiono
Recording happens at 15 FPS, and the FPGA triple every frame to match the 50 FPS of the ECX335AF display.
When using the 4x digital zoom, the camera outputs 640x400 video.
Defines
-
OV5640_CHIPIDH
OV5640 Chip ID Register address, high byte.
-
OV5640_CHIPIDL
OV5640 Chip ID Register address, low byte.
-
OV5640_ID
OV5640 Chip ID, expected value.
-
OV5640_FPS
frames per second, as implemented in camera configuration
-
TRANSFER_CMPLT
-
TRANSFER_ERROR
-
I2C_SLAVE_ADDR
Functions
-
void ov5640_prepare(void)
Prepare the pins before the power comes in.
-
void ov5640_init(void)
Init the camera.
Trigger initialisation of the chip, controlling its reset and power pins.
-
void ov5640_deinit(void)
Revert the configuration of the camera module.
-
void ov5640_pwr_on(void)
Power on the camera.
Precondition: ov5640_init() called earlier in main.c
-
void ov5640_pwr_sleep(void)
Put camera into low-power mode, preserving configuration.
-
void ov5640_pwr_wake(void)
Wake camera up from low-power mode, prior configuration still valid.
-
void ov5640_mode_1x(void)
Change ov5640 config for 1x zoom.
-
void ov5640_mode_2x(void)
NWA: change ov5640 config for 2x zoom, also used for 4x.
-
void ov5640_reduce_size(uint16_t Hpixels, uint16_t Vpixels)
Reduce camera output size.
- Todo:
This function has not been tested, but uses code from >
Implement error checking on inputs, return a success/failure code>
- Parameters
Hpixels – desired horizontal output resolution (should be <= 640)
Vpixels – desired vertical output resolution (should be <= 400)
- Pre
ov5640_rgb565_mode_1x() or _2x() should have already been called
-
void ov5640_light_mode(uint8_t mode)
Configures AWB gain control.
- Parameters
mode – Refer
AWB Light mode config
-
void ov5640_color_saturation(uint8_t sat)
Configures color saturation.
- Parameters
sat – Refer Color saturation config
-
void ov5640_brightness(uint8_t bright)
Configures brightness.
- Parameters
bright – Range 0 - 8
-
void ov5640_contrast(uint8_t contrast)
Configures contrast.
- Parameters
contrast – Range 0 - 6.
-
void ov5640_sharpness(uint8_t sharp)
Configures sharpness.
- Parameters
sharp – Range 0 to 33, 0: off 33: auto.
-
void ov5640_special_effects(uint8_t eft)
Configures effects.
- Parameters
eft – refer
Effect configs
-
void ov5640_flash_ctrl(bool on)
Controls flash.
- Parameters
sw – 0: off 1: on
-
void ov5640_mirror(bool on)
Mirrors camera output (horizontal flip).
- Parameters
on – 1 to turn on, 0 to turn off
-
void ov5640_flip(bool on)
Flips camera output (vertical flip).
- Parameters
on – 1 to turn on, 0 to turn off
-
void ov5640_outsize_set(uint16_t offx, uint16_t offy, uint16_t width, uint16_t height)
Configures window size.
- Parameters
offx – Offset X
offy – Offset Y
width – Prescale width
height – Presclae height
-
void ov5640_focus_init(void)
Focus init transfer camera module firmware.