mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 02:31:05 +01:00
Fixed PI4 PWM frequency setting due to wrong oscillator frequency
This commit is contained in:
parent
8a909a0d59
commit
43c0fe30e3
5
rpio.go
5
rpio.go
|
@ -546,7 +546,10 @@ func PullMode(pin Pin, pull Pull) {
|
|||
// pwm_clk: pins 12, 13, 18, 19, 40, 41, 45
|
||||
func SetFreq(pin Pin, freq int) {
|
||||
// TODO: would be nice to choose best clock source depending on target frequency, oscilator is used for now
|
||||
const sourceFreq = 19200000 // oscilator frequency
|
||||
sourceFreq := 19200000 // oscilator frequency
|
||||
if isBCM2711() {
|
||||
sourceFreq = 52000000
|
||||
}
|
||||
const divMask = 4095 // divi and divf have 12 bits each
|
||||
|
||||
divi := uint32(sourceFreq / freq)
|
||||
|
|
Loading…
Reference in New Issue
Block a user