|
12 | 12 | #include <zephyr/drivers/video-controls.h> |
13 | 13 | #include <zephyr/drivers/video.h> |
14 | 14 | #include <zephyr/logging/log.h> |
15 | | -#include <zephyr/drivers/video/arducam_mega.h> |
16 | 15 |
|
17 | 16 | #include "video_common.h" |
18 | 17 | #include "video_ctrls.h" |
@@ -145,6 +144,14 @@ enum mega_features { |
145 | 144 | MEGA_HAS_FOCUS = 1 << 1, |
146 | 145 | }; |
147 | 146 |
|
| 147 | +/* Arducam specific camera controls */ |
| 148 | +#define VIDEO_CID_ARDUCAM_RESET (VIDEO_CID_PRIVATE_BASE + 1) |
| 149 | +#define VIDEO_CID_ARDUCAM_LOWPOWER (VIDEO_CID_PRIVATE_BASE + 2) |
| 150 | + |
| 151 | +/* Read only registers */ |
| 152 | +#define VIDEO_CID_ARDUCAM_SUPP_RES (VIDEO_CID_PRIVATE_BASE + 3) |
| 153 | +#define VIDEO_CID_ARDUCAM_SUPP_SP_EFF (VIDEO_CID_PRIVATE_BASE + 4) |
| 154 | + |
148 | 155 | #define ARDUCHIP_FIFO 0x04 /* FIFO and I2C control */ |
149 | 156 | #define ARDUCHIP_FIFO_2 0x07 /* FIFO and I2C control */ |
150 | 157 |
|
@@ -206,6 +213,8 @@ enum mega_features { |
206 | 213 | #define AC_STACK_SIZE 4096 |
207 | 214 | #define AC_PRIORITY 5 |
208 | 215 |
|
| 216 | +#define ARDUCAM_MEGA_CAPTURE_TRIES 200 |
| 217 | + |
209 | 218 | K_THREAD_STACK_DEFINE(ac_stack_area, AC_STACK_SIZE); |
210 | 219 |
|
211 | 220 | struct k_work_q ac_work_q; |
@@ -954,7 +963,7 @@ static int arducam_mega_capture(const struct device *dev, uint32_t *length) |
954 | 963 | arducam_mega_write_reg(&cfg->bus, ARDUCHIP_FIFO, FIFO_CLEAR_ID_MASK); |
955 | 964 | arducam_mega_write_reg(&cfg->bus, ARDUCHIP_FIFO, FIFO_START_MASK); |
956 | 965 |
|
957 | | - for (; tries > 0; tries--) { |
| 966 | + for (int tries = ARDUCAM_MEGA_CAPTURE_TRIES; tries > 0; tries--) { |
958 | 967 | ret = arducam_mega_read_reg(&cfg->bus, ARDUCHIP_TRIG, ®_data); |
959 | 968 | if (ret < 0) { |
960 | 969 | LOG_ERR("Capture timeout!"); |
@@ -1282,7 +1291,6 @@ static int arducam_mega_init(const struct device *dev) |
1282 | 1291 | { |
1283 | 1292 | const struct arducam_mega_config *cfg = dev->config; |
1284 | 1293 | struct arducam_mega_data *drv_data = dev->data; |
1285 | | - |
1286 | 1294 | struct video_format fmt; |
1287 | 1295 | int ret = 0; |
1288 | 1296 | uint32_t reg_data; |
|
0 commit comments