-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
151 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This file contains a swift wrapper for some Pico SDK C style stuff | ||
// Upercase library names can be used to only include helpers for available APIs | ||
|
||
#if PICO_STDLIB | ||
public struct PicoGPIO { | ||
/// Enum for GPIO direction, mirroring the C enum | ||
public enum Direction: UInt8 { | ||
case input = 0 | ||
case output = 1 | ||
} | ||
|
||
/// Swift-friendly wrapper for gpio_set_dir | ||
public static func setDirection(pin: UInt32, direction: Direction) { | ||
gpio_set_dir(pin, direction.rawValue != 0) | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters