drivers/sensors: Add lepton abort support.

This commit is contained in:
Kwabena W. Agyeman 2025-06-28 18:22:57 -07:00
parent 2c3e90b44b
commit ff50dbbf69
3 changed files with 11 additions and 1 deletions

View File

@ -196,6 +196,11 @@ int vospi_deinit() {
return omv_spi_deinit(&vospi.spi_bus); return omv_spi_deinit(&vospi.spi_bus);
} }
int vospi_abort(void) {
vospi.flags &= ~VOSPI_FLAGS_CAPTURE;
return 0;
}
bool vospi_active(void) { bool vospi_active(void) {
return vospi.flags & VOSPI_FLAGS_CAPTURE; return vospi.flags & VOSPI_FLAGS_CAPTURE;
} }

View File

@ -28,6 +28,7 @@
#include "framebuffer.h" #include "framebuffer.h"
int vospi_init(uint32_t n_packets, framebuffer_t *fb); int vospi_init(uint32_t n_packets, framebuffer_t *fb);
int vospi_deinit(); int vospi_deinit();
int vospi_abort(void);
bool vospi_active(void); bool vospi_active(void);
int vospi_snapshot(uint32_t timeout_ms); int vospi_snapshot(uint32_t timeout_ms);
#endif // __VOSPI_H__ #endif // __VOSPI_H__

View File

@ -493,6 +493,10 @@ static int snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
return 0; return 0;
} }
static int lepton_abort(omv_csi_t *csi, bool fifo_flush, bool in_irq) {
return vospi_abort();
}
static int config(omv_csi_t *csi, omv_csi_config_t config) { static int config(omv_csi_t *csi, omv_csi_config_t config) {
if (config == OMV_CSI_CONFIG_INIT) { if (config == OMV_CSI_CONFIG_INIT) {
if (reset(csi) != 0) { if (reset(csi) != 0) {
@ -529,7 +533,7 @@ int lepton_init(omv_csi_t *csi) {
csi->reset = reset; csi->reset = reset;
csi->sleep = sleep; csi->sleep = sleep;
csi->config = config; csi->config = config;
csi->abort = NULL; csi->abort = lepton_abort;
csi->match = match; csi->match = match;
csi->snapshot = snapshot; csi->snapshot = snapshot;
csi->read_reg = read_reg; csi->read_reg = read_reg;