mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 10:41:03 +01:00
Merge pull request #80 from tmsmr/master
Fix incorrect core_freq for Raspberry Pi 4, Raspberry Pi 400 and CM4
This commit is contained in:
commit
ab13b61116
7
spi.go
7
spi.go
|
@ -61,8 +61,11 @@ func SpiEnd(dev SpiDev) {
|
||||||
// Param speed may be as big as 125MHz in theory, but
|
// Param speed may be as big as 125MHz in theory, but
|
||||||
// only values up to 31.25MHz are considered relayable.
|
// only values up to 31.25MHz are considered relayable.
|
||||||
func SpiSpeed(speed int) {
|
func SpiSpeed(speed int) {
|
||||||
const baseFreq = 250 * 1000000
|
coreFreq := 250 * 1000000
|
||||||
cdiv := uint32(baseFreq / speed)
|
if isBCM2711() {
|
||||||
|
coreFreq = 550 * 1000000
|
||||||
|
}
|
||||||
|
cdiv := uint32(coreFreq / speed)
|
||||||
setSpiDiv(cdiv)
|
setSpiDiv(cdiv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user