Skip to content

Commit

Permalink
ODROID-COMMON: Edit _analogRead to work with physical analog channel …
Browse files Browse the repository at this point in the history
…numbering
  • Loading branch information
joshua-yang committed Jul 4, 2019
1 parent efe03af commit 95e58b5
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wiringPi/odroidc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,22 @@ static int _analogRead (int pin)

/* wiringPi ADC number = pin 25, pin 29 */
switch (pin) {
#if defined(ARDUINO)
/* To work with physical analog channel numbering */
case 1: case 25:
pin = 0;
break;
case 0: case 29:
pin = 1;
break;
#else
case 0: case 25:
pin = 0;
break;
case 1: case 29:
pin = 1;
break;
#endif
default:
return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions wiringPi/odroidc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,22 @@ static int _analogRead (int pin)

/* wiringPi ADC number = pin 25, pin 29 */
switch (pin) {
#if defined(ARDUINO)
/* To work with physical analog channel numbering */
case 1: case 25:
pin = 0;
break;
case 0: case 29:
pin = 1;
break;
#else
case 0: case 25:
pin = 0;
break;
case 1: case 29:
pin = 1;
break;
#endif
default:
return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions wiringPi/odroidn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,22 @@ static int _analogRead (int pin)

/* wiringPi ADC number = pin 25, pin 29 */
switch (pin) {
#if defined(ARDUINO)
/* To work with physical analog channel numbering */
case 1: case 25:
pin = 0;
break;
case 0: case 29:
pin = 1;
break;
#else
case 0: case 25:
pin = 0;
break;
case 1: case 29:
pin = 1;
break;
#endif
default:
return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions wiringPi/odroidn2.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,22 @@ static int _analogRead (int pin)

/* wiringPi ADC number = pin 25, pin 29 */
switch (pin) {
#if defined(ARDUINO)
/* To work with physical analog channel numbering */
case 3: case 25:
pin = 0;
break;
case 2: case 29:
pin = 1;
break;
#else
case 0: case 25:
pin = 0;
break;
case 1: case 29:
pin = 1;
break;
#endif
default:
return 0;
}
Expand Down
10 changes: 10 additions & 0 deletions wiringPi/odroidxu3.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,22 @@ static int _analogRead (int pin)

/* wiringPi ADC number = pin 25, pin 29 */
switch (pin) {
#if defined(ARDUINO)
/* To work with physical analog channel numbering */
case 0: case 25:
pin = 0;
break;
case 3: case 29:
pin = 1;
break;
#else
case 0: case 25:
pin = 0;
break;
case 1: case 29:
pin = 1;
break;
#endif
default:
return 0;
}
Expand Down

0 comments on commit 95e58b5

Please sign in to comment.