• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "hpm_ov5640.h"
9 
10 static camera_param_dvp_t camera_dvp_param = {
11     .hsync_active_low = true,
12     .vsync_active_low = false,
13 };
14 
15 static camera_param_mipi_t camera_mipi_param = {
16     .de_active_low = true,
17     .hsync_active_low = false,
18     .vsync_active_low = false,
19 };
20 
camera_device_init(camera_context_t * camera_context,camera_config_t * camera_config)21 hpm_stat_t camera_device_init(camera_context_t *camera_context, camera_config_t *camera_config)
22 {
23     assert(camera_context->delay_ms != NULL);
24 
25     hpm_stat_t stat = status_success;
26 
27     /* execute power up sequence */
28     ov5640_power_up(camera_context);
29 
30     /* software reset */
31     stat = ov5640_software_reset(camera_context);
32     if (stat != status_success) {
33         return stat;
34     }
35     camera_context->delay_ms(20);
36 
37     stat = ov5640_init(camera_context, camera_config);
38 
39     return stat;
40 }
41 
camera_device_get_dvp_param(camera_context_t * camera_context,camera_config_t * camera_config)42 hpm_stat_t camera_device_get_dvp_param(camera_context_t *camera_context, camera_config_t *camera_config)
43 {
44     (void)camera_context;
45     camera_config->interface_param = (void *)&camera_dvp_param;
46     return status_success;
47 }
48 
camera_device_get_mipi_param(camera_context_t * camera_context,camera_config_t * camera_config)49 hpm_stat_t camera_device_get_mipi_param(camera_context_t *camera_context, camera_config_t *camera_config)
50 {
51     (void)camera_context;
52     camera_config->interface_param = (void *)&camera_mipi_param;
53     return status_success;
54 }
55