forked from sensorium/Mozzi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmozzi_analog.cpp
More file actions
56 lines (43 loc) · 1.08 KB
/
mozzi_analog.cpp
File metadata and controls
56 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* mozzi_analog.cpp
*
* Copyright 2012 Tim Barrass.
*
* This file is part of Mozzi.
*
* Mozzi is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
*
*/
#include "mozzi_config.h"
#include "mozzi_analog.h"
#include "hardware_defines.h"
/** NOTE: Since analog input code is heavily hardware dependent, and also heavily interweaved with AUDIO_INPUT,
* it was moved to MozziGuts.cpp / MozziGuts_impl_XYZ.hpp for better maintainability.
*
* TODO: The (dis|re)connect functions below remain for now, as I'm not sure what to do about them. They were only ever
* implemented for AVR.
*/
void disconnectDigitalIn(uint8_t channel_num){
#if IS_AVR()
DIDR0 |= 1<<channel_num;
#endif
}
void reconnectDigitalIn(uint8_t channel_num){
#if IS_AVR()
DIDR0 &= ~(1<<channel_num);
#endif
}
void adcDisconnectAllDigitalIns(){
#if IS_AVR()
for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
DIDR0 |= 1<<i;
}
#endif
}
void adcReconnectAllDigitalIns(){
#if IS_AVR()
for (uint8_t i = 0; i<NUM_ANALOG_INPUTS; i++){
DIDR0 &= ~(1<<i);
}
#endif
}