Pulse density modulation (PDM) interface driver.
More...
Pulse density modulation (PDM) interface driver.
#define NRF_DRV_PDM_DEFAULT_CONFIG |
( |
|
PIN_CLK, |
|
|
|
PIN_DIN |
|
) |
| |
Value:{ \
.pin_clk = PIN_CLK, \
.pin_din = PIN_DIN, \
.gain_l = NRF_PDM_GAIN_DEFAULT, \
.gain_r = NRF_PDM_GAIN_DEFAULT, \
}
Macro for setting nrf_drv_pdm_config_t to default settings in single ended mode.
- Parameters
-
PIN_CLK | CLK output pin. |
PIN_DIN | DIN input pin. |
Handler for PDM interface ready events.
This event handler is called on buffer request, error or when a buffer is full and ready to be processed.
- Parameters
-
[in] | evt | Pointer to the PDM event structure. |
ret_code_t nrf_drv_pdm_buffer_set |
( |
int16_t * |
buffer, |
|
|
uint16_t |
buffer_length |
|
) |
| |
Function for supplying the sample buffer.
Call this function after every buffer request event.
- Parameters
-
[in] | buffer | Pointer to the receive buffer. Cannot be NULL. |
[in] | buffer_length | Length of the receive buffer in 16-bit words. |
- Return values
-
NRF_SUCCESS | If the buffer was applied successfully. |
NRF_ERROR_BUSY | If the buffer was already supplied or the peripheral is currently being stopped. |
NRF_ERROR_INVALID_STATE | If the driver was not initialized. |
NRF_ERROR_INVALID_PARAM | If invalid parameters were provided. |
__STATIC_INLINE bool nrf_drv_pdm_enable_check |
( |
| ) |
|
Function for getting the state of the PDM interface.
- Return values
-
TRUE | If the PDM interface is enabled. |
FALSE | If the PDM interface is disabled. |
Function for initializing the PDM interface.
- Parameters
-
[in] | p_config | Pointer to a configuration structure. Cannot be NULL. |
[in] | event_handler | Event handler provided by the user. Cannot be NULL. |
- Return values
-
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR_INVALID_STATE | If the driver is already initialized. |
NRF_ERROR_INVALID_PARAM | If invalid parameters were specified. |
Function for starting PDM sampling.
- Return values
-
NRF_SUCCESS | If sampling was started successfully or was already in progress. |
NRF_ERROR_BUSY | If a previous start/stop operation is in progress. |
Function for stopping PDM sampling.
When this function is called, the PDM interface is stopped after finishing the current frame. The event handler function might be called once more after calling this function.
- Return values
-
NRF_SUCCESS | If sampling was stopped successfully or was already stopped before. |
NRF_ERROR_BUSY | If a previous start/stop operation is in progress. |
__STATIC_INLINE uint32_t nrf_drv_pdm_task_address_get |
( |
nrf_pdm_task_t |
task | ) |
|
Function for getting the address of a PDM interface task.
- Parameters
-
- Returns
- Task address.
void nrf_drv_pdm_uninit |
( |
void |
| ) |
|
Function for uninitializing the PDM interface.
This function stops PDM sampling, if it is in progress.