Mozzi  version v1.1.0
sound synthesis library for Arduino
mozzi_analog.cpp
1 /*
2  * mozzi_analog.cpp
3  *
4  * Copyright 2012 Tim Barrass.
5  *
6  * This file is part of Mozzi.
7  *
8  * Mozzi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
9  *
10  */
11 
12 
13 #include "mozzi_config.h"
14 #include "mozzi_analog.h"
15 
16 #include "hardware_defines.h"
17 
18 /** NOTE: Since analog input code is heavily hardware dependent, and also heavily interweaved with AUDIO_INPUT,
19  * it was moved to MozziGuts.cpp / MozziGuts_impl_XYZ.hpp for better maintainability.
20  *
21  * TODO: The (dis|re)connect functions below remain for now, as I'm not sure what to do about them. They were only ever
22  * implemented for AVR.
23  */
24 
25 void disconnectDigitalIn(uint8_t channel_num){
26 #if IS_AVR()
27  DIDR0 |= 1<<channel_num;
28 #endif
29 }
30 
31 
32 void reconnectDigitalIn(uint8_t channel_num){
33 #if IS_AVR()
34  DIDR0 &= ~(1<<channel_num);
35 #endif
36 }
37 
38 
40 #if IS_AVR()
41  for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
42  DIDR0 |= 1<<i;
43  }
44 #endif
45 }
46 
47 
49 #if IS_AVR()
50  for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
51  DIDR0 &= ~(1<<i);
52  }
53 #endif
54 }
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...
#define IS_AVR()
void disconnectDigitalIn(uint8_t channel_num)
Prepare an analog input channel by turning off its digital input buffer.
void adcDisconnectAllDigitalIns()
Prepare all analog input channels by turning off their digital input buffers.