Functions
Initialization and de-initialization Functions
Peripheral Driver » HAL Driver » PDM » Functions

Initialization and Configuration functions. More...

## Functions
hal_status_t | hal_pdm_init (pdm_handle_t *p_pdm)
| Initialize the PDM according to the specified parameters in the pdm_init_t and initialize the associated handle. More...
hal_status_t | hal_pdm_deinit (pdm_handle_t *p_pdm)
| De-initialize the PDM peripheral. More...
void | hal_pdm_msp_init (pdm_handle_t *p_pdm)
| Initialize the PDM MSP. More...
void | hal_pdm_msp_deinit (pdm_handle_t *p_pdm)
| De-initialize the PDM MSP. More...
hal_status_t | hal_pdm_left_start_dma (pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length)
| Start the pdm left channel transfer with dma. More...
hal_status_t | hal_pdm_left_start_dma_sg_llp (pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
| Start the pdm right channel transfer with dma's sg and llp. More...
hal_status_t | hal_pdm_right_start_dma (pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length)
| Start the pdm right channel transfer with dma. More...
hal_status_t | hal_pdm_right_start_dma_sg_llp (pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
| Start the pdm right channel transfer with dma's sg and llp. More...
hal_status_t | hal_pdm_stereo_start_dma (pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length)
| Start the pdm dual channel transfer with dma. More...
hal_status_t | hal_pdm_stereo_start_dma_sg_llp (pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
| Start the pdm dual channel transfer with dma's sg and llp. More...
hal_status_t | hal_pdm_abort (pdm_handle_t *p_pdm)
| Abort ongoing conversion (blocking mode). More...
void | hal_pdm_irq_handler (pdm_handle_t *p_pdm)
| Handle PDM interrupt request. More...
void | hal_pdm_left_overflow_callback (pdm_handle_t *p_pdm)
| Left channel data overflow callback. More...
void | hal_pdm_right_overflow_callback (pdm_handle_t *p_pdm)
| Right channel data overflow callback. More...
void | hal_pdm_dma_cplt_callback (pdm_handle_t *p_pdm)
| Dma transfer completed callback.. More...
void | hal_pdm_dma_blk_callback (pdm_handle_t *p_pdm)
| Block transfer completed callback.. More...
void | hal_pdm_dma_error_callback (pdm_handle_t *p_pdm)
| DMA transfer error callback.. More...

## Detailed Description

Initialization and Configuration functions.

## Function Documentation

## ◆ hal_pdm_abort()

hal_status_t hal_pdm_abort | ( | pdm_handle_t * | p_pdm | ) |

Abort ongoing conversion (blocking mode).

Note
  This procedure could be only used for aborting transfer started in DMA mode. This procedure performs following operations:
  - Disable PDM clock, stop conversion
  - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode)
  - Set handle State to READY. This procedure is executed in blocking mode: when exiting function, Abort is transfered as completed.

Parameters

  [in] | p_pdm | PDM handle.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_deinit()

hal_status_t hal_pdm_deinit | ( | pdm_handle_t * | p_pdm | ) |

De-initialize the PDM peripheral.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_dma_blk_callback()

void hal_pdm_dma_blk_callback | ( | pdm_handle_t * | p_pdm | ) |

Block transfer completed callback..

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_dma_cplt_callback()

void hal_pdm_dma_cplt_callback | ( | pdm_handle_t * | p_pdm | ) |

Dma transfer completed callback..

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_dma_error_callback()

void hal_pdm_dma_error_callback | ( | pdm_handle_t * | p_pdm | ) |

DMA transfer error callback..

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_init()

hal_status_t hal_pdm_init | ( | pdm_handle_t * | p_pdm | ) |

Initialize the PDM according to the specified parameters in the pdm_init_t and initialize the associated handle.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_irq_handler()

void hal_pdm_irq_handler | ( | pdm_handle_t * | p_pdm | ) |

Handle PDM interrupt request.

Parameters

  [in] | p_pdm | Pointer to a PDM handle which contains the configuration information for the specified PDM.

## ◆ hal_pdm_left_overflow_callback()

void hal_pdm_left_overflow_callback | ( | pdm_handle_t * | p_pdm | ) |

Left channel data overflow callback.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_left_start_dma()

hal_status_t hal_pdm_left_start_dma | ( | pdm_handle_t * | p_pdm,
|  | uint16_t * | p_data,
|  | uint32_t | length
| ) |  |

Start the pdm left channel transfer with dma.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_left_start_dma_sg_llp()

hal_status_t hal_pdm_left_start_dma_sg_llp | ( | pdm_handle_t * | p_pdm,
|  | uint16_t * | p_data,
|  | uint32_t | length,
|  | dma_sg_llp_config_t * | sg_llp_config
| ) |  |

Start the pdm right channel transfer with dma's sg and llp.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.
  [in] | sg_llp_config | Config for dma llp and sg fuction.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_msp_deinit()

void hal_pdm_msp_deinit | ( | pdm_handle_t * | p_pdm | ) |

De-initialize the PDM MSP.

Note
  This function should not be modified. When the callback is needed, the hal_pdm_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_msp_init()

void hal_pdm_msp_init | ( | pdm_handle_t * | p_pdm | ) |

Initialize the PDM MSP.

Note
  This function should not be modified. When the callback is needed, the hal_pdm_msp_deinit can be implemented in the user file.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_right_overflow_callback()

void hal_pdm_right_overflow_callback | ( | pdm_handle_t * | p_pdm | ) |

Right channel data overflow callback.

Parameters

  [in] | p_pdm | Pointer to an PDM handle which contains the configuration information for the specified PDM module.

## ◆ hal_pdm_right_start_dma()

hal_status_t hal_pdm_right_start_dma | ( | pdm_handle_t * | p_pdm,
|  | uint16_t * | p_data,
|  | uint32_t | length
| ) |  |

Start the pdm right channel transfer with dma.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_right_start_dma_sg_llp()

hal_status_t hal_pdm_right_start_dma_sg_llp | ( | pdm_handle_t * | p_pdm,
|  | uint16_t * | p_data,
|  | uint32_t | length,
|  | dma_sg_llp_config_t * | sg_llp_config
| ) |  |

Start the pdm right channel transfer with dma's sg and llp.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.
  [in] | sg_llp_config | config for dma llp and sg fuction.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_stereo_start_dma()

hal_status_t hal_pdm_stereo_start_dma | ( | pdm_handle_t * | p_pdm,
|  | uint32_t * | p_data,
|  | uint32_t | length
| ) |  |

Start the pdm dual channel transfer with dma.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_pdm_stereo_start_dma_sg_llp()

hal_status_t hal_pdm_stereo_start_dma_sg_llp | ( | pdm_handle_t * | p_pdm,
|  | uint32_t * | p_data,
|  | uint32_t | length,
|  | dma_sg_llp_config_t * | sg_llp_config
| ) |  |

Start the pdm dual channel transfer with dma's sg and llp.

Parameters

  [in] | p_pdm | Pointer to an PDM handle.
  [in] | p_data | Point to the buffer that stores the data collected by PDM.
  [in] | length | Length of data buffer, ranging between 0 and 4095.
  [in] | sg_llp_config | config for dma llp and sg fuction.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.