Skip to content

Cleanup the HAL Pico example #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2024
Merged
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
2 changes: 0 additions & 2 deletions pico-blink/Sources/RP2040/Hardware/Clocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,5 @@ extension RP2040Hardware {
return result
}
}

// // FC0_REF_KHZ
}
}
23 changes: 0 additions & 23 deletions pico-blink/Sources/RP2040/Hardware/RP2040Hardware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public struct RP2040Hardware {
let fbdiv = vcoFrequency / referenceFrequency

let pdiv = postDivisor1 << 16 | postDivisor2 << 12

// TODO: check for existing settings

let resetTarget: Resets.ResetValue = pll.unsafeAddress == pllUSB.unsafeAddress ? .pll_usb : .pll_sys
resets.reset.set(resetTarget)
Expand All @@ -85,11 +83,6 @@ public struct RP2040Hardware {


}

// func configure(_ kind: Clocks.Kind, source: UInt32, auxiliarySource: UInt32, sourceFrequency: UInt32, frequency: UInt32) {

// }

func initializeClocks() {
let xoscKHz = UInt16(12000)
let usbClockKHz = UInt16(48000)
Expand All @@ -109,18 +102,6 @@ public struct RP2040Hardware {
$0.timeout = 0
}

// xosc.control.modify {
// $0.frequencyRange = .oneToFifteenMHz
// }

// xosc.startup.modify {
// $0.delay = (((xoscKHz + 128) / 256) * multiplier)
// }

// xosc.control.set {
// $0.enable = .enabled
// }

while !xosc.status.value.stable { }

clocks.system.control.clearSource()
Expand All @@ -134,10 +115,6 @@ public struct RP2040Hardware {

RP2040Hardware.referenceClockHz = clocks.reference.configure(UInt32(xoscKHz) * UInt32(KHz), UInt32(xoscKHz) * UInt32(KHz))
RP2040Hardware.systemClockHz = clocks.system.configure(systemClockKHz * UInt32(KHz), systemClockKHz * UInt32(KHz))
// clocks.usb.configure()
// clocks.adc.configure()
// clocks.rtc.configure()
// clocks.peripheral.configure()
}
}

Expand Down