mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add JPEG mode to dcmi_config
* This also disables DCMI interrupts the second time dcmi_config is called
This commit is contained in:
parent
3f9d97c511
commit
54bf1b4334
@ -98,7 +98,7 @@ static void extclk_config(int frequency)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dcmi_config()
|
static int dcmi_config(uint32_t jpeg_mode)
|
||||||
{
|
{
|
||||||
/* DCMI configuration */
|
/* DCMI configuration */
|
||||||
DCMIHandle.Instance = DCMI;
|
DCMIHandle.Instance = DCMI;
|
||||||
@ -108,7 +108,7 @@ static int dcmi_config()
|
|||||||
DCMIHandle.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; /* Enable Hardware synchronization */
|
DCMIHandle.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; /* Enable Hardware synchronization */
|
||||||
DCMIHandle.Init.CaptureRate = DCMI_CR_ALL_FRAME; /* Capture rate all frames */
|
DCMIHandle.Init.CaptureRate = DCMI_CR_ALL_FRAME; /* Capture rate all frames */
|
||||||
DCMIHandle.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; /* Capture 8 bits on every pixel clock */
|
DCMIHandle.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B; /* Capture 8 bits on every pixel clock */
|
||||||
DCMIHandle.Init.JPEGMode = DCMI_JPEG_DISABLE; /* Disable JPEG Mode */
|
DCMIHandle.Init.JPEGMode = jpeg_mode; /* Disable JPEG Mode */
|
||||||
|
|
||||||
/* Associate the DMA handle to the DCMI handle */
|
/* Associate the DMA handle to the DCMI handle */
|
||||||
__HAL_LINKDMA(&DCMIHandle, DMA_Handle, DMAHandle);
|
__HAL_LINKDMA(&DCMIHandle, DMA_Handle, DMAHandle);
|
||||||
@ -240,7 +240,7 @@ int sensor_init()
|
|||||||
|
|
||||||
/* Configure the DCMI interface. This should be called
|
/* Configure the DCMI interface. This should be called
|
||||||
after ovxxx_init to set VSYNC/HSYNC/PCLK polarities */
|
after ovxxx_init to set VSYNC/HSYNC/PCLK polarities */
|
||||||
if (dcmi_config() != 0){
|
if (dcmi_config(DCMI_JPEG_DISABLE) != 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +359,8 @@ int sensor_snapshot(struct image *image)
|
|||||||
|
|
||||||
int sensor_set_pixformat(enum sensor_pixformat pixformat)
|
int sensor_set_pixformat(enum sensor_pixformat pixformat)
|
||||||
{
|
{
|
||||||
|
uint32_t jpeg_mode = DCMI_JPEG_DISABLE;
|
||||||
|
|
||||||
if (sensor.pixformat == pixformat) {
|
if (sensor.pixformat == pixformat) {
|
||||||
/* no change */
|
/* no change */
|
||||||
return 0;
|
return 0;
|
||||||
@ -395,16 +397,9 @@ int sensor_set_pixformat(enum sensor_pixformat pixformat)
|
|||||||
|
|
||||||
if (pixformat == PIXFORMAT_JPEG) {
|
if (pixformat == PIXFORMAT_JPEG) {
|
||||||
DCMIHandle.Init.JPEGMode = DCMI_JPEG_ENABLE;
|
DCMIHandle.Init.JPEGMode = DCMI_JPEG_ENABLE;
|
||||||
} else {
|
|
||||||
DCMIHandle.Init.JPEGMode = DCMI_JPEG_DISABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init DCMI */
|
return dcmi_config(jpeg_mode);
|
||||||
if (HAL_DCMI_Init(&DCMIHandle) != HAL_OK) {
|
|
||||||
/* Initialization Error */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int sensor_set_framesize(enum sensor_framesize framesize)
|
int sensor_set_framesize(enum sensor_framesize framesize)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user