Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Sources/Application/Display.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func runDisplayApplication() {

// Test basic functionality
putLine("STEP 5: Display Functionality Tests...")
testDisplayFunctionality()
//testDisplayFunctionality()
ESP32C6ROM.disableRTCWatchdog()

putLine("=== Display Application Complete ===")
Expand Down Expand Up @@ -366,7 +366,8 @@ func verifyPreDisplayGPIOStates() {

var allGood = true

for (index, pin) in criticalPins.enumerated() {
for index in 0..<criticalPins.count {
let pin = criticalPins[index]
let enabled = (enableValue & (1 << pin)) != 0
let outState = (outValue & (1 << pin)) != 0
let inState = (inValue & (1 << pin)) != 0
Expand Down
3 changes: 2 additions & 1 deletion Sources/Application/SPIControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ private func printGPIOStatus(config: SPIConfig) {
// Check each SPI pin specifically
let pins = [config.sckPin, config.mosiPin, config.csPin, config.dcPin, config.rstPin]

for (i, pin) in pins.enumerated() {
for i in 0..<pins.count {
let pin = pins[i]
let enabled = (enableValue & (1 << pin)) != 0
let outState = (outValue & (1 << pin)) != 0

Expand Down
30 changes: 30 additions & 0 deletions Sources/Application/Scheduler.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Define a Task
class Task {
let execute: () -> Void
let name: String

init(name: String, execute: @escaping () -> Void) {
self.name = name
self.execute = execute
}
}

// Define a Scheduler
class Scheduler {
private var taskQueue: [Task] = []

// Add a task to the queue
func addTask(_ task: Task) {
taskQueue.append(task)
}

// Run the scheduled tasks
func run() {
while !taskQueue.isEmpty {
let task = taskQueue.removeFirst()
// In a bare-metal environment, consider using hardware-specific code to switch tasks
print("Running \(task.name)")
task.execute()
}
}
}
Loading