arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Enumerations

Serial Peripheral Interface (SPI) Audio. More...

Collaboration diagram for SPI Audio:

Classes

class  SPIAudioMaster
 SPI master endpoint for remote audio sink configuration and PCM data transfer. More...
 
class  SPIAudioSlave
 SPI Audio Slave endpoint matching SPIAudioMaster protocol. More...
 
class  SPIRegAudioMaster
 SPI master which streams audio to a SPIRegAudioSlave (based on the TinySPISlave library) using its register map: it defines the AudioInfo and the mime type and writes the audio data according to the space which is reported by the available-space register. More...
 
struct  SPIRegAudioMasterConfig
 Configuration for SPIRegAudioMaster. More...
 
struct  SPIRegAudioSlaveConfig
 Configuration for SPIRegAudioSlave. More...
 

Enumerations

enum class  SPIAudioCommand : uint8_t {
  SetMime = 1 , SetAudioInfo = 2 , WriteData = 5 , GetAvailableBufferSize = 6 ,
  GetFilledBufferSize = 7 , Clear = 8
}
 SPI command ids used by SPIAudioMaster. More...
 
enum  SPIRegAudioRegister : uint8_t {
  SPIREG_NOP = 0x00 , SPIREG_AUDIO_INFO = 0x01 , SPIREG_MIME = 0x02 , SPIREG_AVAILABLE = 0x03 ,
  SPIREG_DATA = 0x10
}
 Register map shared by SPIRegAudioMaster and SPIRegAudioSlave. More...
 

Detailed Description

Serial Peripheral Interface (SPI) Audio.

Author
Phil Schatzmann

Enumeration Type Documentation

◆ SPIAudioCommand

enum class SPIAudioCommand : uint8_t
strong

SPI command ids used by SPIAudioMaster.

Frame format (master -> slave):

  • cmd: uint8_t
  • payload_len: uint16_t (little endian)
  • payload bytes

Response format (slave -> master):

  • status: uint8_t (0 = ok)
  • response_len: uint16_t (little endian)
  • response bytes
Enumerator
SetMime 
SetAudioInfo 
WriteData 
GetAvailableBufferSize 
GetFilledBufferSize 
Clear 

◆ SPIRegAudioRegister

Register map shared by SPIRegAudioMaster and SPIRegAudioSlave.

Wire protocol (compatible with the TinySPISlave RegisterMap):

  • command byte: bit7 = read, bits 0..6 = register address
  • write frame: [cmd][bytes...] (CS low .. CS high)
  • read request: [cmd|0x80][n] (n = number of bytes wanted)
  • read reply: a second frame in which the master clocks n bytes (0x00) while the slave shifts out the register content. A short pause (CS high) is required between the two frames.

Address 0 is reserved: the dummy bytes clocked by the master during the reply frame are ignored by the slave.

All multi byte values are little endian.

Enumerator
SPIREG_NOP 

Reply clocking / no operation.

SPIREG_AUDIO_INFO 

8 bytes (rw): sample_rate u32, channels u16, bits_per_sample u8, reserved

SPIREG_MIME 

32 bytes (rw): zero terminated mime type

SPIREG_AVAILABLE 

4 bytes (ro): u32 free space in the slave audio buffer in bytes

SPIREG_DATA 

stream (wo): the bytes of the frame are appended to the audio buffer