Skip to content

Commit 645a259

Browse files
committed
Enhance Otto Robot camera support by adding configuration for OV3660. Updated config.h to define camera types and GPIO settings, modified config.json to include new camera options, and refactored otto_robot.cc for improved camera detection and initialization logic.
1 parent abd6264 commit 645a259

File tree

3 files changed

+207
-111
lines changed

3 files changed

+207
-111
lines changed

main/boards/otto-robot/config.h

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,63 @@
11
#ifndef _BOARD_CONFIG_H_
22
#define _BOARD_CONFIG_H_
33

4-
#include <driver/gpio.h>
54
#include <driver/adc.h>
5+
#include <driver/gpio.h>
6+
7+
#define OTTO_VERSION_AUTO 0
8+
#define OTTO_VERSION_CAMERA 1
9+
#define OTTO_VERSION_NO_CAMERA 2
10+
11+
#ifndef OTTO_HARDWARE_VERSION
12+
#define OTTO_HARDWARE_VERSION OTTO_VERSION_AUTO
13+
#endif
14+
15+
enum OttoCameraType {
16+
OTTO_CAMERA_NONE = 0,
17+
OTTO_CAMERA_OV2640 = 1,
18+
OTTO_CAMERA_OV3660 = 2,
19+
OTTO_CAMERA_UNKNOWN = 99,
20+
};
21+
22+
#define OV2640_PID_1 0x2640
23+
#define OV2640_PID_2 0x2626
24+
#define OV3660_PID 0x3660
625

726
struct HardwareConfig {
827
gpio_num_t power_charge_detect_pin;
928
adc_unit_t power_adc_unit;
1029
adc_channel_t power_adc_channel;
11-
30+
1231
gpio_num_t right_leg_pin;
1332
gpio_num_t right_foot_pin;
1433
gpio_num_t left_leg_pin;
1534
gpio_num_t left_foot_pin;
1635
gpio_num_t left_hand_pin;
1736
gpio_num_t right_hand_pin;
18-
37+
1938
int audio_input_sample_rate;
2039
int audio_output_sample_rate;
2140
bool audio_use_simplex;
22-
41+
2342
gpio_num_t audio_i2s_gpio_ws;
2443
gpio_num_t audio_i2s_gpio_bclk;
2544
gpio_num_t audio_i2s_gpio_din;
2645
gpio_num_t audio_i2s_gpio_dout;
27-
46+
2847
gpio_num_t audio_i2s_mic_gpio_ws;
2948
gpio_num_t audio_i2s_mic_gpio_sck;
3049
gpio_num_t audio_i2s_mic_gpio_din;
3150
gpio_num_t audio_i2s_spk_gpio_dout;
3251
gpio_num_t audio_i2s_spk_gpio_bclk;
3352
gpio_num_t audio_i2s_spk_gpio_lrck;
34-
53+
3554
gpio_num_t display_backlight_pin;
3655
gpio_num_t display_mosi_pin;
3756
gpio_num_t display_clk_pin;
3857
gpio_num_t display_dc_pin;
3958
gpio_num_t display_rst_pin;
4059
gpio_num_t display_cs_pin;
41-
60+
4261
gpio_num_t i2c_sda_pin;
4362
gpio_num_t i2c_scl_pin;
4463
};
@@ -47,37 +66,37 @@ constexpr HardwareConfig CAMERA_VERSION_CONFIG = {
4766
.power_charge_detect_pin = GPIO_NUM_NC,
4867
.power_adc_unit = ADC_UNIT_1,
4968
.power_adc_channel = ADC_CHANNEL_1,
50-
69+
5170
.right_leg_pin = GPIO_NUM_43,
5271
.right_foot_pin = GPIO_NUM_44,
5372
.left_leg_pin = GPIO_NUM_5,
5473
.left_foot_pin = GPIO_NUM_6,
5574
.left_hand_pin = GPIO_NUM_4,
5675
.right_hand_pin = GPIO_NUM_7,
57-
76+
5877
.audio_input_sample_rate = 16000,
5978
.audio_output_sample_rate = 16000,
6079
.audio_use_simplex = false,
61-
80+
6281
.audio_i2s_gpio_ws = GPIO_NUM_40,
6382
.audio_i2s_gpio_bclk = GPIO_NUM_42,
6483
.audio_i2s_gpio_din = GPIO_NUM_41,
6584
.audio_i2s_gpio_dout = GPIO_NUM_39,
66-
85+
6786
.audio_i2s_mic_gpio_ws = GPIO_NUM_NC,
6887
.audio_i2s_mic_gpio_sck = GPIO_NUM_NC,
6988
.audio_i2s_mic_gpio_din = GPIO_NUM_NC,
7089
.audio_i2s_spk_gpio_dout = GPIO_NUM_NC,
7190
.audio_i2s_spk_gpio_bclk = GPIO_NUM_NC,
7291
.audio_i2s_spk_gpio_lrck = GPIO_NUM_NC,
73-
92+
7493
.display_backlight_pin = GPIO_NUM_38,
7594
.display_mosi_pin = GPIO_NUM_45,
7695
.display_clk_pin = GPIO_NUM_48,
7796
.display_dc_pin = GPIO_NUM_47,
7897
.display_rst_pin = GPIO_NUM_1,
7998
.display_cs_pin = GPIO_NUM_NC,
80-
99+
81100
.i2c_sda_pin = GPIO_NUM_15,
82101
.i2c_scl_pin = GPIO_NUM_16,
83102
};
@@ -86,37 +105,37 @@ constexpr HardwareConfig NON_CAMERA_VERSION_CONFIG = {
86105
.power_charge_detect_pin = GPIO_NUM_21,
87106
.power_adc_unit = ADC_UNIT_2,
88107
.power_adc_channel = ADC_CHANNEL_3,
89-
108+
90109
.right_leg_pin = GPIO_NUM_39,
91110
.right_foot_pin = GPIO_NUM_38,
92111
.left_leg_pin = GPIO_NUM_17,
93112
.left_foot_pin = GPIO_NUM_18,
94113
.left_hand_pin = GPIO_NUM_8,
95114
.right_hand_pin = GPIO_NUM_12,
96-
115+
97116
.audio_input_sample_rate = 16000,
98117
.audio_output_sample_rate = 24000,
99118
.audio_use_simplex = true,
100-
119+
101120
.audio_i2s_gpio_ws = GPIO_NUM_NC,
102121
.audio_i2s_gpio_bclk = GPIO_NUM_NC,
103122
.audio_i2s_gpio_din = GPIO_NUM_NC,
104123
.audio_i2s_gpio_dout = GPIO_NUM_NC,
105-
124+
106125
.audio_i2s_mic_gpio_ws = GPIO_NUM_4,
107126
.audio_i2s_mic_gpio_sck = GPIO_NUM_5,
108127
.audio_i2s_mic_gpio_din = GPIO_NUM_6,
109128
.audio_i2s_spk_gpio_dout = GPIO_NUM_7,
110129
.audio_i2s_spk_gpio_bclk = GPIO_NUM_15,
111130
.audio_i2s_spk_gpio_lrck = GPIO_NUM_16,
112-
131+
113132
.display_backlight_pin = GPIO_NUM_3,
114133
.display_mosi_pin = GPIO_NUM_10,
115134
.display_clk_pin = GPIO_NUM_9,
116135
.display_dc_pin = GPIO_NUM_46,
117136
.display_rst_pin = GPIO_NUM_11,
118137
.display_cs_pin = GPIO_NUM_12,
119-
138+
120139
.i2c_sda_pin = GPIO_NUM_NC,
121140
.i2c_scl_pin = GPIO_NUM_NC,
122141
};

main/boards/otto-robot/config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"CONFIG_HTTPD_WS_SUPPORT=y",
88
"CONFIG_CAMERA_OV2640=y",
99
"CONFIG_CAMERA_OV2640_AUTO_DETECT_DVP_INTERFACE_SENSOR=y",
10-
"CONFIG_CAMERA_OV2640_DVP_YUV422_240X240_25FPS=y"
10+
"CONFIG_CAMERA_OV2640_DVP_YUV422_240X240_25FPS=y",
11+
"CONFIG_CAMERA_OV3660=y",
12+
"CONFIG_CAMERA_OV3660_AUTO_DETECT_DVP_INTERFACE_SENSOR=y",
13+
"CONFIG_CAMERA_OV3660_DVP_YUV422_240X240_24FPS=y"
1114
]
1215
}
1316
]

0 commit comments

Comments
 (0)