13 #ifndef MOZZI_ANALOG_H_
14 #define MOZZI_ANALOG_H_
18 #include "hardware_defines.h"
21 enum ANALOG_READ_SPEED {FAST_ADC,FASTER_ADC,FASTEST_ADC};
59 void setupMozziADC(int8_t speed=FAST_ADC);
88 DIDR0 |= 1<<channel_num;
101 DIDR0 &= ~(1<<channel_num);
113 for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
126 for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
141 void adcStartConversion(uint8_t channel);
154 #if defined(FOR_DOXYGEN_ONLY) || defined(MOZZI_ANALOG_READ_RESOLUTION)
174 inline uint16_t
mozziAnalogRead(uint8_t pin) {
return mozziAnalogRead<MOZZI_ANALOG_READ_RESOLUTION>(pin); }
176 MOZZI_DEPRECATED(
"2.0",
"This use of mozziAnalogRead() is not portable. Refer to the API documentation for suggested alternatives.") inline uint16_t
mozziAnalogRead(uint8_t pin) {
return mozziAnalogRead<MOZZI__INTERNAL_ANALOG_READ_RESOLUTION>(pin); }
179 uint8_t adcPinToChannelNum(uint8_t pin);
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 adcDisconnectAllDigitalIns()
Prepare all analog input channels by turning off their digital input buffers.
void disconnectDigitalIn(uint8_t channel_num)
Prepare an analog input channel by turning off its digital input buffer.
void adcReconnectAllDigitalIns()
Reconnect the digital input buffers for analog input channels which have been set for analog input wi...
uint16_t mozziAnalogRead(uint8_t pin)
See mozziAnalogRead().
void setupFastAnalogRead(int8_t speed=FAST_ADC)
This is automatically called in startMozzi.
uint16_t mozziAnalogRead16(uint8_t pin)
See mozziAnalogRead() but always returns the value shifted to 16 bit range.