Skip to content

Commit 34c5f82

Browse files
authored
refactor sensor.c to use sensor_device.h for overwrites (#41)
1 parent 0e41ee9 commit 34c5f82

4 files changed

Lines changed: 47 additions & 1791 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* This file may be replaced by the device-specific sensor.
3+
*
4+
*
5+
*/
6+
7+
static struct sensor_config_t {
8+
uint8_t cmos_pclk;
9+
uint8_t cmos_xclk;
10+
uint8_t cmos_href;
11+
uint8_t cmos_pwdn;
12+
uint8_t cmos_vsync;
13+
uint8_t cmos_rst;
14+
15+
uint8_t reg_width;
16+
uint8_t i2c_num;
17+
uint8_t pin_clk;
18+
uint8_t pin_sda;
19+
uint8_t gpio_clk;
20+
uint8_t gpio_sda;
21+
} sensor_config = {
22+
47, 46, 45, 44, 43, 42,
23+
8, 2, 41, 40, 0, 0
24+
};

‎components/micropython/port/src/omv/sensor.c‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "ov5640.h"
3030
#include "ov5642.h"
3131
#include "Maix_config.h"
32+
#include "sensor_device.h"
3233

3334
extern volatile dvp_t *const dvp;
3435

@@ -96,25 +97,6 @@ void _ndelay(uint32_t ns)
9697
}
9798
}
9899

99-
static struct sensor_config_t {
100-
uint8_t cmos_pclk;
101-
uint8_t cmos_xclk;
102-
uint8_t cmos_href;
103-
uint8_t cmos_pwdn;
104-
uint8_t cmos_vsync;
105-
uint8_t cmos_rst;
106-
107-
uint8_t reg_width;
108-
uint8_t i2c_num;
109-
uint8_t pin_clk;
110-
uint8_t pin_sda;
111-
uint8_t gpio_clk;
112-
uint8_t gpio_sda;
113-
} sensor_config = {
114-
47, 46, 45, 44, 43, 42,
115-
8, 2, 41, 40, 0, 0
116-
};
117-
118100
#define SENSOR_CHECK_CONFIG(GOAL, val) \
119101
{ \
120102
const char key[] = #GOAL; \
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
static struct sensor_config_t {
3+
uint8_t cmos_pclk;
4+
uint8_t cmos_xclk;
5+
uint8_t cmos_href;
6+
uint8_t cmos_pwdn;
7+
uint8_t cmos_vsync;
8+
uint8_t cmos_rst;
9+
10+
uint8_t reg_width;
11+
uint8_t i2c_num;
12+
uint8_t pin_clk;
13+
uint8_t pin_sda;
14+
uint8_t gpio_clk;
15+
uint8_t gpio_sda;
16+
} sensor_config = {
17+
15, 14, 17, 13, 12, 11,
18+
8, 2, 10, 9, 0, 0
19+
// 47, 46, 45, 44, 43, 42,
20+
// 8, 2, 41, 40, 0, 0
21+
};
22+

0 commit comments

Comments
 (0)