final, working project
Dependencies: C12832 EthernetInterface HTTPClient Speaker USBDevice mbed-rtos mbed
Revision 3:2f7b22ffcf23, committed 2016-02-12
- Comitter:
- RiiQQe
- Date:
- Fri Feb 12 13:12:58 2016 +0000
- Parent:
- 2:59edfc0fd52f
- Parent:
- 1:795e03f7afa8
- Commit message:
- mergefix;
Changed in this revision
diff -r 59edfc0fd52f -r 2f7b22ffcf23 main.cpp --- a/main.cpp Fri Feb 12 13:11:08 2016 +0000 +++ b/main.cpp Fri Feb 12 13:12:58 2016 +0000 @@ -20,42 +20,8 @@ $accessTokenSecret = 'SXM05FPIW9SUgTYYgpk4buPcypwXIsLDIY3TRns01WRJP'; */ -// frequency: 48 kHz -#define FREQ 48000 - -// 1 channel: mono -#define NB_CHA 1 - -// Length of an audio packet: each ms, we receive 48 * 16bits ->48 * 2 bytes. As there is one channel, the length will be 48 * 2 * 1 -#define AUDIO_LENGTH_PACKET 48 * 2 * 1 - Serial pc(USBTX, USBRX); -//Variables for audio streaming - -// USBAudio -//USBAudio audio(FREQ, NB_CHA, 8000, 1, 0x7180, 0x7500); - - - -// Ticker to send data to the speaker at the required frequency -Ticker tic; - -// Buffer where one audio packet will be stored (LENGTH_AUDIO_PACKET/2 because we are storing int16 and not uint8) -int16_t buf2[AUDIO_LENGTH_PACKET/2]; - -// Show if an audio packet is available -volatile bool available = false; - -// Index of the value which will be send to the speaker -int index_buf = 0; - -// Previous value sent to the speaker -uint16_t p_val = 0; - -// Speaker connected to the AnalogOut output. The audio stream received over USb will be sent to the speaker -AnalogOut speaker(p18); - DigitalIn button(p14); EthernetInterface eth;