Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Speaker driver

Speaker driver API. More...

Data Structures

struct  drv_speaker_init_t
 Speaker driver initialization type. More...
 

Typedefs

typedef void(* drv_speaker_evt_handler_t )(drv_speaker_evt_t evt)
 Speaker driver event handler callback type.
 

Enumerations

enum  drv_speaker_evt_t
 Speaker driver event types.
 

Functions

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. More...
 
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. More...
 
uint32_t drv_speaker_init (drv_speaker_init_t *p_params)
 Initializes the speaker driver. More...
 
uint32_t drv_speaker_sample_play (uint8_t sample_id)
 Play one of the prestored samples. sounds.h. More...
 
uint32_t drv_speaker_tone_start (uint16_t freq_hz, uint32_t duration_ms, uint8_t volume)
 Plays a single tone through the speaker. More...
 

Detailed Description

Speaker driver API.

Function Documentation

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_soundSound sample. PCM encoded, 8-bit.
[in]lengthLength of the package.
Return values
NRF_SUCCESSCompleted successfully.
Othercodes 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_soundSound sample. PCM encoded, 8-bit.
[in]sizeSize of the sample.
Return values
NRF_SUCCESSCompleted successfully.
Othercodes from underlying drivers.
uint32_t drv_speaker_init ( drv_speaker_init_t p_params)

Initializes the speaker driver.

Parameters
[in]p_paramsInitialization parameters.
Return values
NRF_SUCCESSCompleted successfully.
NRF_ERROR_NULLNull pointer supplied.
Othercodes from underlying drivers.
uint32_t drv_speaker_sample_play ( uint8_t  sample_id)

Play one of the prestored samples. sounds.h.

Parameters
[in]sample_idID of the sample to play.
Return values
NRF_ERROR_INVALID_PARAMInvalid sample requested.
Othercodes 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_hzTone frequency (>100 Hz)
[in]duration_msTone length [ms]
[in]volumeSpeaker volume (0 to 100). 0 Volume will cause the function to return immediately with NRF_SUCCESS.
Return values
NRF_SUCCESSCompleted successfully.
NRF_ERROR_NOT_SUPPORTEDInvalid parameters supplied.