12 #ifndef MOZZI_ANALOG_H_ 13 #define MOZZI_ANALOG_H_ 21 #if (USE_AUDIO_INPUT==true) 22 #warning "Using AUDIO_INPUT_PIN defined in mozzi_config.h for audio input." 25 void adcReadSelectedChannels();
27 void startSecondControlADC();
28 void receiveSecondControlADC();
31 #if defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) 39 static const uint8_t PROGMEM adc_mapping[] = {
41 0, 1, 4, 5, 6, 7, 13, 12, 11, 10, 9, 8, 10, 11, 12, 13, 7, 6, 5, 4, 1, 0, 8
43 #define analogPinToChannel(P) ( pgm_read_byte( adc_mapping + (P) ) ) 48 #if defined(__MK20DX128__) 49 static const uint8_t channel2sc1a[] = {
50 5, 14, 8, 9, 13, 12, 6, 7, 15, 4,
51 0, 19, 3, 21, 26, 22, 23
53 #elif defined(__MK20DX256__) 54 static const uint8_t channel2sc1a[] = {
55 5, 14, 8, 9, 13, 12, 6, 7, 15, 4,
56 0, 19, 3, 19+128, 26, 18+128, 23,
57 5+192, 5+128, 4+128, 6+128, 7+128, 4+192
69 enum ANALOG_READ_SPEED {FAST_ADC,FASTER_ADC,FASTEST_ADC};
100 void setupMozziADC(int8_t speed=FAST_ADC);
162 void adcStartConversion(uint8_t channel);
180 void adcStartReadCycle();
183 uint8_t adcPinToChannelNum(uint8_t pin);
int mozziAnalogRead(uint8_t pin)
Reads the analog input of a chosen channel, without blocking other operations from running...
void adcReconnectAllDigitalIns()
Reconnect the digital input buffers for analog input channels which have been set for analog input wi...
void reconnectDigitalIn(uint8_t channel_num)
Reconnect the digital input buffer for an analog input channel which has been set for analog input wi...
void disconnectDigitalIn(uint8_t channel_num)
Prepare an analog input channel by turning off its digital input buffer.
void setupFastAnalogRead(int8_t speed=FAST_ADC)
This is automatically called in startMozzi.
void adcDisconnectAllDigitalIns()
Prepare all analog input channels by turning off their digital input buffers.