PDA

View Full Version : Extending input_adc.h to two channel



Vipor26
04-05-2016, 07:44 PM
Hello all,

I have a quick question on https://github.com/PaulStoffregen/Audio/blob/master/input_adc.h and https://github.com/PaulStoffregen/Audio/blob/master/input_adc.cpp. Is there any reason I cannot extend this class to include both adc converters to get stereo? I cannot use the Audio Adapter with https://github.com/pixelmatix/SmartMatrix :).

Very naive initial thoughts
- init(uint8_t pin)
- were all the dirty work is done to start the adc where is the adc hardware trigger source set?
- isr(void)
- easy enough
- update(void)
- easy enough

Just naively looking at the code it looks like I just need to set up another DMA that is not already used connect it to the second adc copy past the ISR for the second channel add some logic so the AudioStream::update_all only gets called when there is new data from both channels. Then extend update to also consider the right channel.

Thoughts?

Brian