LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
Audio Card Firmware

Firmware for the LCC Fusion Audio Card. More...

Classes

class  AudioDevice
 Class to handle audio synthesis and playback using the MAX98357A DAC. More...
 

Macros

#define WEB_SSID   "LCC_Fusion_AUDIO_Card"
 Web Serial SSID used when Web Serial is enabled.
 
#define BT_DEVICE_NAME   "LCC Fusion Audio Card"
 Bluetooth device name used when Bluetooth serial is enabled.
 

Functions

void setupHelpCallback ()
 Install the help‐text callback for the Audio Card commands. More...
 
void setupTestCallback ()
 Install the test callback for the Audio Card commands.
 
void setupProgramCallback ()
 Install the progam callback for the Card commands.
 
void setupCallbacks ()
 Register all command callback handlers with SerialIO. More...
 
void getCommand ()
 Parse an incoming SerialIO command and extract arguments. More...
 
void processCommand ()
 Execute the previously parsed command. More...
 
void selfTestPins ()
 Perform a pin connectivity test for all hardware interfaces. More...
 
void initSerialComm ()
 Initialize SerialIO for multi‑transport communication. More...
 
void setup ()
 Arduino setup routine for the Audio Card firmware. More...
 
void loop ()
 Main loop: poll for complete packets and dispatch commands.
 

Variables

static constexpr uint8_t I2C_ADDR_OFFSET_PIN_SET [3] = { 27, 26, 25 }
 GPIO pins used for I2C address selection DIP switches. More...
 
static constexpr uint8_t I2C_SDA_PIN = 12
 Default I2C SDA pin (ESP32 I2C bus 0).
 
static constexpr uint8_t I2C_SCL_PIN = 14
 Default I2C SCL pin (ESP32 I2C bus 0).
 
static int AudioDevice::volume_ = 100
 Master output volume as a percentage (0–100). More...
 
static const char * AudioDevice::languages_ [10]
 Table of supported eSpeak voice identifiers. More...
 
static const char * AudioDevice::language_ = AudioDevice::languages_[0]
 Pointer to the current eSpeak voice code (e.g., "en", "fr"). More...
 

Detailed Description

Firmware for the LCC Fusion Audio Card.

High-level overview and links to the main entry points (setup/loop) and helper functions used by the Audio firmware.

Function Documentation

◆ getCommand()

void getCommand ( )

Parse an incoming SerialIO command and extract arguments.

Reads a complete packet from SerialIO, tokenizes the command string into its constituent parts (command letter, device number, optional language ID, and volume), validates them, and stores the results in module‑level variables. Sets the isCommand flag when a valid command is parsed. Invalid commands result in an error message sent via SerialIO.

Definition at line 147 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initSerialComm()

void initSerialComm ( )

Initialize SerialIO for multi‑transport communication.

Configures the g_serialIO object for operation as an I2C slave at the defined base address and applies the configured I2C pins and DIP switch offsets. Enables concurrent use of UART, I2C, Bluetooth and WebSerial transports.

Definition at line 239 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processCommand()

void processCommand ( )

Execute the previously parsed command.

Based on the value of cmdType set by getCommand(), dispatches to the appropriate AudioDevice method: AudioDevice::playText() for text‑to‑speech or AudioDevice::playWav() for WAV playback. Unknown commands are reported via the serial interface.

Definition at line 190 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selfTestPins()

void selfTestPins ( )

Perform a pin connectivity test for all hardware interfaces.

Uses the PstTestPins facility to verify that each I2S, SPI, and I2C pin can be toggled or read as expected. Diagnostic messages identifying each pin and its function are printed via SerialIO.

Definition at line 214 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup()

void setup ( )

Arduino setup routine for the Audio Card firmware.

Initialize system: Serial, SPIFFS, players, and input interfaces.

Initializes the hardware serial port, verifies that the card's hardware ID matches the expected Audio Card ID, configures the SerialIO layer, reports startup information, initializes each AudioDevice instance, and registers all command callbacks.

Definition at line 254 of file Audio_Card.ino.

Here is the call graph for this function:

◆ setupCallbacks()

void setupCallbacks ( )

Register all command callback handlers with SerialIO.

Calls setupHelpCallback(), setupTestCallback(), and setupProgramCallback() to register the help, test, and program handlers. Must be invoked after SerialIO has been initialized.

Definition at line 132 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupHelpCallback()

void setupHelpCallback ( )

Install the help‐text callback for the Audio Card commands.

Install the help‐text callback for the Sound Card commands.

Definition at line 79 of file Audio_Card.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ I2C_ADDR_OFFSET_PIN_SET

constexpr uint8_t I2C_ADDR_OFFSET_PIN_SET[3] = { 27, 26, 25 }
staticconstexpr

GPIO pins used for I2C address selection DIP switches.

Each pin contributes a bit (pin1=+1, pin2=+2, pin3=+4) relative to base address. These pins must be configured with internal pull-ups; DIP switch grounds pin when closed.

Definition at line 67 of file config.h.

◆ language_

const char * AudioDevice::language_ = AudioDevice::languages_[0]
staticprivate

Pointer to the current eSpeak voice code (e.g., "en", "fr").

This points into the languages_ array and is updated by setLanguage().

Definition at line 304 of file AudioDevice.h.

◆ languages_

const char * AudioDevice::languages_
staticprivate
Initial value:
= {
"en", "es", "fr", "de", "it", "pt", "ru", "zh", "ja", "ko"
}

Table of supported eSpeak voice identifiers.

The array is indexed by the numeric language ID passed to setLanguage(). Invalid indices default to index 0 ("en").

Definition at line 311 of file AudioDevice.h.

◆ volume_

int AudioDevice::volume_ = 100
staticprivate

Master output volume as a percentage (0–100).

All synthesized and streamed audio samples are scaled by this value before being written to the DAC. A value of 100 sends samples at full scale; lower values attenuate the output linearly.

Definition at line 297 of file AudioDevice.h.