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"
|
||||
extern char _fb_base;
|
||||
static struct framebuffer {
|
||||
int w;
|
||||
int h;
|
||||
int w,h;
|
||||
int bpp;
|
||||
int ready;
|
||||
mutex_t lock;
|
||||
int lock_tried;
|
||||
uint8_t pixels[];
|
||||
// Note all instances of fb point to the same memory address.
|
||||
}*fb = (struct framebuffer *) &_fb_base;
|
||||
|
||||
@ -336,6 +336,10 @@ int sensor_snapshot(struct image *image)
|
||||
|
||||
/* unlock framebuffer mutex */
|
||||
mutex_unlock(&fb->lock);
|
||||
|
||||
if (fb->lock_tried) {
|
||||
systick_sleep(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ void usbdbg_clr_script()
|
||||
{
|
||||
script_ready =0;
|
||||
vstr_reset(&script);
|
||||
fb->lock_tried=0;
|
||||
mutex_unlock(&fb->lock);
|
||||
}
|
||||
|
||||
@ -128,7 +129,9 @@ void usbdbg_control(void *buffer, uint8_t request, uint16_t length)
|
||||
((uint8_t*)buffer)[0] = 0;
|
||||
} else {
|
||||
// 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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user