update:更新双目sensor驱动

This commit is contained in:
2025-03-31 18:48:56 +08:00
parent 4fd818749c
commit 0933b5aeec
18 changed files with 489 additions and 585 deletions

View File

@@ -155,6 +155,33 @@ int vin_gpio_set_status(int id, enum gpio_type gpio_id, unsigned int status)
return 0;
}
int vin_gpio_get_status(int id, enum gpio_type gpio_id)
{
gpio_pin_t gpio;
int ret;
gpio_direction_t direction;
if (gpio_id == PWDN)
gpio = global_sensors[id].pwdn_gpio;
else if (gpio_id == RESET)
gpio = global_sensors[id].reset_gpio;
else if (gpio_id == IR_CUT0)
gpio = global_sensors[id].ir_cut_gpio[0];
else if (gpio_id == IR_CUT1)
gpio = global_sensors[id].ir_cut_gpio[1];
else if (gpio_id == IR_LED)
gpio = global_sensors[id].ir_led_gpio;
else
return -1;
if (gpio == 0xffff)
return -1;
ret = hal_gpio_get_direction(gpio, &direction);
vin_warn("%s(),l:%d, direction:%d\n", __func__, __LINE__, direction);
return (int)direction;
}
int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value)
{
gpio_pin_t gpio;
@@ -185,6 +212,32 @@ int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value)
return 0;
}
int vin_gpio_read(int id, enum gpio_type gpio_id)
{
gpio_pin_t gpio;
int ret, data;
if (gpio_id == PWDN)
gpio = global_sensors[id].pwdn_gpio;
else if (gpio_id == RESET)
gpio = global_sensors[id].reset_gpio;
else if (gpio_id == IR_CUT0)
gpio = global_sensors[id].ir_cut_gpio[0];
else if (gpio_id == IR_CUT1)
gpio = global_sensors[id].ir_cut_gpio[1];
else if (gpio_id == IR_LED)
gpio = global_sensors[id].ir_led_gpio;
else
return -1;
if (gpio == 0xffff)
return -1;
ret = hal_gpio_get_data(gpio, &data);
vin_warn("%s(),l:%d, data:%d\n", __func__, __LINE__, data);
return data;
}
int vin_set_mclk_freq(int id, unsigned long freq)
{
hal_clk_t mclk_src = 0;

View File

@@ -45,6 +45,8 @@ int sunxi_twi_exit(int id);
int vin_gpio_set_status(int id, enum gpio_type gpio_id, unsigned int status);
int vin_gpio_write(int id, enum gpio_type gpio_id, unsigned int out_value);
int vin_gpio_get_status(int id, enum gpio_type gpio_id);
int vin_gpio_read(int id, enum gpio_type gpio_id);
int vin_set_mclk_freq(int id, unsigned long freq);
int vin_set_mclk(int id, unsigned int on_off);