github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/machine_stm32l4x2.go (about) 1 //go:build stm32l4x2 2 3 package machine 4 5 // Peripheral abstraction layer for the stm32l4x2 6 7 func CPUFrequency() uint32 { 8 return 80000000 9 } 10 11 // Internal use: configured speed of the APB1 and APB2 timers, this should be kept 12 // in sync with any changes to runtime package which configures the oscillators 13 // and clock frequencies 14 const APB1_TIM_FREQ = 80e6 // 80MHz 15 const APB2_TIM_FREQ = 80e6 // 80MHz 16 17 //---------- I2C related code 18 19 // Gets the value for TIMINGR register 20 func (i2c *I2C) getFreqRange() uint32 { 21 // This is a 'magic' value calculated by STM32CubeMX 22 // for 80MHz PCLK1. 23 // TODO: Do calculations based on PCLK1 24 return 0x10909CEC 25 }