add stm32 nucleol476rg support

This commit is contained in:
Patrick Ting
2024-03-29 22:37:40 -07:00
committed by Ron Evans
parent 39029cc376
commit 22bf045c9a
6 changed files with 184 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
//go:build stm32l4x6
package machine
// Peripheral abstraction layer for the stm32l4x6
func CPUFrequency() uint32 {
return 80e6
}
// Internal use: configured speed of the APB1 and APB2 timers, this should be kept
// in sync with any changes to runtime package which configures the oscillators
// and clock frequencies
const APB1_TIM_FREQ = 80e6 // 80MHz
const APB2_TIM_FREQ = 80e6 // 80MHz
//---------- I2C related code
// Gets the value for TIMINGR register
func (i2c *I2C) getFreqRange() uint32 {
// This is a 'magic' value calculated by STM32CubeMX
// for 80MHz PCLK1.
// TODO: Do calculations based on PCLK1
return 0x10909CEC
}