Merge pull request #961 from openmv/dcmi_irqs

Move DCMI IRQ handlers to sensor.c
This commit is contained in:
Ibrahim Abd Elkader 2020-11-13 16:45:52 +02:00 committed by GitHub
commit 86142a1f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 15 deletions

@ -1 +1 @@
Subproject commit bea4a37fcc82eb2be64ed2cde61866faba50e8c4 Subproject commit b7ddc1124da6ac0ce392982ada821c9cd8d54ffc

View File

@ -30,10 +30,10 @@
extern void __fatal_error(const char *msg); extern void __fatal_error(const char *msg);
sensor_t sensor = {0}; sensor_t sensor = {0};
TIM_HandleTypeDef TIMHandle = {0}; static TIM_HandleTypeDef TIMHandle = {0};
DMA_HandleTypeDef DMAHandle = {0}; static DMA_HandleTypeDef DMAHandle = {0};
DCMI_HandleTypeDef DCMIHandle = {0}; static DCMI_HandleTypeDef DCMIHandle = {0};
extern uint8_t _line_buf; extern uint8_t _line_buf;
static uint8_t *dest_fb = NULL; static uint8_t *dest_fb = NULL;
@ -81,6 +81,14 @@ const int resolution[][2] = {
{2592, 1944}, /* WQXGA2 */ {2592, 1944}, /* WQXGA2 */
}; };
void DCMI_IRQHandler(void) {
HAL_DCMI_IRQHandler(&DCMIHandle);
}
void DMA2_Stream1_IRQHandler(void) {
HAL_DMA_IRQHandler(DCMIHandle.DMA_Handle);
}
static int extclk_config(int frequency) static int extclk_config(int frequency)
{ {
#if (OMV_XCLK_SOURCE == OMV_XCLK_TIM) #if (OMV_XCLK_SOURCE == OMV_XCLK_TIM)
@ -203,7 +211,8 @@ static void dcmi_abort()
// This stops the DCMI hardware from generating DMA requests immediately and then stops the DMA // This stops the DCMI hardware from generating DMA requests immediately and then stops the DMA
// hardware. Note that HAL_DMA_Abort is a blocking operation. Do not use this in an interrupt. // hardware. Note that HAL_DMA_Abort is a blocking operation. Do not use this in an interrupt.
if (DCMI->CR & DCMI_CR_ENABLE) { if (DMAHandle.Instance != NULL &&
DCMI->CR & DCMI_CR_ENABLE) {
DCMI->CR &= ~DCMI_CR_ENABLE; DCMI->CR &= ~DCMI_CR_ENABLE;
HAL_DMA_Abort(&DMAHandle); HAL_DMA_Abort(&DMAHandle);
} }
@ -521,6 +530,7 @@ int sensor_reset()
// Disable VSYNC EXTI IRQ // Disable VSYNC EXTI IRQ
HAL_NVIC_DisableIRQ(DCMI_VSYNC_IRQN); HAL_NVIC_DisableIRQ(DCMI_VSYNC_IRQN);
return 0; return 0;
} }

View File

@ -42,7 +42,6 @@
#include <stm32fxxx_it.h> #include <stm32fxxx_it.h>
extern PCD_HandleTypeDef hpcd; extern PCD_HandleTypeDef hpcd;
extern DCMI_HandleTypeDef DCMIHandle;
extern void DCMI_VsyncExtiCallback(); extern void DCMI_VsyncExtiCallback();
extern TIM_HandleTypeDef TIM5_Handle; extern TIM_HandleTypeDef TIM5_Handle;
@ -157,11 +156,3 @@ void OTG_HS_IRQHandler(void)
{ {
HAL_PCD_IRQHandler(&hpcd); HAL_PCD_IRQHandler(&hpcd);
} }
void DCMI_IRQHandler(void) {
HAL_DCMI_IRQHandler(&DCMIHandle);
}
void DMA2_Stream1_IRQHandler(void) {
HAL_DMA_IRQHandler(DCMIHandle.DMA_Handle);
}