From a035ab37c6d07719c362af4bad1265e82be28c90 Mon Sep 17 00:00:00 2001 From: Andy Liu Date: Thu, 28 Sep 2023 18:43:54 +0800 Subject: [PATCH] Modify LCD pinout Signed-off-by: Andy Liu --- .../11MoreProjects/MorseCode/Package.swift | 3 --- .../MorseCode/Sources/MorseCode/MorseCode.swift | 2 -- .../MovingBall/Sources/MovingBall/MovingBall.swift | 8 ++++---- .../11MoreProjects/Pong/Sources/Pong/Pong.swift | 7 ++++--- .../TicTacToe/Sources/TicTacToe/TicTacToe.swift | 8 ++++---- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Package.swift b/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Package.swift index dcc0bcb..7b6cc68 100644 --- a/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Package.swift +++ b/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Package.swift @@ -9,7 +9,6 @@ let package = Package( // Dependencies declare other packages that this package depends on. .package(url: "https://github.com/madmachineio/SwiftIO.git", branch: "main"), .package(url: "https://github.com/madmachineio/MadBoards.git", branch: "main"), - .package(url: "https://github.com/madmachineio/MadDrivers.git", branch: "main"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -19,8 +18,6 @@ let package = Package( dependencies: [ "SwiftIO", "MadBoards", - // Use specific library name rather than "MadDrivers" would speed up the build procedure. - .product(name: "ST7789", package: "MadDrivers"), ]), ] ) diff --git a/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Sources/MorseCode/MorseCode.swift b/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Sources/MorseCode/MorseCode.swift index fc712af..f636722 100644 --- a/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Sources/MorseCode/MorseCode.swift +++ b/Examples/SwiftIOPlayground/11MoreProjects/MorseCode/Sources/MorseCode/MorseCode.swift @@ -1,8 +1,6 @@ // Import the SwiftIO library to set input/output and MadBoard to use pin id. import SwiftIO import MadBoard -// Import the driver for the screen. -import ST7789 @main public struct MorseCode { diff --git a/Examples/SwiftIOPlayground/11MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift b/Examples/SwiftIOPlayground/11MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift index 14ad7dc..23a9c62 100644 --- a/Examples/SwiftIOPlayground/11MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift +++ b/Examples/SwiftIOPlayground/11MoreProjects/MovingBall/Sources/MovingBall/MovingBall.swift @@ -15,11 +15,11 @@ public struct MovingBall { let accelerometer = LIS3DH(i2c) // Initialize the pins for the screen. - let spi = SPI(Id.SPI0, speed: 30_000_000) - let cs = DigitalOut(Id.D5) - let dc = DigitalOut(Id.D4) - let rst = DigitalOut(Id.D3) let bl = DigitalOut(Id.D2) + let rst = DigitalOut(Id.D12) + let dc = DigitalOut(Id.D13) + let cs = DigitalOut(Id.D5) + let spi = SPI(Id.SPI0, speed: 30_000_000) // Initialize the screen with the pins above. let screen = ST7789(spi: spi, cs: cs, dc: dc, rst: rst, bl: bl, rotation: .angle90) diff --git a/Examples/SwiftIOPlayground/11MoreProjects/Pong/Sources/Pong/Pong.swift b/Examples/SwiftIOPlayground/11MoreProjects/Pong/Sources/Pong/Pong.swift index d0a434b..e148a41 100644 --- a/Examples/SwiftIOPlayground/11MoreProjects/Pong/Sources/Pong/Pong.swift +++ b/Examples/SwiftIOPlayground/11MoreProjects/Pong/Sources/Pong/Pong.swift @@ -14,10 +14,11 @@ public struct Pong { let spi = SPI(Id.SPI0, speed: 30_000_000) // Initialize the pins used for the screen. - let cs = DigitalOut(Id.D5) - let dc = DigitalOut(Id.D4) - let rst = DigitalOut(Id.D3) let bl = DigitalOut(Id.D2) + let rst = DigitalOut(Id.D12) + let dc = DigitalOut(Id.D13) + let cs = DigitalOut(Id.D5) + // Initialize the LCD using the pins above. // Rotate the screen to keep the original at the upper left. let screen = ST7789(spi: spi, cs: cs, dc: dc, rst: rst, bl: bl, rotation: .angle90) diff --git a/Examples/SwiftIOPlayground/11MoreProjects/TicTacToe/Sources/TicTacToe/TicTacToe.swift b/Examples/SwiftIOPlayground/11MoreProjects/TicTacToe/Sources/TicTacToe/TicTacToe.swift index e491f00..be06acc 100644 --- a/Examples/SwiftIOPlayground/11MoreProjects/TicTacToe/Sources/TicTacToe/TicTacToe.swift +++ b/Examples/SwiftIOPlayground/11MoreProjects/TicTacToe/Sources/TicTacToe/TicTacToe.swift @@ -8,11 +8,11 @@ import ST7789 public struct TicTacToe { public static func main() { // Initialize the SPI pin and the digital pins for the LCD. - let spi = SPI(Id.SPI0, speed: 30_000_000) - let cs = DigitalOut(Id.D5) - let dc = DigitalOut(Id.D4) - let rst = DigitalOut(Id.D3) let bl = DigitalOut(Id.D2) + let rst = DigitalOut(Id.D12) + let dc = DigitalOut(Id.D13) + let cs = DigitalOut(Id.D5) + let spi = SPI(Id.SPI0, speed: 30_000_000) // Initialize the LCD using the pins above. Rotate the screen to keep the original at the upper left. let screen = ST7789(spi: spi, cs: cs, dc: dc, rst: rst, bl: bl, rotation: .angle90)