File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ uint8_t mode;
348348 negpin = analogInputToAnalogPin (negpin + A0 ); // calc pin number (might not have 0 mapped to A0)
349349#endif // analogInputToAnalogPin
350350 }
351-
351+
352352 if (negpin >= 0 && negpin <= 3 )
353353 {
354354 mode = ADC_CH_INPUTMODE_DIFFWGAINL_gc ;
@@ -364,6 +364,10 @@ uint8_t mode;
364364 negpin -= 4 ; // so that it's 0-3
365365 }
366366 }
367+ else
368+ {
369+ mode = ADC_CH_INPUTMODE_DIFFWGAINL_gc ; // see 24.15.2 section on 'MUXNEG' when using INTERNAL GND or PAD GND
370+ }
367371
368372#else // NOT an 'E5'
369373
@@ -391,11 +395,11 @@ uint8_t mode;
391395 negpin = analogInputToAnalogPin (negpin + A0 ); // calc pin number (might not have 0 mapped to A0)
392396#endif // analogInputToAnalogPin
393397 }
394-
398+
395399
396400 if (negpin >= 0 && negpin <= 3 && gain != ADC_CH_GAIN_1X_gc ) // allow this *IF* gain is 1X
397401 {
398- return 0 ; // dis-allowed combination
402+ return 0 ; // dis-allowed combination
399403 }
400404 else if (negpin >= 0 && negpin <= 3 )
401405 {
Original file line number Diff line number Diff line change 126126
127127// the first macro, 'digitalPinToInterrupt', is for the 'interruptNum' parameter in 'attachInterrupt' and 'detachInterrupt'
128128// the second macro, 'digitalPinToIntMode', is for the 'mode' parameter in 'attachInterrupt'.
129- //#define digitalPinToInterrupt(p) \ this is an old attempt, leaving here for reference [for now]
130- // { register uint8_t uiPort = pgm_read_byte((&digital_pin_to_port_PGM[p])); \
131- // uiPort == _PD ? PORTD_INT0 : uiPort == _PC ? PORTC_INT0 : uiPort == _PA ? PORTA_INT0 : uiPort == _PR ? PORTR_INT0 : -1; }
132129
133130#define digitalPinToInterrupt (p ) \
134131 ( pgm_read_byte(&port_to_int0_PGM[pgm_read_byte(&digital_pin_to_port_PGM[p])]) | \
You can’t perform that action at this time.
0 commit comments