Core2 for AWS IoT EduKit BSP  1.3.0
Speaker

This library provides convenience functions to interact with the on-board speaker. The NS4168 amplifier powers the on-board speaker and communicates with the ESP32-D0WD microcontroller over I2S. The amplifier and the microphone share a GPIO and therefore, only one of them can be used at one time. You must de-initialize one if you intend to use the other.

Circuit Block Diagram for the speaker powered by the NS4168 1w amplifier

To enable this feature using KConfig, use the command pio run --environment core2foraws --target menuconfig from within the root of the project directory in your PlatformIO terminal window and go to the menu Component Config --> Core2 for AWS hardware enable to set the features you want to enable.

Example

The following example intializes and enables the speaker and plays a very brief sound buffer.

Microphone_Deinit(); /* If the microphone was initialized, be sure to deinit it first. */
const unsigned char * sound = [0x01,0x00,0xff,0xff,0x01,0x00,0xff,0xff,0x01,0x00,0xff,0xff,0xff,0xff,0xff,0xff];
Speaker_WriteBuff((uint8_t*)sound, 16, portMAX_DELAY);
void Core2ForAWS_Speaker_Enable(uint8_t state)
Enables or disables the NS4168 speaker amplifier.
Definition: core2forAWS.c:137
void Microphone_Deinit()
De-initializes the microphone over I2S.
Definition: microphone.c:37
void Speaker_Init()
Initializes the speaker over I2S.
Definition: speaker.c:12
void Speaker_Deinit()
De-initializes the speaker.
Definition: speaker.c:48
void Speaker_WriteBuff(uint8_t *buff, uint32_t len, uint32_t timeout)
Plays buffer through the speaker.
Definition: speaker.c:43

Functions