diff --git a/ports/stm32/omv_csi.c b/ports/stm32/omv_csi.c index 53a90b539..ece7acafe 100644 --- a/ports/stm32/omv_csi.c +++ b/ports/stm32/omv_csi.c @@ -1067,65 +1067,10 @@ static int stm_csi_snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) { return 0; } -int omv_csi_init() { - int ret = 0; - static omv_i2c_t i2c; - - // List of I2C buses to scan. - uint32_t buses[][2] = { - {OMV_CSI_I2C_ID, OMV_CSI_I2C_SPEED}, - #if defined(OMV_CSI_I2C_ALT_ID) - {OMV_CSI_I2C_ALT_ID, OMV_CSI_I2C_ALT_SPEED}, - #endif - }; - - // Initialize the CSIs using this driver's ops as defaults, - // which can be overridden by sensor drivers during probe. - for (size_t i=0; ii2c = &i2c; - csi->fb = framebuffer_get(-1); - csi->abort = stm_csi_abort; - csi->config = stm_csi_config; - csi->shutdown = stm_csi_shutdown; - csi->snapshot = stm_csi_snapshot; - csi->color_palette = rainbow_table; - } - - // Configure the csi external clock (XCLK). - if (omv_csi_set_clk_frequency(OMV_CSI_CLK_FREQUENCY) != 0) { - return OMV_CSI_ERROR_TIM_INIT_FAILED; - } - - // Detect and initialize sensor(s). - for (uint32_t i = 0, n_buses = OMV_ARRAY_SIZE(buses); i < n_buses; i++) { - // Initialize the camera bus. - omv_i2c_init(&i2c, buses[i][0], buses[i][1]); - - if (!(ret = omv_csi_probe(&i2c))) { - break; - } - - omv_i2c_deinit(&i2c); - - // Scan the next bus or fail if this is the last one. - if ((i + 1) == n_buses) { - return ret; - } - } - - // Configure the DCMI interface. - for (size_t i=0; ienabled = 0; +int omv_csi_ops_init(omv_csi_t *csi) { + csi->abort = stm_csi_abort; + csi->config = stm_csi_config; + csi->shutdown = stm_csi_shutdown; + csi->snapshot = stm_csi_snapshot; return 0; } diff --git a/ports/stm32/stm32_hal_msp.c b/ports/stm32/stm32_hal_msp.c index 445e84d24..45f3c4b6f 100644 --- a/ports/stm32/stm32_hal_msp.c +++ b/ports/stm32/stm32_hal_msp.c @@ -271,16 +271,6 @@ void HAL_MspInit(void) { OMV_AXI_QOS_LTDC_W_SET(OMV_AXI_QOS_LTDC_W_PRI); #endif - #if defined(OMV_CSI_RESET_PIN) - omv_gpio_config(OMV_CSI_RESET_PIN, OMV_GPIO_MODE_OUTPUT, OMV_GPIO_PULL_DOWN, OMV_GPIO_SPEED_LOW, -1); - #endif - #if defined(OMV_CSI_FSYNC_PIN) - omv_gpio_config(OMV_CSI_FSYNC_PIN, OMV_GPIO_MODE_OUTPUT, OMV_GPIO_PULL_DOWN, OMV_GPIO_SPEED_LOW, -1); - #endif - #if defined(OMV_CSI_POWER_PIN) - omv_gpio_config(OMV_CSI_POWER_PIN, OMV_GPIO_MODE_OUTPUT, OMV_GPIO_PULL_UP, OMV_GPIO_SPEED_LOW, -1); - #endif - #if defined(OMV_FIR_LEPTON_RESET_PIN) omv_gpio_config(OMV_FIR_LEPTON_RESET_PIN, OMV_GPIO_MODE_OUTPUT, OMV_GPIO_PULL_NONE, OMV_GPIO_SPEED_LOW, -1); omv_gpio_write(OMV_FIR_LEPTON_RESET_PIN, 0);