Speaker driver API.
More...
Speaker driver API.
uint32_t drv_speaker_ble_pcm_play |
( |
uint8_t * |
p_sound, |
|
|
uint32_t |
length |
|
) |
| |
Play an 8-bit 8kHz 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. |
uint32_t drv_speaker_flash_pcm_play |
( |
uint8_t const *const |
p_sound, |
|
|
uint32_t |
size |
|
) |
| |
Play an 8-bit 8kHz 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. |
Initializes 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. |
uint32_t drv_speaker_sample_play |
( |
uint8_t |
sample_id | ) |
|
Play one of the prestored samples. 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. |
uint32_t drv_speaker_tone_start |
( |
uint16_t |
freq_hz, |
|
|
uint32_t |
duration_ms, |
|
|
uint8_t |
volume |
|
) |
| |
Plays 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. |