Skip to content

Commit 49ff844

Browse files
Update Device-Drivers.md
1 parent 6cbc9f8 commit 49ff844

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

guides/Device-Drivers.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -310,26 +310,5 @@ for(i=0; i < 1000; i++){
310310
pwm.close():
311311
````
312312

313-
The Stratify API manages the files descriptors internally and uses the same
314-
file descriptor for all objects associated with a given device. So if close() is called on one PWM object, all PWM objects lose access.
315-
316-
````c++
317-
#include <sapi/hal.hpp> //uses namespace hal - sos/dev/pio.h
318-
319-
Pin pin0(0,1); //both of these pins access /dev/pio0 -- share a file descriptor
320-
Pin pin1(0,2);
321-
322-
pin0.init(Pin::FLAG_SET_OUTPUT); //init() is a shortcut for open() then set_attr() and has the same args as set_attr()
323-
pin1.init(Pin::FLAG_SET_INPUT | Pin::FLAG_IS_PULLUP); //uses the same fd as pin0 because both use "/dev/pio0"
324-
printf("Pin1 value is %d\n", pin1.get_value()); //this will read the pin as 0 or 1
325-
pin0.close(); //closes all objects access to /dev/pio0
326-
printf("Pin1 value is %d\n", pin1.get_value()); //this won't work - returns -1
327-
````
328-
329-
### Where to go from Here
330-
331-
The [Stratify API](../StratifyAPI/) is a great place to get started accessing hardware. If you find the API limiting, you can look at <a href="https://github.com/StratifyLabs/StratifyAPI" target="_blank">the source code</a> which contains the underlying POSIX calls.
332-
333-
334313

335314

0 commit comments

Comments
 (0)