File tree Expand file tree Collapse file tree 5 files changed +36
-7
lines changed
targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS Expand file tree Collapse file tree 5 files changed +36
-7
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,16 @@ class DigitalIn {
80
80
gpio_mode (&gpio, pull);
81
81
}
82
82
83
+ /* * Return the output setting, represented as 0 or 1 (int)
84
+ *
85
+ * @returns
86
+ * Non zero value if pin is connected to uc GPIO
87
+ * 0 if gpio object was initialized with NC
88
+ */
89
+ int is_connected () {
90
+ return gpio_is_connected (&gpio);
91
+ }
92
+
83
93
#ifdef MBED_OPERATORS
84
94
/* * An operator shorthand for read()
85
95
*/
Original file line number Diff line number Diff line change @@ -85,6 +85,16 @@ class DigitalInOut {
85
85
gpio_mode (&gpio, pull);
86
86
}
87
87
88
+ /* * Return the output setting, represented as 0 or 1 (int)
89
+ *
90
+ * @returns
91
+ * Non zero value if pin is connected to uc GPIO
92
+ * 0 if gpio object was initialized with NC
93
+ */
94
+ int is_connected () {
95
+ return gpio_is_connected (&gpio);
96
+ }
97
+
88
98
#ifdef MBED_OPERATORS
89
99
/* * A shorthand for write()
90
100
*/
Original file line number Diff line number Diff line change @@ -77,6 +77,16 @@ class DigitalOut {
77
77
return gpio_read (&gpio);
78
78
}
79
79
80
+ /* * Return the output setting, represented as 0 or 1 (int)
81
+ *
82
+ * @returns
83
+ * Non zero value if pin is connected to uc GPIO
84
+ * 0 if gpio object was initialized with NC
85
+ */
86
+ int is_connected () {
87
+ return gpio_is_connected (&gpio);
88
+ }
89
+
80
90
#ifdef MBED_OPERATORS
81
91
/* * A shorthand for write()
82
92
*/
Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ uint32_t gpio_set(PinName pin);
30
30
31
31
/* Checks if gpio object is connected (pin was not initialized with NC)
32
32
* @param pin The pin to be set as GPIO
33
- * @return Non zero value if port is connected to pin
34
- * 0 if port is initialized with NC
33
+ * @return 0 if port is initialized with NC
35
34
**/
36
35
int gpio_is_connected (const gpio_t * obj );
37
36
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ uint32_t gpio_set(PinName pin) {
30
30
}
31
31
32
32
void gpio_init (gpio_t * obj , PinName pin ) {
33
- obj -> pinName = pin ;
33
+ obj -> pin = pin ;
34
34
if (pin == (PinName )NC )
35
35
return ;
36
36
@@ -42,14 +42,14 @@ void gpio_init(gpio_t *obj, PinName pin) {
42
42
}
43
43
44
44
void gpio_mode (gpio_t * obj , PinMode mode ) {
45
- pin_mode (obj -> pinName , mode );
45
+ pin_mode (obj -> pin , mode );
46
46
}
47
47
48
48
void gpio_dir (gpio_t * obj , PinDirection direction ) {
49
- MBED_ASSERT (obj -> pinName != (PinName )NC );
50
- uint32_t port = obj -> pinName >> GPIO_PORT_SHIFT ;
49
+ MBED_ASSERT (obj -> pin != (PinName )NC );
50
+ uint32_t port = obj -> pin >> GPIO_PORT_SHIFT ;
51
51
uint32_t gpio_addrs [] = GPIO_BASE_ADDRS ;
52
- uint32_t pin_num = obj -> pinName & 0xFF ;
52
+ uint32_t pin_num = obj -> pin & 0xFF ;
53
53
54
54
switch (direction ) {
55
55
case PIN_INPUT :
You can’t perform that action at this time.
0 commit comments