Skip to content

Commit

Permalink
SwiftyGPIO SPI fix: uraimo/SwiftyGPIO#128
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Hernandez committed Jan 7, 2023
1 parent 6f54789 commit bc6b9c6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
18 changes: 18 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"object": {
"pins": [
{
"package": "Schwifty",
"repositoryURL": "https://github.com/doHernandezM/Schwifty.git",
"state": {
"branch": "main",
"revision": "93267a0149dad158d3b615be5db5cd54f20c8ad9",
"version": null
}
},
{
"package": "SwiftyGPIO",
"repositoryURL": "https://github.com/uraimo/SwiftyGPIO.git",
Expand All @@ -9,6 +18,15 @@
"revision": "f7dbe1c706793e98cf99054d54109ae45e0d1f5a",
"version": "1.1.10"
}
},
{
"package": "SwiftyLCD",
"repositoryURL": "https://github.com/doHernandezM/SwiftyLCD.git",
"state": {
"branch": "main",
"revision": "43ec70c800e8573f71297599959b362a6bcbc4f0",
"version": null
}
}
]
},
Expand Down
8 changes: 6 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/uraimo/SwiftyGPIO.git", .exact("1.1.10")),
// .package(url: "https://github.com/uraimo/SwiftyGPIO.git", .exact("1.1.10")),
.package(url: "https://github.com/doHernandezM/SwiftyLCD.git", .branch("main")),
.package(url: "https://github.com/doHernandezM/Schwifty.git", .branch("main"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftyPi",
dependencies: [
.product(name: "SwiftyGPIO", package: "SwiftyGPIO"),
// .product(name: "SwiftyGPIO", package: "SwiftyGPIO"),
.product(name: "SwiftyLCD", package: "SwiftyLCD"),
.product(name: "Schwifty", package: "Schwifty"),
]),
.testTarget(
name: "SwiftyPiTests",
Expand Down
5 changes: 3 additions & 2 deletions Rules/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ struct Project: Identifiable, Codable {
var pipassword: String = ""
var usePCA9685: Bool = false
var useMCP3008: Bool = false
var useLCD: Bool = false

var useAPI: Bool = false
var apiPassword: String = ""
var apiPort: String = "83002"
// var apiPassword: String = ""
// var apiPort: String = "83002"

init(rules: [Rule]) {
self.rules = rules
Expand Down
7 changes: 6 additions & 1 deletion Sources/SwiftyPi/Models/Pin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum PinType: String, Codable {
}

public enum PinBarMode:Int, CaseIterable {
case All, GPIO, PWM, PCA9685, MCP3008
case All, GPIO, PWM, PCA9685, MCP3008, LCD
}

public class Pin:Codable, Hashable, Identifiable, Equatable, ObservableObject {
Expand Down Expand Up @@ -383,6 +383,11 @@ func boardPins(pinProtocols:PinBarMode) -> [Pin] {
pin.currentProtocol = .MCP3008
thePins.append(pin)
}
case .LCD:
if pin.pinProtocols.contains(.MCP3008) {
pin.currentProtocol = .MCP3008
thePins.append(pin)
}
}
}
return thePins
Expand Down

0 comments on commit bc6b9c6

Please sign in to comment.