@@ -34,12 +34,15 @@ static void syncADC() {
34
34
;
35
35
}
36
36
37
+ // ATSAMR, for example, doesn't have a DAC
38
+ #ifdef DAC
37
39
// Wait for synchronization of registers between the clock domains
38
40
static __inline__ void syncDAC () __attribute__((always_inline , unused ));
39
41
static void syncDAC () {
40
42
while (DAC -> STATUS .bit .SYNCBUSY == 1 )
41
43
;
42
44
}
45
+ #endif
43
46
44
47
// Wait for synchronization of registers between the clock domains
45
48
static __inline__ void syncTC_8 (Tc * TCx ) __attribute__((always_inline , unused ));
@@ -149,13 +152,16 @@ uint32_t analogRead( uint32_t ulPin )
149
152
150
153
pinPeripheral (ulPin , PIO_ANALOG );
151
154
155
+ // ATSAMR, for example, doesn't have a DAC
156
+ #ifdef DAC
152
157
if (ulPin == A0 ) // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled
153
158
{
154
159
syncDAC ();
155
160
DAC -> CTRLA .bit .ENABLE = 0x00 ; // Disable DAC
156
161
//DAC->CTRLB.bit.EOEN = 0x00; // The DAC output is turned off.
157
162
syncDAC ();
158
163
}
164
+ #endif
159
165
160
166
syncADC ();
161
167
ADC -> INPUTCTRL .bit .MUXPOS = g_APinDescription [ulPin ].ulADCChannelNumber ; // Selection for the positive ADC input
@@ -206,6 +212,8 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue )
206
212
{
207
213
uint32_t attr = g_APinDescription [ulPin ].ulPinAttribute ;
208
214
215
+ // ATSAMR, for example, doesn't have a DAC
216
+ #ifdef DAC
209
217
if ( (attr & PIN_ATTR_ANALOG ) == PIN_ATTR_ANALOG )
210
218
{
211
219
if ( ulPin != PIN_A0 ) // Only 1 DAC on A0 (PA02)
@@ -222,6 +230,7 @@ void analogWrite( uint32_t ulPin, uint32_t ulValue )
222
230
syncDAC ();
223
231
return ;
224
232
}
233
+ #endif
225
234
226
235
if ( (attr & PIN_ATTR_PWM ) == PIN_ATTR_PWM )
227
236
{
0 commit comments