Pulse Density Modulation (PDM) peripheral driver.
More...
|
#define | NRFX_PDM_MAX_BUFFER_SIZE 32767 |
| Maximum supported PDM buffer size.
|
|
#define | NRFX_PDM_DEFAULT_CONFIG(_pin_clk, _pin_din) |
| PDM driver default configuration.
|
|
Pulse Density Modulation (PDM) peripheral driver.
◆ NRFX_PDM_DEFAULT_CONFIG
#define NRFX_PDM_DEFAULT_CONFIG |
( |
|
_pin_clk, |
|
|
|
_pin_din |
|
) |
| |
Value:{ \
.clk_pin = _pin_clk, \
.din_pin = _pin_din, \
.interrupt_priority = NRFX_PDM_DEFAULT_CONFIG_IRQ_PRIORITY, \
}
#define NRF_PDM_HAS_RATIO_CONFIG
Symbol indicating whether ratio configuration is available.
Definition: nrf_pdm.h:31
#define NRF_PDM_GAIN_DEFAULT
Default value of PDM gain.
Definition: nrf_pdm.h:54
#define NRF_PDM_HAS_MCLKCONFIG
Symbol indicating whether master clock source configuration is available.
Definition: nrf_pdm.h:24
@ NRF_PDM_MCLKSRC_PCLK32M
32MHz peripheral clock.
Definition: nrf_pdm.h:143
@ NRF_PDM_FREQ_1032K
PDM_CLK = 1.032 MHz.
Definition: nrf_pdm.h:102
@ NRF_PDM_RATIO_64X
Ratio of 64.
Definition: nrf_pdm.h:120
@ NRF_PDM_EDGE_LEFTFALLING
Left (or mono) is sampled on falling edge of PDM_CLK.
Definition: nrf_pdm.h:135
@ NRF_PDM_MODE_MONO
Sample and store two successive Left samples (16 bit each) per RAM word.
Definition: nrf_pdm.h:129
PDM driver default configuration.
This configuration sets up PDM with the following options:
- mono mode
- data sampled on the clock falling edge
- frequency: 1.032 MHz
- standard gain
- Parameters
-
[in] | _pin_clk | CLK output pin. |
[in] | _pin_din | DIN input pin. |
◆ nrfx_pdm_event_handler_t
typedef void(* nrfx_pdm_event_handler_t) (nrfx_pdm_evt_t const *p_evt) |
Handler for the PDM interface ready events.
This event handler is called on a buffer request, an error or when a buffer is full and ready to be processed.
- Parameters
-
[in] | p_evt | Pointer to the PDM event structure. |
◆ nrfx_pdm_error_t
PDM error type.
Enumerator |
---|
NRFX_PDM_NO_ERROR | No error.
|
NRFX_PDM_ERROR_OVERFLOW | Overflow error.
|
◆ nrfx_pdm_buffer_set()
nrfx_err_t nrfx_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
-
NRFX_SUCCESS | The buffer was applied successfully. |
NRFX_ERROR_BUSY | The buffer was already supplied or the peripheral is currently being stopped. |
NRFX_ERROR_INVALID_STATE | The driver was not initialized. |
NRFX_ERROR_INVALID_PARAM | Invalid parameters were provided. |
◆ nrfx_pdm_enable_check()
NRFX_STATIC_INLINE bool nrfx_pdm_enable_check |
( |
void |
| ) |
|
Function for getting the state of the PDM interface.
- Return values
-
true | The PDM interface is enabled. |
false | The PDM interface is disabled. |
◆ nrfx_pdm_init()
Function for initializing the PDM interface.
- Parameters
-
[in] | p_config | Pointer to the structure with the initial configuration. |
[in] | event_handler | Event handler provided by the user. Cannot be NULL. |
- Return values
-
NRFX_SUCCESS | Initialization was successful. |
NRFX_ERROR_ALREADY | The driver is already initialized. |
NRFX_ERROR_INVALID_STATE | The driver is already initialized. Deprecated - use NRFX_ERROR_ALREADY instead. |
NRFX_ERROR_INVALID_PARAM | Invalid configuration was specified. |
◆ nrfx_pdm_init_check()
bool nrfx_pdm_init_check |
( |
void |
| ) |
|
Function for checking if the PDM interface is initialized.
- Return values
-
true | Interface is already initialized. |
false | Interface is not initialized. |
◆ nrfx_pdm_reconfigure()
Function for reconfiguring the PDM interface.
- Parameters
-
[in] | p_config | Pointer to the structure with the configuration. |
- Return values
-
NRFX_SUCCESS | Reconfiguration was successful. |
NRFX_ERROR_BUSY | There is ongoing sampling and driver cannot be reconfigured. |
NRFX_ERROR_INVALID_STATE | The driver is not initialized. |
NRFX_ERROR_INVALID_PARAM | Invalid configuration was specified. |
◆ nrfx_pdm_start()
Function for starting the PDM sampling.
- Return values
-
NRFX_SUCCESS | Sampling was started successfully or was already in progress. |
NRFX_ERROR_BUSY | Previous start/stop operation is in progress. |
◆ nrfx_pdm_stop()
Function for stopping the 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
-
NRFX_SUCCESS | Sampling was stopped successfully or was already stopped before. |
NRFX_ERROR_BUSY | Previous start/stop operation is in progress. |
◆ nrfx_pdm_task_address_get()
NRFX_STATIC_INLINE uint32_t nrfx_pdm_task_address_get |
( |
nrf_pdm_task_t |
task | ) |
|
Function for getting the address of a PDM interface task.
- Parameters
-
- Returns
- Task address.
◆ nrfx_pdm_uninit()
void nrfx_pdm_uninit |
( |
void |
| ) |
|
Function for uninitializing the PDM interface.
This function stops PDM sampling, if it is in progress.