Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rpc library usage on the Nucleo_F072 & Nucleo_F411RE boards #1589

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions libraries/rpc/parse_pins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ PinName parse_pins(const char *str) {
return port_pin((PortName)port, pin);

#elif defined(TARGET_KL25Z) || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_K64F)
if (str[0] == 'P' && str[1] == 'T') { // PTxn
if (str[0] == 'P' && str[1] == 'T') { // PTxn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this tab? please use spaces, and align properly

uint32_t port = str[2] - 'A';
uint32_t pin = str[3] - '0'; // PTxn
uint32_t pin2 = str[4] - '0'; // PTxnn
Expand All @@ -58,8 +58,22 @@ PinName parse_pins(const char *str) {
pin = pin * 10 + pin2;
}
return port_pin((PortName)port, pin);

#elif defined(TARGET_NUCLEO_F072RB) || defined(TARGET_NUCLEO_F411RE)
if (str[0] == 'P') { // PX_XX e.g.PA_2 PC_15
uint32_t port = str[1] - 'A';
uint32_t pin = str[3] - '0';
uint32_t pin2 = str[4] - '0';

if (pin2 <= 9) {
pin = pin * 10 + pin2;
}
return port_pin((PortName)port, pin);

#endif



#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24) || defined(TARGET_LPC2368)
} else if (str[0] == 'p') { // pn
uint32_t pin = str[1] - '0'; // pn
Expand All @@ -83,7 +97,6 @@ PinName parse_pins(const char *str) {
}
return pin_names[pin - 1];
#endif

} else if (str[0] == 'L') { // LEDn
switch (str[3]) {
case '1' : return LED1;
Expand All @@ -101,5 +114,6 @@ PinName parse_pins(const char *str) {

return NC;
}

}