stm32: add more MCUs with h/w RNG

This commit is contained in:
Kenneth Bell
2021-12-19 17:17:30 +00:00
committed by Ron Evans
parent 61be9189f1
commit 5c3ad004ab
5 changed files with 21 additions and 5 deletions
+10
View File
@@ -1,3 +1,4 @@
//go:build stm32l5
// +build stm32l5
package machine
@@ -546,3 +547,12 @@ const (
ARR_MAX = 0x10000
PSC_MAX = 0x10000
)
func initRNG() {
stm32.RCC.CRRCR.SetBits(stm32.RCC_CRRCR_HSI48ON)
for !stm32.RCC.CRRCR.HasBits(stm32.RCC_CRRCR_HSI48RDY) {
}
stm32.RCC.AHB2ENR.SetBits(stm32.RCC_AHB2ENR_RNGEN)
stm32.RNG.CR.SetBits(stm32.RNG_CR_RNGEN)
}