bf0_hal_pdm.h
Header file -.
- Author
- Sifli software development team 
Defines
- 
__HAL_PDM_ENABLE(__HANDLE__)
- 
__HAL_PDM_DISABLE(__HANDLE__)
- 
__HAL_PDM_ENABLE_IT(__HANDLE__, __INTERRUPT__)
- 
__HAL_PDM_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Enums
- 
enum PDM_StateTypeDef
- HAL PDM State structures definition. - Values: - 
enumerator PDM_STATE_RESET
- PDM not yet initialized or disabled 
 - 
enumerator PDM_STATE_READY
- Peripheral Initialized and ready for use 
 - 
enumerator PDM_STATE_BUSY
- An internal process is ongoing 
 - 
enumerator PDM_STATE_TIMEOUT
- Timeout state 
 - 
enumerator PDM_STATE_ERROR
- PDM state error 
 - 
enumerator PDM_STATE_SUSPEND
- PDM process is suspended 
 - 
enumerator PDM_STATE_BUSY_RX
 
- 
enumerator PDM_STATE_RESET
- 
enum PDM_ErrorTypeDef
- Values: - 
enumerator PDM_ERROR_NONE
- No error 
 - 
enumerator PDM_ERROR_OVERFLOW_L
- Left channerl receive overflow error 
 - 
enumerator PDM_ERROR_OVERFLOW_R
- Right channerl receive overflow error 
 - 
enumerator PDM_ERROR_DMA
- DMA tansfer error 
 
- 
enumerator PDM_ERROR_NONE
- 
enum PDM_ModeTypeDef
- Values: - 
enumerator PDM_MODE_ONCE
- PDM stopped when reached end of buffer 
 - 
enumerator PDM_MODE_LOOP
- PDM wirte wrap around 
 
- 
enumerator PDM_MODE_ONCE
- 
enum PDM_ChannelTypeDef
- Values: - 
enumerator PDM_CHANNEL_LEFT_ONLY
- Only Left channel 
 - 
enumerator PDM_CHANNEL_RIGHT_ONLY
- Only Right channel 
 - 
enumerator PDM_CHANNEL_STEREO
- Both left&right channel 
 - 
enumerator PDM_CHANNEL_STEREO_SWAP
- Stereo and swap left & right channel 
 
- 
enumerator PDM_CHANNEL_LEFT_ONLY
- 
enum PDM_SampleRateTypeDef
- Values: - 
enumerator PDM_SAMPLE_8KHZ
- PDM sample rate 8KHz 
 - 
enumerator PDM_SAMPLE_12KHZ
- PDM sample rate 12KHz 
 - 
enumerator PDM_SAMPLE_16KHZ
- PDM sample rate 16KHz 
 - 
enumerator PDM_SAMPLE_24KHZ
- PDM sample rate 24KHz 
 - 
enumerator PDM_SAMPLE_32KHZ
- PDM sample rate 32KHz 
 - 
enumerator PDM_SAMPLE_48KHZ
- PDM sample rate 48KHz 
 - 
enumerator PDM_SAMPLE_96KHZ
- PDM sample rate 96KHz 
 
- 
enumerator PDM_SAMPLE_8KHZ
- 
enum PDM_ChannelDepthTypeDef
- Values: - 
enumerator PDM_CHANNEL_DEPTH_8BIT
- PDM sample channel depth 8 bits 
 - 
enumerator PDM_CHANNEL_DEPTH_16BIT
- PDM sample channel depth 16bits 
 - 
enumerator PDM_CHANNEL_DEPTH_24BIT
- PDM sample channel depth 24bits 
 - 
enumerator PDM_CHANNEL_DEPTH_32BIT
- PDM sample channel depth 32bits 
 
- 
enumerator PDM_CHANNEL_DEPTH_8BIT
Functions
- 
HAL_StatusTypeDef HAL_PDM_Init(PDM_HandleTypeDef *hpdm)
- Initialize the PDM according to the specified parameters in the PDM_InitTypeDef and initialize the associated handle. - 参数:
- hpdm – Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_PDM_DeInit(PDM_HandleTypeDef *hpdm)
- DeInitialize the PDM peripheral. - 参数:
- hpdm – Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- HAL – status 
 
- 
void HAL_PDM_MspInit(PDM_HandleTypeDef *hpdm)
- Initialize the PDM MSP. - 参数:
- hpdm – Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
void HAL_PDM_MspDeInit(PDM_HandleTypeDef *hpdm)
- De-Initialize the PDM MSP. - 参数:
- hpdm – Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
HAL_StatusTypeDef HAL_PDM_Set_Gain(PDM_HandleTypeDef *hpdm, PDM_ChannelTypeDef channel, uint8_t value)
- Set recieve gain. - 参数:
- hpdm – - Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
- channel – - PDM_CHANNEL_STEREO or PDM_CHANNEL_STEREO_SWAP will set both left and right channel 
- value – - [0 ~ 255] gain value. 255 is maximum while 0 is minimum 
 
- 返回:
 
- 
HAL_StatusTypeDef HAL_PDM_Config(PDM_HandleTypeDef *hpdm, PDM_ConfigureTypeDef type)
- Configure PDM parameters. - 参数:
- hpdm – Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
- type – Configure mode 
 
- 返回值:
- HAL – status 
 
- 
HAL_StatusTypeDef HAL_PDM_Receive_DMA(PDM_HandleTypeDef *hpdm, uint8_t *pData, uint32_t Size)
- Read PCM data from PDM module by DMA. - 参数:
- hpdm – - Pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
- pData – - Buffer to save PCM data (Should be aligned to 4 bytes) 
- Size – - Buffer size in bytes (Should be aligned to 4 bytes) 
 
- 返回:
- HAL status 
 
- 
HAL_StatusTypeDef HAL_PDM_DMAStop(PDM_HandleTypeDef *hpdm)
- Stop the DMA Transfer. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- HAL – status 
 
- 
void HAL_PDM_IRQHandler(PDM_HandleTypeDef *hpdm)
- General PDM interrupt handler. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None. – 
 
- 
void HAL_PDM_RxHalfCpltCallback(PDM_HandleTypeDef *hpdm)
- Rx Half Transfer completed callback. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
void HAL_PDM_RxCpltCallback(PDM_HandleTypeDef *hpdm)
- Rx Transfer completed callback. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
void HAL_PDM_ErrorCallback(PDM_HandleTypeDef *hpdm)
- PDM error callback. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
void HAL_PDM_AbortCpltCallback(PDM_HandleTypeDef *hpdm)
- PDM Abort Complete callback. - 参数:
- hpdm – pointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module. 
 
- 返回值:
- None – 
 
- 
struct PDM_InitTypeDef
- Public Members - 
uint32_t Mode
- Specifies the PDM wirte buffer mode. This parameter can be a value of PDM_ModeTypeDef 
 - 
uint32_t Channels
- Specifies the channels PDM sample. This parameter can be a value of PDM_ChannelTypeDef 
 - 
uint32_t SampleRate
- Specifies the channel sample rate. This parameter can be a value of PDM_SampleRateTypeDef 
 - 
uint32_t ChannelDepth
- Specifies each channel sample bits. This parameter can be a value of PDM_ChannelDepthTypeDef 
 - 
int32_t LeftGain
- Left channel gain in 0.1db 
 - 
int32_t RightGain
- Right channel gain in 0.1db 
 - 
int32_t clkSrc
- clock source, from 3.072 or from 9.6 
 
- 
uint32_t Mode
- 
struct PDM_HandleTypeDef
- Public Members - 
PDM_TypeDef *Instance
 - 
PDM_InitTypeDef Init
- PDM Initialize config 
 - 
uint8_t *pRxBuffPtr
- Pointer to PDM Rx transfer Buffer 
 - 
uint16_t RxXferSize
- PDM Rx Transfer size 
 - 
DMA_HandleTypeDef *hdmarx
- PDM Rx DMA Handle parameters 
 - 
DMA_HandleTypeDef *hdmarx_r
- PDM Rx right channel DMA Handle para 
 - 
HAL_LockTypeDef Lock
- Locking object 
 - 
PDM_StateTypeDef State
- PDM State code 
 - 
uint32_t ErrorCode
- PDM Error code 
 
- 
PDM_TypeDef *Instance
