Skip to content

Commit 5df30a8

Browse files
authored
do not set pin mode for built-in USRn LEDs
This fix resolves Adafruit_BBIO issue #310 and adafruit/Adafruit_Blinka#96 which was preventing the USR LEDs from being used by the CircuitPython Blinka library
1 parent e06bec0 commit 5df30a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/c_pinmux.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ BBIO_err set_pin_mode(const char *key, const char *mode)
1313
char pinmux_dir[20]; // "ocp:P#_##_pinmux"
1414
char pin[6]; //"P#_##"
1515
FILE *f = NULL;
16-
16+
17+
// pin mode can not be set for the built-in USRn LEDs
18+
if (strncmp(key, "USR", 3) == 0) {
19+
return BBIO_OK;
20+
}
21+
1722
if (strlen(key) == 4) // Key P#_# format, must inject '0' to be P#_0#
1823
snprintf(pin, sizeof(pin), "%.3s0%c", key,key[3]);
1924
else //copy string

0 commit comments

Comments
 (0)