Skip to content

Commit 36d7caa

Browse files
committed
Merge pull request #879 from 0xc0170/fix_gpio_connected_function
Targets - gpio_is_connected() for STM targets where it was not implemented
2 parents c53fab9 + 5bd982c commit 36d7caa

File tree

9 files changed

+37
-0
lines changed

9 files changed

+37
-0
lines changed

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F070RB/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/gpio_object.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
71+
6772
#ifdef __cplusplus
6873
}
6974
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F303RE/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static inline int gpio_read(gpio_t *obj)
6464
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6565
}
6666

67+
static inline int gpio_is_connected(const gpio_t *obj) {
68+
return obj->pin != (PinName)NC;
69+
}
70+
6771
#ifdef __cplusplus
6872
}
6973
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ static inline int gpio_read(gpio_t *obj) {
6262
return ((*obj->reg_in & obj->mask) ? 1 : 0);
6363
}
6464

65+
static inline int gpio_is_connected(const gpio_t *obj) {
66+
return obj->pin != (PinName)NC;
67+
}
68+
6569
#ifdef __cplusplus
6670
}
6771
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4XX/gpio_object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ static inline int gpio_read(gpio_t *obj) {
4646
return ((*obj->reg_in & obj->mask) ? 1 : 0);
4747
}
4848

49+
static inline int gpio_is_connected(const gpio_t *obj) {
50+
return obj->pin != (PinName)NC;
51+
}
52+
4953
#ifdef __cplusplus
5054
}
5155
#endif

0 commit comments

Comments
 (0)