Speaker driver API.
More...
Speaker driver API.
◆ drv_speaker_ble_pcm_play()
uint32_t drv_speaker_ble_pcm_play |
( |
uint8_t * |
p_sound, |
|
|
uint32_t |
length |
|
) |
| |
Function for playing an 8-bit 8 kHz PCM encoded audio split into packages.
- Parameters
-
[in] | p_sound | Sound sample. PCM encoded, 8-bit. |
[in] | length | Length of the package. |
- Return values
-
NRF_SUCCESS | Completed successfully. |
Other | codes from underlying drivers. |
◆ drv_speaker_flash_pcm_play()
uint32_t drv_speaker_flash_pcm_play |
( |
uint8_t const *const |
p_sound, |
|
|
uint32_t |
size |
|
) |
| |
Function for playing an 8-bit 8 kHz PCM encoded audio sample.
- Parameters
-
[in] | p_sound | Sound sample. PCM encoded, 8-bit. |
[in] | size | Size of the sample. |
- Return values
-
NRF_SUCCESS | Completed successfully. |
Other | codes from underlying drivers. |
◆ drv_speaker_init()
Function for initializing the speaker driver.
- Parameters
-
[in] | p_params | Initialization parameters. |
- Return values
-
NRF_SUCCESS | Completed successfully. |
NRF_ERROR_NULL | Null pointer supplied. |
Other | codes from underlying drivers. |
◆ drv_speaker_sample_play()
uint32_t drv_speaker_sample_play |
( |
uint8_t |
sample_id | ) |
|
Function for playing one of the prestored samples. See sounds.h.
- Parameters
-
[in] | sample_id | ID of the sample to play. |
- Return values
-
NRF_ERROR_INVALID_PARAM | Invalid sample requested. |
Other | codes from underlying drivers. |
◆ drv_speaker_tone_start()
uint32_t drv_speaker_tone_start |
( |
uint16_t |
freq_hz, |
|
|
uint32_t |
duration_ms, |
|
|
uint8_t |
volume |
|
) |
| |
Function for playing a single tone through the speaker.
- Parameters
-
[in] | freq_hz | Tone frequency (>100 Hz). |
[in] | duration_ms | Tone length [ms]. |
[in] | volume | Speaker volume (0 to 100). 0 Volume will cause the function to return immediately with NRF_SUCCESS. |
- Return values
-
NRF_SUCCESS | Completed successfully. |
NRF_ERROR_NOT_SUPPORTED | Invalid parameters supplied. |