Swiftpack.co -  doHernandezM/SwiftyPi as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
doHernandezM/SwiftyPi
Swift based Raspberry Pi pin controller.
.package(url: "https://github.com/doHernandezM/SwiftyPi.git", from: "v0.1")

SwiftyPi

This package is heavily based on and would not be possible without SwiftyGPIO. This is not meant to be a replacement, more like an extra layer to make using Swift with rPi devices such as buttons, relays, LEDs, UART and LCDs easier. Support is currently limited as this is a hobby. Since SwiftyPi is made to work in conjunction with ApusRupus I have decided against implementing a delegate. You will have to actively poll each device in a loop for state. I may change this to implement the timer better.

See SwiftyPi.DocC / In source comments

~~Funtionality options:

I recommend visiting SwiftyGPIO and getting familiar with this API first. However, the goal to eventually be able to call many devices, so eventually SwiftyDevice is all you need to worry about.

~~Do this:

.package(url: "https://github.com/doHernandezM/SwiftyPi.git", ._exactItem("0.1.30")),

~~GPIO

  • ~~Use this to create a GPIO pin using the SwiftyGPIO pin naming convention, i.e. "P4" for pin 4.
public init(gpioPinName: String, theType: SwiftyPiType)

~~Device actions

  • ~~Each device has an action that can be run at a certain time depending on type and protocol. This is a simple block that returns nothing, of the type:
public typealias CompletionHandler = () -> Void
  • ~~To set this action assign a block( () -> Void ) to a device's handler. This block will be called during the device's "action" event.
public var handler: CompletionHandler? = nil
  • ~~To set or get a device's state, or pin value, use:
public var bool: Bool
public var int: Int
public var mode: SwiftyPiMode

GitHub

link
Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Dependencies

Release Notes

Moved Controller to AR
1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics