machine/rp2040: refactor PWM code. fix Period calculation

This commit is contained in:
Patricio Whittingslow
2021-11-05 12:39:24 -03:00
committed by Ron Evans
parent 348a02d697
commit bf0b05e32c
2 changed files with 83 additions and 63 deletions
+6
View File
@@ -18,6 +18,12 @@ func CPUFrequency() uint32 {
return 125 * MHz
}
// Returns the period of a clock cycle for the raspberry pi pico in nanoseconds.
// Used in PWM API.
func cpuPeriod() uint32 {
return 1e9 / CPUFrequency()
}
// clockIndex identifies a hardware clock
type clockIndex uint8