From e7f6c6b4332fdb474b6f00ad9ebeb09b386cc18d Mon Sep 17 00:00:00 2001 From: zxfishhack Date: Sat, 26 Mar 2022 12:32:04 +0800 Subject: [PATCH] modify cdiv calculate, satisfy comment --- spi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spi.go b/spi.go index 7a5954e..e2cd64a 100644 --- a/spi.go +++ b/spi.go @@ -65,7 +65,7 @@ func SpiSpeed(speed int) { if isBCM2711() { coreFreq = 550 * 1000000 } - cdiv := uint32(coreFreq / speed) + cdiv := uint32((coreFreq + 2*speed) / speed) setSpiDiv(cdiv) }