mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
common/csi: Add power-on flag.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
58d69cd571
commit
90a568fde5
@ -204,7 +204,9 @@ __weak int omv_csi_abort(omv_csi_t *csi, bool fifo_flush, bool in_irq) {
|
|||||||
|
|
||||||
__weak int omv_csi_reset(omv_csi_t *csi, bool hard) {
|
__weak int omv_csi_reset(omv_csi_t *csi, bool hard) {
|
||||||
// Disable any ongoing frame capture.
|
// Disable any ongoing frame capture.
|
||||||
omv_csi_abort(csi, true, false);
|
if (csi->power_on) {
|
||||||
|
omv_csi_abort(csi, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the csi state
|
// Reset the csi state
|
||||||
csi->sde = 0;
|
csi->sde = 0;
|
||||||
@ -224,16 +226,15 @@ __weak int omv_csi_reset(omv_csi_t *csi, bool hard) {
|
|||||||
#else
|
#else
|
||||||
csi->auto_rotation = false;
|
csi->auto_rotation = false;
|
||||||
#endif // MICROPY_PY_IMU
|
#endif // MICROPY_PY_IMU
|
||||||
|
|
||||||
csi->vsync_cb = (omv_csi_cb_t) { NULL, NULL };
|
|
||||||
csi->frame_cb = (omv_csi_cb_t) { NULL, NULL };
|
|
||||||
|
|
||||||
// Reset default color palette.
|
|
||||||
csi->color_palette = rainbow_table;
|
csi->color_palette = rainbow_table;
|
||||||
csi->disable_full_flush = false;
|
csi->disable_full_flush = false;
|
||||||
|
csi->vsync_cb = (omv_csi_cb_t) { NULL, NULL };
|
||||||
|
csi->frame_cb = (omv_csi_cb_t) { NULL, NULL };
|
||||||
|
|
||||||
// Restore shutdown state on reset.
|
// Restore shutdown state on reset.
|
||||||
omv_csi_shutdown(csi, false);
|
if (!csi->power_on) {
|
||||||
|
omv_csi_shutdown(csi, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (hard) {
|
if (hard) {
|
||||||
// Disable the bus before reset.
|
// Disable the bus before reset.
|
||||||
@ -438,11 +439,12 @@ int omv_csi_probe(omv_i2c_t *i2c) {
|
|||||||
for (size_t i=0; i<dev_count; i++) {
|
for (size_t i=0; i<dev_count; i++) {
|
||||||
omv_csi_t *csi = &csi_all[i];
|
omv_csi_t *csi = &csi_all[i];
|
||||||
|
|
||||||
|
csi->detected = true;
|
||||||
|
csi->power_on = true;
|
||||||
csi->power_pol = power_pol;
|
csi->power_pol = power_pol;
|
||||||
csi->reset_pol = reset_pol;
|
csi->reset_pol = reset_pol;
|
||||||
csi->chip_id = dev_list[i].chip_id;
|
csi->chip_id = dev_list[i].chip_id;
|
||||||
csi->slv_addr = dev_list[i].slv_addr;
|
csi->slv_addr = dev_list[i].slv_addr;
|
||||||
csi->detected = true;
|
|
||||||
|
|
||||||
uint32_t clk_hz = 0;
|
uint32_t clk_hz = 0;
|
||||||
sensor_init_t init_fun = NULL;
|
sensor_init_t init_fun = NULL;
|
||||||
@ -586,6 +588,9 @@ __weak int omv_csi_shutdown(omv_csi_t *csi, int enable) {
|
|||||||
return OMV_CSI_ERROR_CTL_FAILED;
|
return OMV_CSI_ERROR_CTL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update power-on flag.
|
||||||
|
csi->power_on = !enable;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -337,6 +337,7 @@ typedef struct _omv_csi {
|
|||||||
bool transpose; // Transpose Image
|
bool transpose; // Transpose Image
|
||||||
bool auto_rotation; // Rotate Image Automatically
|
bool auto_rotation; // Rotate Image Automatically
|
||||||
bool detected; // Set to true when the sensor is initialized.
|
bool detected; // Set to true when the sensor is initialized.
|
||||||
|
bool power_on; // Set to true when the sensor is active.
|
||||||
|
|
||||||
omv_i2c_t *i2c; // SCCB/I2C bus.
|
omv_i2c_t *i2c; // SCCB/I2C bus.
|
||||||
framebuffer_t *fb; // Frame buffer pointer
|
framebuffer_t *fb; // Frame buffer pointer
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user