Unit tests for OV7740 driver.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "asf.h"
#include <unit_test/suite.h>
#include "stdio_serial.h"
#include "conf_board.h"
#include "conf_clock.h"
#include "conf_test.h"
Macros | |
#define | PIO_PCMR_DSIZE_WORD PIO_PCMR_DSIZE(2) |
#define | TWI_CLK (400000UL) |
Functions | |
static uint32_t | capture_init (void) |
Initialize PIO capture and the OV7740 image sensor. More... | |
static void | init_vsync_interrupts (void) |
Intialize Vsync_Handler. More... | |
int | main (void) |
Application entry point for image sensor capture example. More... | |
static void | ov7740_test_capture_process_run (const struct test_case *const test) |
Start capture process. More... | |
static void | ov7740_test_color_run (const struct test_case *const test) |
Test color of the reference picture from OV7740 image sensor. More... | |
static void | ov7740_test_initialization_run (const struct test_case *const test) |
Test the OV7740 initialization. More... | |
static void | pio_capture_init (Pio *const p_pio, uint32_t ul_id) |
Initialize PIO capture for the OV7740 image sensor communication. More... | |
static void | pio_capture_to_buffer (Pio *const p_pio, uint8_t *p_uc_buf, uint32_t ul_size) |
Capture OV7740 data to a buffer. More... | |
static uint32_t | test_color (uint8_t *p_uc_ref_color, uint8_t *p_uc_capture_data, uint32_t ul_index_capture) |
Test color of a reference picture. More... | |
static void | vsync_handler (uint32_t ul_id, uint32_t ul_mask) |
Vertical synchronisation handler for the OV7740 image sensor. More... | |
Variables | |
uint8_t | g_auc_capture_buffer [51200] |
const uint8_t | g_auc_data_black_color [4] |
const uint8_t | g_auc_data_blue_color [4] |
const uint8_t | g_auc_data_cyan_color [4] |
const uint8_t | g_auc_data_green_color [4] |
const uint8_t | g_auc_data_purple_color [4] |
const uint8_t | g_auc_data_red_color [4] |
const uint8_t | g_auc_data_white_color [4] |
const uint8_t | g_auc_data_yellow_color [4] |
static volatile uint32_t | g_ul_init_error_flag = false |
static volatile uint32_t | g_ul_vsync_flag = false |
const usart_serial_options_t | usart_serial_options |
#define PIO_PCMR_DSIZE_WORD PIO_PCMR_DSIZE(2) |
Referenced by pio_capture_init().
#define TWI_CLK (400000UL) |
Referenced by capture_init().
|
static |
Initialize PIO capture and the OV7740 image sensor.
References delay_ms, init_vsync_interrupts(), twi_options::master_clk, ov_configure(), ov_init(), ov_power(), pio_capture_init(), pmc_enable_periph_clk(), PMC_PCK_PRES_CLK_4, twi_options::speed, sysclk_get_cpu_hz(), TEST_PATTERN, TWI_CLK, and twi_master_init().
Referenced by ov7740_test_initialization_run().
|
static |
int main | ( | void | ) |
Application entry point for image sensor capture example.
References board_init(), DEFINE_TEST_ARRAY, DEFINE_TEST_CASE, DEFINE_TEST_SUITE, NULL, ov7740_test_capture_process_run(), ov7740_test_color_run(), ov7740_test_initialization_run(), pmc_enable_pllack(), stdio_serial_init(), sysclk_enable_peripheral_clock(), sysclk_init(), and test_suite_run().
|
static |
Start capture process.
References g_auc_capture_buffer, g_ul_init_error_flag, g_ul_vsync_flag, pio_capture_to_buffer(), pio_disable_interrupt(), pio_enable_interrupt(), and test_assert_true.
Referenced by main().
|
static |
Test color of the reference picture from OV7740 image sensor.
test | Current test case. |
References g_auc_capture_buffer, g_auc_data_black_color, g_auc_data_blue_color, g_auc_data_cyan_color, g_auc_data_green_color, g_auc_data_purple_color, g_auc_data_red_color, g_auc_data_white_color, g_auc_data_yellow_color, test_assert_true, and test_color().
Referenced by main().
|
static |
Test the OV7740 initialization.
test | Current test case. |
References capture_init(), g_ul_init_error_flag, and test_assert_true.
Referenced by main().
|
static |
Initialize PIO capture for the OV7740 image sensor communication.
p_pio | PIO instance to be configured in PIO capture mode. |
ul_id | Corresponding PIO ID. |
References PIO_PCMR_DSIZE_WORD, and pmc_enable_periph_clk().
Referenced by capture_init().
|
static |
Capture OV7740 data to a buffer.
p_pio | PIO instance which will capture data from OV7740 iamge sensor. |
p_uc_buf | Buffer address where captured data must be stored. |
ul_size | Data frame size. |
Referenced by ov7740_test_capture_process_run().
|
static |
Test color of a reference picture.
p_uc_ref_color | Buffer which contains the reference color. |
p_uc_capture_data | Buffer which contains data from the captured picture. |
ul_index_capture | Index in p_uc_capture_data. |
Referenced by ov7740_test_color_run().
|
static |
Vertical synchronisation handler for the OV7740 image sensor.
References g_ul_vsync_flag, and UNUSED.
Referenced by init_vsync_interrupts().
uint8_t g_auc_capture_buffer[51200] |
Referenced by ov7740_test_capture_process_run(), and ov7740_test_color_run().
const uint8_t g_auc_data_black_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_blue_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_cyan_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_green_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_purple_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_red_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_white_color[4] |
Referenced by ov7740_test_color_run().
const uint8_t g_auc_data_yellow_color[4] |
Referenced by ov7740_test_color_run().
|
static |
Referenced by ov7740_test_capture_process_run(), and ov7740_test_initialization_run().
|
static |
Referenced by ov7740_test_capture_process_run(), and vsync_handler().
const usart_serial_options_t usart_serial_options |
Referenced by main(), and prvSetupHardware().