Skip to content

Commit 77b5174

Browse files
0xc0170adustm
authored andcommitted
Enable rpc library usage on the Nucleo_F072 & Nucleo_F411RE boards
Adding additional 'defined' statements to line 62 of parse_pins.cpp should in theory enable the rpc libraries for all other Nucleo boards, since all stm32 parts use the same pin labeling scheme i.e. P(port)_pinNumber e.g. PA_3, PC_15 e.t.c.
1 parent 51c308d commit 77b5174

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

libraries/rpc/parse_pins.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,22 @@ PinName parse_pins(const char *str) {
5858
pin = pin * 10 + pin2;
5959
}
6060
return port_pin((PortName)port, pin);
61+
62+
#elif defined(TARGET_NUCLEO_F072RB) || defined(TARGET_NUCLEO_F411RE)
63+
if (str[0] == 'P') { // PX_XX e.g.PA_2 PC_15
64+
uint32_t port = str[1] - 'A';
65+
uint32_t pin = str[3] - '0';
66+
uint32_t pin2 = str[4] - '0';
67+
68+
if (pin2 <= 9) {
69+
pin = pin * 10 + pin2;
70+
}
71+
return port_pin((PortName)port, pin);
72+
6173
#endif
6274

75+
76+
6377
#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24) || defined(TARGET_LPC2368)
6478
} else if (str[0] == 'p') { // pn
6579
uint32_t pin = str[1] - '0'; // pn
@@ -83,7 +97,6 @@ PinName parse_pins(const char *str) {
8397
}
8498
return pin_names[pin - 1];
8599
#endif
86-
87100
} else if (str[0] == 'L') { // LEDn
88101
switch (str[3]) {
89102
case '1' : return LED1;
@@ -101,5 +114,6 @@ PinName parse_pins(const char *str) {
101114

102115
return NC;
103116
}
104-
105117
}
118+
119+

0 commit comments

Comments
 (0)