mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
parent
46bbb691ca
commit
899ec65507
@ -11,11 +11,11 @@
|
|||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
extern char _fb_base;
|
extern char _fb_base;
|
||||||
static struct framebuffer {
|
static struct framebuffer {
|
||||||
int w;
|
int w,h;
|
||||||
int h;
|
|
||||||
int bpp;
|
int bpp;
|
||||||
int ready;
|
int ready;
|
||||||
mutex_t lock;
|
mutex_t lock;
|
||||||
|
int lock_tried;
|
||||||
uint8_t pixels[];
|
uint8_t pixels[];
|
||||||
// Note all instances of fb point to the same memory address.
|
// Note all instances of fb point to the same memory address.
|
||||||
}*fb = (struct framebuffer *) &_fb_base;
|
}*fb = (struct framebuffer *) &_fb_base;
|
||||||
|
|||||||
@ -336,6 +336,10 @@ int sensor_snapshot(struct image *image)
|
|||||||
|
|
||||||
/* unlock framebuffer mutex */
|
/* unlock framebuffer mutex */
|
||||||
mutex_unlock(&fb->lock);
|
mutex_unlock(&fb->lock);
|
||||||
|
|
||||||
|
if (fb->lock_tried) {
|
||||||
|
systick_sleep(1);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,7 @@ void usbdbg_clr_script()
|
|||||||
{
|
{
|
||||||
script_ready =0;
|
script_ready =0;
|
||||||
vstr_reset(&script);
|
vstr_reset(&script);
|
||||||
|
fb->lock_tried=0;
|
||||||
mutex_unlock(&fb->lock);
|
mutex_unlock(&fb->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +129,9 @@ void usbdbg_control(void *buffer, uint8_t request, uint16_t length)
|
|||||||
((uint8_t*)buffer)[0] = 0;
|
((uint8_t*)buffer)[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
// try to lock FB, return 1 if locked
|
// try to lock FB, return 1 if locked
|
||||||
((uint8_t*)buffer)[0] = mutex_try_lock(&fb->lock);
|
int locked = mutex_try_lock(&fb->lock);
|
||||||
|
fb->lock_tried = !locked;
|
||||||
|
((uint8_t*)buffer)[0] = locked;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user