File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,17 @@ class DigitalOut {
70
70
gpio_init_out_ex (&gpio, pin, value);
71
71
}
72
72
73
+ virtual ~DigitalOut ()
74
+ {
75
+ gpio_free (&gpio);
76
+ }
77
+
73
78
/* * Set the output, specified as 0 or 1 (int)
74
79
*
75
80
* @param value An integer specifying the pin output value,
76
81
* 0 for logical 0, 1 (or any other non-zero value) for logical 1
77
82
*/
78
- void write (int value)
83
+ virtual void write (int value)
79
84
{
80
85
// Thread safe / atomic HAL call
81
86
gpio_write (&gpio, value);
@@ -87,7 +92,7 @@ class DigitalOut {
87
92
* an integer representing the output setting of the pin,
88
93
* 0 for logical 0, 1 for logical 1
89
94
*/
90
- int read ()
95
+ virtual int read ()
91
96
{
92
97
// Thread safe / atomic HAL call
93
98
return gpio_read (&gpio);
@@ -99,7 +104,7 @@ class DigitalOut {
99
104
* Non zero value if pin is connected to uc GPIO
100
105
* 0 if gpio object was initialized with NC
101
106
*/
102
- int is_connected ()
107
+ virtual int is_connected ()
103
108
{
104
109
// Thread safe / atomic HAL call
105
110
return gpio_is_connected (&gpio);
You can’t perform that action at this time.
0 commit comments