12 #ifndef MOZZI_ANALOG_H_ 13 #define MOZZI_ANALOG_H_ 23 #if (USE_AUDIO_INPUT==true) 24 #warning "Using AUDIO_INPUT_PIN defined in mozzi_config.h for audio input." 28 #if defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) 36 static const uint8_t PROGMEM adc_mapping[] = {
38 0, 1, 4, 5, 6, 7, 13, 12, 11, 10, 9, 8, 10, 11, 12, 13, 7, 6, 5, 4, 1, 0, 8
40 #define analogPinToChannel(P) ( pgm_read_byte( adc_mapping + (P) ) ) 45 #if defined(__MK20DX128__) 46 static const uint8_t channel2sc1a[] = {
47 5, 14, 8, 9, 13, 12, 6, 7, 15, 4,
48 0, 19, 3, 21, 26, 22, 23
50 #elif defined(__MK20DX256__) 51 static const uint8_t channel2sc1a[] = {
52 5, 14, 8, 9, 13, 12, 6, 7, 15, 4,
53 0, 19, 3, 19+128, 26, 18+128, 23,
54 5+192, 5+128, 4+128, 6+128, 7+128, 4+192
66 enum ANALOG_READ_SPEED {FAST_ADC,FASTER_ADC,FASTEST_ADC};
97 void setupMozziADC(int8_t speed=FAST_ADC);
159 void adcStartConversion(uint8_t channel);
175 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)
NOTE: Code needed to set up faster than usual analog reads, e.g.
void adcDisconnectAllDigitalIns()
Prepare all analog input channels by turning off their digital input buffers.