ELEC2645 (2015/16) / Mbed 2 deprecated Main_code_ver18

Dependencies:   FATFileSystem N5110_mod SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

USB audio

USB audio

Variables and functions used to act as a USB soundcard (heavily based on existing code, [see here](https://developer.mbed.org/users/samux/code/USBAUDIO_speaker/)) More...

Functions

void audio_tkr_ISR ()
 # USB audio functions

Variables

Ticker audio_tkr
 # flags & variables
int16_t USBaudio_buffer [96/2]
 buffer to contain incoming audio packets
volatile bool USBaudio_packet_available = false
 indicates availability of audio data
int USBaudio_index_buffer = 0
 indicates current position within USBaudio_buffer
uint16_t audio_prev_val = 0
 maintains previous speaker value until more data is available

Detailed Description

Variables and functions used to act as a USB soundcard (heavily based on existing code, [see here](https://developer.mbed.org/users/samux/code/USBAUDIO_speaker/))


Function Documentation

void audio_tkr_ISR (  )

# USB audio functions

ISR for audio ouput

speaker value

checks if packet is available

converts value to float

ofsets speaker value

adjusts output level

increment buffer position

checks if buffer is empty

sets speaker value to previous available value

writes speaker value to analog output

Definition at line 630 of file main.cpp.


Variable Documentation

uint16_t audio_prev_val = 0

maintains previous speaker value until more data is available

Definition at line 461 of file main.h.

Ticker audio_tkr

# flags & variables

ticker for audio output

Definition at line 453 of file main.h.

int16_t USBaudio_buffer[96/2]

buffer to contain incoming audio packets

Definition at line 455 of file main.h.

indicates current position within USBaudio_buffer

Definition at line 459 of file main.h.

volatile bool USBaudio_packet_available = false

indicates availability of audio data

Definition at line 457 of file main.h.