mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #1065 from openmv/framebuffer_init
Move framebuffer initialization to framebuffer.c
This commit is contained in:
commit
0385d70959
@ -70,6 +70,28 @@ void fb_encode_for_ide(uint8_t *ptr, image_t *img)
|
||||
*ptr++ = 0xFE;
|
||||
}
|
||||
|
||||
void framebuffer_init0()
|
||||
{
|
||||
// Save fb_enabled flag state
|
||||
int fb_enabled = JPEG_FB()->enabled;
|
||||
|
||||
// Clear framebuffers
|
||||
memset(MAIN_FB(), 0, sizeof(*MAIN_FB()));
|
||||
memset(JPEG_FB(), 0, sizeof(*JPEG_FB()));
|
||||
|
||||
// Skip the first frame.
|
||||
MAIN_FB()->bpp = -1;
|
||||
|
||||
// Enable streaming.
|
||||
MAIN_FB()->streaming_enabled = true; // controlled by the OpenMV Cam.
|
||||
|
||||
// Set default quality
|
||||
JPEG_FB()->quality = ((JPEG_QUALITY_HIGH - JPEG_QUALITY_LOW) / 2) + JPEG_QUALITY_LOW;
|
||||
|
||||
// Set fb_enabled
|
||||
JPEG_FB()->enabled = fb_enabled; // controlled by the IDE.
|
||||
}
|
||||
|
||||
void framebuffer_initialize_image(image_t *img)
|
||||
{
|
||||
img->w = framebuffer->w;
|
||||
|
||||
@ -46,6 +46,8 @@ bool fb_get_streaming_enabled();
|
||||
int fb_encode_for_ide_new_size(image_t *img);
|
||||
void fb_encode_for_ide(uint8_t *ptr, image_t *img);
|
||||
|
||||
void framebuffer_init0();
|
||||
|
||||
// Initializes an image_t struct with the frame buffer.
|
||||
void framebuffer_initialize_image(image_t *img);
|
||||
|
||||
|
||||
@ -78,6 +78,8 @@
|
||||
#endif
|
||||
|
||||
#include "usbdbg.h"
|
||||
#include "framebuffer.h"
|
||||
#include "omv_boardconfig.h"
|
||||
|
||||
uint32_t HAL_GetHalVersion()
|
||||
{
|
||||
@ -166,6 +168,8 @@ soft_reset:
|
||||
uart_init0();
|
||||
#endif
|
||||
|
||||
framebuffer_init0();
|
||||
|
||||
#if (MICROPY_PY_BLE_NUS == 0) && (MICROPY_HW_USB_CDC == 0)
|
||||
{
|
||||
mp_obj_t args[2] = {
|
||||
|
||||
@ -500,6 +500,7 @@ soft_reset:
|
||||
spi_init0();
|
||||
uart_init0();
|
||||
sensor_init0();
|
||||
framebuffer_init0();
|
||||
fb_alloc_init0();
|
||||
#ifdef IMLIB_ENABLE_IMAGE_IO
|
||||
file_buffer_init0();
|
||||
|
||||
@ -233,24 +233,6 @@ void sensor_init0()
|
||||
{
|
||||
dcmi_abort();
|
||||
|
||||
// Save fb_enabled flag state
|
||||
int fb_enabled = JPEG_FB()->enabled;
|
||||
|
||||
// Clear framebuffers
|
||||
memset(MAIN_FB(), 0, sizeof(*MAIN_FB()));
|
||||
memset(JPEG_FB(), 0, sizeof(*JPEG_FB()));
|
||||
|
||||
// Skip the first frame.
|
||||
MAIN_FB()->bpp = -1;
|
||||
|
||||
// Enable streaming.
|
||||
MAIN_FB()->streaming_enabled = true; // controlled by the OpenMV Cam.
|
||||
|
||||
// Set default quality
|
||||
JPEG_FB()->quality = ((JPEG_QUALITY_HIGH - JPEG_QUALITY_LOW) / 2) + JPEG_QUALITY_LOW;
|
||||
|
||||
// Set fb_enabled
|
||||
JPEG_FB()->enabled = fb_enabled; // controlled by the IDE.
|
||||
#ifdef PORTENTA
|
||||
// The Portenta board uses the same I2C bus for the sensor and
|
||||
// user scripts. The I2C bus must be reinitialized on soft-reset.
|
||||
|
||||
@ -180,6 +180,7 @@ int main()
|
||||
#endif
|
||||
|
||||
sensor_init0();
|
||||
framebuffer_init0();
|
||||
fb_alloc_init0();
|
||||
|
||||
// Initialize the sensor
|
||||
|
||||
Loading…
Reference in New Issue
Block a user