Skip to content

Commit 3629bde

Browse files
committed
Add pad2pin lookup
It was easier to provide the constant pads for differential ADC than trying to modify ap3_set_pin_to_analog() to use a pad #.
1 parent 4c51148 commit 3629bde

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: cores/arduino/ard_sup/gpio/ap3_gpio.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ ap3_gpio_pad_t ap3_gpio_pin2pad(ap3_gpio_pin_t pin)
4141
return ap3_variant_pinmap[pin];
4242
}
4343

44+
ap3_gpio_pin_t ap3_gpio_pad2pin(ap3_gpio_pad_t pad)
45+
{
46+
for (int x = 0; x < AP3_VARIANT_NUM_PINS; x++)
47+
{
48+
if (ap3_variant_pinmap[x] == pad)
49+
return (x);
50+
}
51+
return (AP3_GPIO_PAD_UNUSED);
52+
}
53+
4454
typedef void (*voidFuncPtr)(void);
4555
typedef void (*voidFuncPtrArg)(void *);
4656
typedef struct

0 commit comments

Comments
 (0)