mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Initialize CRC for PDM2PCM library.
This commit is contained in:
parent
e3bc2f2155
commit
a8b4fae755
@ -23,6 +23,7 @@
|
|||||||
#define RAISE_OS_EXCEPTION(msg) nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, msg))
|
#define RAISE_OS_EXCEPTION(msg) nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, msg))
|
||||||
#define SAI_MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
#define SAI_MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||||
|
|
||||||
|
static CRC_HandleTypeDef hcrc;
|
||||||
static SAI_HandleTypeDef hsai;
|
static SAI_HandleTypeDef hsai;
|
||||||
static DMA_HandleTypeDef hdma_sai_rx;
|
static DMA_HandleTypeDef hdma_sai_rx;
|
||||||
|
|
||||||
@ -131,6 +132,18 @@ static mp_obj_t py_audio_init()
|
|||||||
NVIC_SetPriority(AUDIO_SAI_DMA_IRQ, IRQ_PRI_DMA21);
|
NVIC_SetPriority(AUDIO_SAI_DMA_IRQ, IRQ_PRI_DMA21);
|
||||||
HAL_NVIC_EnableIRQ(AUDIO_SAI_DMA_IRQ);
|
HAL_NVIC_EnableIRQ(AUDIO_SAI_DMA_IRQ);
|
||||||
|
|
||||||
|
// Init CRC for the PDM library
|
||||||
|
hcrc.Instance = CRC;
|
||||||
|
hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;
|
||||||
|
hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;
|
||||||
|
hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
|
||||||
|
hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
|
||||||
|
hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
|
||||||
|
if (HAL_CRC_Init(&hcrc) != HAL_OK) {
|
||||||
|
RAISE_OS_EXCEPTION("Failed to initialize CRC!");
|
||||||
|
}
|
||||||
|
__HAL_CRC_DR_RESET(&hcrc);
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -337,6 +337,17 @@ void HAL_SAI_MspDeInit(SAI_HandleTypeDef* hsai)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc)
|
||||||
|
{
|
||||||
|
__HAL_RCC_CRC_CLK_ENABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HAL_CRC_MspDeInit(CRC_HandleTypeDef* hcrc)
|
||||||
|
{
|
||||||
|
__HAL_RCC_CRC_CLK_DISABLE();
|
||||||
|
}
|
||||||
|
|
||||||
void HAL_MspDeInit(void)
|
void HAL_MspDeInit(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user