STM32 F103RB support for mbed-rpc, tested just once with the blinking example
Dependents: rpc_over_serial_irq
Fork of mbed-rpc by
Diff: parse_pins.cpp
- Revision:
- 7:279476428ecf
- Parent:
- 6:78303e9c7590
--- a/parse_pins.cpp Fri Aug 01 22:04:52 2014 +0000
+++ b/parse_pins.cpp Mon Aug 04 16:50:46 2014 +0000
@@ -1,18 +1,7 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
+#include "stmbed.h"
#include "port_api.h"
namespace mbed {
@@ -31,6 +20,12 @@
, p15, p16, p17, p18, p19, p20, NC, NC, p23
, p24, p25, p26, p27, p28, p29, p30, p31, p32
, p33, p34, NC, NC, p37, p38, p39};
+
+#elif defined(TARGET_STM32F4XX) || defined(TARGET_STM32F1XX) || defined(TARGET_NUCLEO_F103RB)
+ static const PinName pin_names[] = { p5, p6, p7, p8, p9, p10, p11, p12, p13, p14
+ , p15, p16, p17, p18, p19, p20, p21, p22, p23
+ , p24, p25, p26, p27, p28, p29, p30, p31, p32
+ , p33, p34, NC, NC, NC, NC, NC};
#endif
#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24) || defined(TARGET_LPC2368) || defined(TARGET_LPC812) || defined(TARGET_LPC4088)|| defined(TARGET_LPC1114)
@@ -53,9 +48,34 @@
pin = pin * 10 + pin2;
}
return port_pin((PortName)port, pin);
+
+#elif defined(TARGET_NUCLEO_F103RB)
+ if (str[0] == 'P') { // Pn_n
+ uint32_t port = str[1] - '0';
+ uint32_t pin = str[3] - '0'; // Pn_n
+ uint32_t pin2 = str[4] - '0'; // Pn_nn
+ if (pin2 <= 9) {
+ pin = pin * 10 + pin2;
+ }
+ return port_pin((PortName)port, pin);
#endif
-#if defined(TARGET_LPC1768) || defined(TARGET_LPC11U24) || defined(TARGET_LPC2368)
+#if defined(TARGET_NUCLEO_F103RB) || defined(TARGET_LPC1768) || defined(TARGET_LPC11U24) || defined(TARGET_LPC2368) \
+ || defined(TARGET_STM32F3XX) || defined(TARGET_STM32F4XX)
+/* defined(TARGET_NUCLEO_F103RB) || defined(TARGET_NUCLEO_L152RE) || \
+defined(TARGET_NUCLEO_F302R8) || \
+defined(TARGET_NUCLEO_F030R8) || \
+defined(TARGET_NUCLEO_F401RE) || \
+defined(TARGET_NUCLEO_F411RE) || \
+defined(TARGET_NUCLEO_F072RB) || \
+defined(TARGET_NUCLEO_F334R8) || \
+defined(TARGET_NUCLEO_L053R8)
+//#define TXPIN STDIO_UART_TX
+//#endif
+//TARGET_NUCLEO_L152RE
+//TARGET_STM32F4XX) || defined(TARGET_STM32F1XX
+//TARGET_STM32F4XX) || defined(TARGET_STM32F103)
+*/
} else if (str[0] == 'p') { // pn
uint32_t pin = str[1] - '0'; // pn
uint32_t pin2 = str[2] - '0'; // pnn
@@ -77,7 +97,7 @@
return NC;
}
return pin_names[pin - 5];
-#elif defined(TARGET_STM32F4XX) || defined(TARGET_STM32F1XX)
+//#elif defined(TARGET_STM32F4XX) || defined(TARGET_STM32F1XX)
// TODO: implement pin names specific to STM32 platform here
#endif
