思澈科技软件开发工具包  2.20

Pulse Density Modulation. More...

Modules

 PDM Error Code
 

Data Structures

struct  PDM_InitTypeDef
 
struct  PDM_HandleTypeDef
 

Macros

#define __HAL_PDM_ENABLE(__HANDLE__)   SET_BIT((__HANDLE__)->Instance->CFG0, PDM_CFG0_PDMCOREEN)
 
#define __HAL_PDM_DISABLE(__HANDLE__)   CLEAR_BIT((__HANDLE__)->Instance->CFG0, PDM_CFG0_PDMCOREEN)
 
#define __HAL_PDM_ENABLE_IT(__HANDLE__, __INTERRUPT__)   CLEAR_BIT((__HANDLE__)->Instance->INT_MSK, (__INTERRUPT__))
 
#define __HAL_PDM_DISABLE_IT(__HANDLE__, __INTERRUPT__)   SET_BIT((__HANDLE__)->Instance->INT_MSK, (__INTERRUPT__))
 

Enumerations

enum  PDM_StateTypeDef {
  PDM_STATE_RESET = 0x00U,
  PDM_STATE_READY = 0x01U,
  PDM_STATE_BUSY = 0x02U,
  PDM_STATE_TIMEOUT = 0x03U,
  PDM_STATE_ERROR = 0x04U,
  PDM_STATE_SUSPEND = 0x05U,
  PDM_STATE_BUSY_RX = 0X06U
}
 HAL PDM State structures definition. More...
 
enum  PDM_ModeTypeDef {
  PDM_MODE_ONCE,
  PDM_MODE_LOOP
}
 
enum  PDM_ChannelTypeDef {
  PDM_CHANNEL_LEFT_ONLY,
  PDM_CHANNEL_RIGHT_ONLY,
  PDM_CHANNEL_STEREO,
  PDM_CHANNEL_STEREO_SWAP
}
 
enum  PDM_SampleRateTypeDef {
  PDM_SAMPLE_8KHZ = 8000,
  PDM_SAMPLE_12KHZ = 12000,
  PDM_SAMPLE_16KHZ = 16000,
  PDM_SAMPLE_24KHZ = 24000,
  PDM_SAMPLE_32KHZ = 32000,
  PDM_SAMPLE_48KHZ = 48000
}
 
enum  PDM_ChannelDepthTypeDef {
  PDM_CHANNEL_DEPTH_8BIT = 8,
  PDM_CHANNEL_DEPTH_16BIT = 16,
  PDM_CHANNEL_DEPTH_24BIT = 24,
  PDM_CHANNEL_DEPTH_32BIT = 32
}
 
enum  PDM_ConfigureTypeDef {
  PDM_CFG_CHANNEL = 1,
  PDM_CFG_SAMPLERATE = 2,
  PDM_CFG_DEPTH = 4
}
 

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. More...
 
HAL_StatusTypeDef HAL_PDM_DeInit (PDM_HandleTypeDef *hpdm)
 DeInitialize the PDM peripheral. More...
 
void HAL_PDM_MspInit (PDM_HandleTypeDef *hpdm)
 Initialize the PDM MSP. More...
 
void HAL_PDM_MspDeInit (PDM_HandleTypeDef *hpdm)
 De-Initialize the PDM MSP. More...
 
HAL_StatusTypeDef HAL_PDM_Set_Gain (PDM_HandleTypeDef *hpdm, PDM_ChannelTypeDef channel, uint8_t value)
 Set recieve gain. More...
 
HAL_StatusTypeDef HAL_PDM_Config (PDM_HandleTypeDef *hpdm, PDM_ConfigureTypeDef type)
 Configure PDM parameters. More...
 
HAL_StatusTypeDef HAL_PDM_Receive_DMA (PDM_HandleTypeDef *hpdm, uint8_t *pData, uint32_t Size)
 Read PCM data from PDM module by DMA. More...
 
HAL_StatusTypeDef HAL_PDM_DMAStop (PDM_HandleTypeDef *hpdm)
 Stop the DMA Transfer. More...
 
void HAL_PDM_IRQHandler (PDM_HandleTypeDef *hpdm)
 General PDM interrupt handler. More...
 
void HAL_PDM_RxHalfCpltCallback (PDM_HandleTypeDef *hpdm)
 Rx Half Transfer completed callback. More...
 
void HAL_PDM_RxCpltCallback (PDM_HandleTypeDef *hpdm)
 Rx Transfer completed callback. More...
 
void HAL_PDM_ErrorCallback (PDM_HandleTypeDef *hpdm)
 PDM error callback. More...
 
void HAL_PDM_AbortCpltCallback (PDM_HandleTypeDef *hpdm)
 PDM Abort Complete callback. More...
 

Detailed Description

Pulse Density Modulation.

Enumeration Type Documentation

◆ PDM_ChannelDepthTypeDef

Enumerator
PDM_CHANNEL_DEPTH_8BIT 

PDM sample channel depth 8 bits

PDM_CHANNEL_DEPTH_16BIT 

PDM sample channel depth 16bits

PDM_CHANNEL_DEPTH_24BIT 

PDM sample channel depth 24bits

PDM_CHANNEL_DEPTH_32BIT 

PDM sample channel depth 32bits

◆ PDM_ChannelTypeDef

Enumerator
PDM_CHANNEL_LEFT_ONLY 

Only Left channel

PDM_CHANNEL_RIGHT_ONLY 

Only Right channel

PDM_CHANNEL_STEREO 

Both left&right channel

PDM_CHANNEL_STEREO_SWAP 

Stereo and swap left & right channel

◆ PDM_ConfigureTypeDef

Enumerator
PDM_CFG_CHANNEL 

Configure PDM channel

PDM_CFG_SAMPLERATE 

Configure PDM Sample Rate

PDM_CFG_DEPTH 

Configure PDM depth

◆ PDM_ModeTypeDef

Enumerator
PDM_MODE_ONCE 

PDM stopped when reached end of buffer

PDM_MODE_LOOP 

PDM wirte wrap around

◆ PDM_SampleRateTypeDef

Enumerator
PDM_SAMPLE_8KHZ 

PDM sample rate 8KHz

PDM_SAMPLE_12KHZ 

PDM sample rate 12KHz

PDM_SAMPLE_16KHZ 

PDM sample rate 16KHz

PDM_SAMPLE_24KHZ 

PDM sample rate 24KHz

PDM_SAMPLE_32KHZ 

PDM sample rate 32KHz

PDM_SAMPLE_48KHZ 

PDM sample rate 48KHz

◆ PDM_StateTypeDef

HAL PDM State structures definition.

Enumerator
PDM_STATE_RESET 

PDM not yet initialized or disabled

PDM_STATE_READY 

Peripheral Initialized and ready for use

PDM_STATE_BUSY 

An internal process is ongoing

PDM_STATE_TIMEOUT 

Timeout state

PDM_STATE_ERROR 

PDM state error

PDM_STATE_SUSPEND 

PDM process is suspended

Function Documentation

◆ HAL_PDM_AbortCpltCallback()

void HAL_PDM_AbortCpltCallback ( PDM_HandleTypeDef hpdm)

PDM Abort Complete callback.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_Config()

HAL_StatusTypeDef HAL_PDM_Config ( PDM_HandleTypeDef hpdm,
PDM_ConfigureTypeDef  type 
)

Configure PDM parameters.

Parameters
hpdmPointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
typeConfigure mode
Return values
HALstatus

◆ HAL_PDM_DeInit()

HAL_StatusTypeDef HAL_PDM_DeInit ( PDM_HandleTypeDef hpdm)

DeInitialize the PDM peripheral.

Parameters
hpdmPointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
HALstatus

◆ HAL_PDM_DMAStop()

HAL_StatusTypeDef HAL_PDM_DMAStop ( PDM_HandleTypeDef hpdm)

Stop the DMA Transfer.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
HALstatus

◆ HAL_PDM_ErrorCallback()

void HAL_PDM_ErrorCallback ( PDM_HandleTypeDef hpdm)

PDM error callback.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_Init()

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.

Parameters
hpdmPointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
HALstatus

◆ HAL_PDM_IRQHandler()

void HAL_PDM_IRQHandler ( PDM_HandleTypeDef hpdm)

General PDM interrupt handler.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None.

◆ HAL_PDM_MspDeInit()

void HAL_PDM_MspDeInit ( PDM_HandleTypeDef hpdm)

De-Initialize the PDM MSP.

Parameters
hpdmPointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_MspInit()

void HAL_PDM_MspInit ( PDM_HandleTypeDef hpdm)

Initialize the PDM MSP.

Parameters
hpdmPointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_Receive_DMA()

HAL_StatusTypeDef HAL_PDM_Receive_DMA ( PDM_HandleTypeDef hpdm,
uint8_t *  pData,
uint32_t  Size 
)

Read PCM data from PDM module by DMA.

Parameters
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)
Returns
HAL status

◆ HAL_PDM_RxCpltCallback()

void HAL_PDM_RxCpltCallback ( PDM_HandleTypeDef hpdm)

Rx Transfer completed callback.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_RxHalfCpltCallback()

void HAL_PDM_RxHalfCpltCallback ( PDM_HandleTypeDef hpdm)

Rx Half Transfer completed callback.

Parameters
hpdmpointer to a PDM_HandleTypeDef structure that contains the configuration information for the specified PDM module.
Return values
None

◆ HAL_PDM_Set_Gain()

HAL_StatusTypeDef HAL_PDM_Set_Gain ( PDM_HandleTypeDef hpdm,
PDM_ChannelTypeDef  channel,
uint8_t  value 
)

Set recieve gain.

Parameters
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
Returns