Skip to content

Commit 3c06986

Browse files
authored
Merge pull request stm32duino#55 from fpistm/issue54
Fix pinNametoDigitalPin issue
2 parents 402a26c + ed79513 commit 3c06986

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

cores/arduino/pins_arduino.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919
#include "pins_arduino.h"
2020

21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
2125
void __libc_init_array(void);
2226

2327
WEAK uint32_t pinNametoDigitalPin(PinName p)
@@ -33,4 +37,8 @@ WEAK uint32_t pinNametoDigitalPin(PinName p)
3337
WEAK void init( void )
3438
{
3539
hw_config_init();
36-
}
40+
}
41+
42+
#ifdef __cplusplus
43+
}
44+
#endif

cores/arduino/pins_arduino.h

+10-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@
1818
#ifndef _PINS_ARDUINO_H_
1919
#define _PINS_ARDUINO_H_
2020

21+
// API compatibility
22+
#include "variant.h"
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
2128
/**
2229
* Libc porting layers
2330
*/
2431
#if defined ( __GNUC__ ) /* GCC CS3 */
2532
# include <syscalls.h> /** RedHat Newlib minimal stub */
2633
#endif
2734

28-
// API compatibility
29-
#include "variant.h"
30-
3135
#define NOT_AN_INTERRUPT NC // -1
3236

3337
#define NUM_DIGITAL_PINS DEND
@@ -61,6 +65,8 @@ uint32_t pinNametoDigitalPin(PinName p);
6165
#define digitalPinToPort(p) ( get_GPIO_Port(digitalPinToPinName(p)) )
6266
#define digitalPinToBitMask(p) ( STM_GPIO_PIN(digitalPinToPinName(p)) )
6367

64-
68+
#ifdef __cplusplus
69+
}
70+
#endif
6571

6672
#endif /*_PINS_ARDUINO_H_*/

0 commit comments

Comments
 (0)