File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 7
7
//! pervasively throughout Zephyr device drivers. As such, most of the calls in this module are
8
8
//! unsafe.
9
9
10
+ use core:: ffi:: c_int;
11
+
10
12
use crate :: raw;
11
13
use super :: Unique ;
12
14
@@ -116,4 +118,18 @@ impl GpioPin {
116
118
raw:: gpio_pin_toggle_dt ( & self . pin ) ;
117
119
}
118
120
}
121
+
122
+ /// Set the logical level of the pin.
123
+ pub unsafe fn set ( & mut self , _token : & mut GpioToken , value : bool ) {
124
+ raw:: gpio_pin_set_dt ( & self . pin , value as c_int ) ;
125
+ }
126
+
127
+ /// Read the logical level of the pin.
128
+ pub unsafe fn get ( & mut self , _token : & mut GpioToken ) -> bool {
129
+ match raw:: gpio_pin_get_dt ( & self . pin ) {
130
+ 0 => false ,
131
+ 1 => true ,
132
+ _ => panic ! ( "TODO: Handle gpio get error" ) ,
133
+ }
134
+ }
119
135
}
You can’t perform that action at this time.
0 commit comments