This commit is contained in:
2025-04-29 23:23:45 +02:00
parent 7acfb06d42
commit bc8616ef5f
12 changed files with 305 additions and 104 deletions

View File

@@ -25,7 +25,7 @@
#include "i2c.h"
#include <stdbool.h>
#include <stdio.h>
#include <Arduino.h>
#define CCI_MAX_WAIT_TICKS 5000
@@ -64,7 +64,7 @@ static void cci_wait_busy_clear_check(char* cmd);
*/
void cci_set_reg(uint16_t cmd, int len, uint16_t* buf)
{
char cmd_buf[11]; // sized for 'cmd 0xNNNN<NULL>'
char cmd_buf[12]; // sized for 'cmd 0xNNNN<NULL>'
int ret = 1;
cci_last_status_error = false;
@@ -554,7 +554,7 @@ void cc_run_oem_reboot()
cci_wait_busy_clear();
cci_write_register(CCI_REG_COMMAND, CCI_CMD_OEM_RUN_REBOOT);
// Sleep to allow camera to reboot and run FFC
delay(6000);
vTaskDelay(pdMS_TO_TICKS(6000));
cci_wait_busy_clear_check("CCI_CMD_OEM_RUN_REBOOT");
}
@@ -631,10 +631,10 @@ static int cci_write_register(uint16_t reg, uint16_t value)
{
// Write the register address and value
uint8_t write_buf[4] = {
reg >> 8 & 0xff,
reg & 0xff,
value >> 8 & 0xff,
value & 0xff
uint8_t (reg >> 8 & 0xff),
uint8_t (reg & 0xff),
uint8_t (value >> 8 & 0xff),
uint8_t (value & 0xff)
};
if (i2c_master_write_slave(CCI_ADDRESS, write_buf, sizeof(write_buf)) != ESP_OK) {
printf("[CCI] Error: failed to write CCI register %02x with value %02x\n", reg, value);