mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Move framebuffer sync code before snapshot code.
* This forces the IDE to read the image before any drawing, which Fixes the double buffering issue.
This commit is contained in:
parent
38efbd5bbe
commit
23fe7b6363
@ -35,6 +35,8 @@
|
||||
#endif
|
||||
#define BREAK() __asm__ volatile ("BKPT")
|
||||
|
||||
#define MAX_XFER_SIZE (0xFFFC)
|
||||
|
||||
struct sensor_dev sensor;
|
||||
TIM_HandleTypeDef TIMHandle;
|
||||
DMA_HandleTypeDef DMAHandle;
|
||||
@ -303,8 +305,6 @@ int sensor_write_reg(uint8_t reg, uint8_t val)
|
||||
return SCCB_Write(sensor.slv_addr, reg, val);
|
||||
}
|
||||
|
||||
#define MAX_XFER_SIZE (0xFFFC)
|
||||
|
||||
int sensor_snapshot(struct image *image)
|
||||
{
|
||||
volatile uint32_t addr;
|
||||
@ -319,6 +319,12 @@ int sensor_snapshot(struct image *image)
|
||||
length =(fb->w * fb->h * 2)/4;
|
||||
}
|
||||
|
||||
fb->ready = 1;
|
||||
while (fb->lock_tried) {
|
||||
systick_sleep(2);
|
||||
}
|
||||
fb->ready = 0;
|
||||
|
||||
/* Lock framebuffer mutex */
|
||||
mutex_lock(&fb->lock);
|
||||
|
||||
@ -362,14 +368,8 @@ int sensor_snapshot(struct image *image)
|
||||
image->pixels = fb->pixels;
|
||||
}
|
||||
|
||||
fb->ready = 1;
|
||||
|
||||
/* unlock framebuffer mutex */
|
||||
mutex_unlock(&fb->lock);
|
||||
|
||||
while (fb->lock_tried) {
|
||||
systick_sleep(2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user