Core2 for AWS IoT EduKit BSP 1.5.1
Speaker_WriteBuff
esp_err_t Speaker_WriteBuff(uint8_t* buff, uint32_t len, uint32_t timeout);
esp_err_t Speaker_WriteBuff(uint8_t *buff, uint32_t len, uint32_t timeout)
Plays buffer through the speaker.
Definition: speaker.c:48

Plays buffer through the speaker.

Note
The speaker cannot be used at the same time as the microphone since they both share a common pin (GPIO0). Attempting to enable or use both at the same time will cause the device to hard fault.

Example:

Play a sound buffer. The audio clip is too short to be recognized and is just to serve as an example.

Microphone_Deinit(); // If the microphone was initialized, be sure to deinit it first.
const uint8_t sound[16] = [0x01,0x00,0xff,0xff,0x01,0x00,0xff,0xff,0x01,0x00,0xff,0xff,0xff,0xff,0xff,0xff];
Speaker_WriteBuff(&sound, 16, portMAX_DELAY);
void Core2ForAWS_Speaker_Enable(bool state)
Enables or disables the NS4168 speaker amplifier.
Definition: core2forAWS.c:153
void Microphone_Deinit()
De-initializes the microphone over I2S.
Definition: microphone.c:37
esp_err_t Speaker_Deinit()
De-initializes the speaker.
Definition: speaker.c:53
esp_err_t Speaker_Init()
Initializes the speaker over I2S. The I2S bus is initialized for output with a sample rate of 44100Hz...
Definition: speaker.c:12
Parameters
[out]buffThe sound buffer to play.
[in]lenLength of the buffer.
[in]timeoutUNUSED.
Returns
esp_err_t. 0 or ESP_OK if successful.