File
upload_play/upload_play.pde

+/*

+ (MAPLE)

+

+Based upon sine_generator in examples with addition of writing to USART while audio_codec is running too. Just outputs a count of the main loop iterations every N steps while an interupt generates the sine tone outupt.

+

+

+guest openmusiclabs 7.13.11

+this program creates a sinewave of variable frequency and

+amplitude, presented at both left and right outputs. there

+isnt any interpolation, so you only get 256 discrete frequencies

+across the span of 44Hz to 10kHz.

+

+Additional it shows how to use Serial3 USART to communicate with the board during

+processing.

+

+Hardware connections

+--------------------

+From the the maple documentaiton the USART Pin Map

+ Tx Rx Ck cts rts

+Serial3 D29 D30 D31 D32 D33

+(this also applies to the Maple RET6 edition)

+These pins are also listed as being ***5V tolerant***

+

+

+I chose Serial3 because these pins are on the 2x8 header "EXT" block which aren't

+connected to the audio codec shield.

+

+

+So I connected 3 wires to my FTDI basic board:

+ D29 (Tx) to the Rx on the FTDI basic board

+ D30 (Rx) to the Tx on the FTDI basic board

+ GND to GND on on the FTDI basic board

+

+

+

+

+*/

+

+// setup codec parameters

+// must be done before #includes

+// see readme file in libraries folder for explanations

+#define SAMPLE_RATE 44 // 44.1kHz sample rate

+#define ADCS 2 // use both ADCs

+

+// try faster 9600, 19200, 14400, 38400, 57600, 56000,

+// 115200, 128000, 230400,460800, 153600, 256000,921600

+// the FTDI 232R datasheet says it can go to 3 Mbaud

+// the stm32F103 data sheet mentioned a minimum of 2.25 Mbits/s or one at 4 Mbits/s