mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 14:03:39 +00:00
stm32: Use TIM for runtime clock
This commit is contained in:
@@ -7,20 +7,6 @@ import (
|
||||
"machine"
|
||||
)
|
||||
|
||||
/*
|
||||
timer settings used for tick and sleep.
|
||||
|
||||
note: TICK_TIMER_FREQ and SLEEP_TIMER_FREQ are controlled by PLL / clock
|
||||
settings, so must be kept in sync if the clock settings are changed.
|
||||
*/
|
||||
const (
|
||||
TICK_RATE = 1000 // 1 KHz
|
||||
TICK_TIMER_IRQ = stm32.IRQ_TIM7
|
||||
TICK_TIMER_FREQ = 32000000 // 32 MHz
|
||||
SLEEP_TIMER_IRQ = stm32.IRQ_TIM3
|
||||
SLEEP_TIMER_FREQ = 32000000 // 32 MHz
|
||||
)
|
||||
|
||||
const (
|
||||
FlashLatency = stm32.Flash_ACR_LATENCY_WS1
|
||||
)
|
||||
@@ -28,17 +14,7 @@ const (
|
||||
func init() {
|
||||
initCLK()
|
||||
|
||||
initSleepTimer(&timerInfo{
|
||||
EnableRegister: &stm32.RCC.APB1ENR,
|
||||
EnableFlag: stm32.RCC_APB1ENR_TIM3EN,
|
||||
Device: stm32.TIM3,
|
||||
})
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
|
||||
initTickTimer(&timerInfo{
|
||||
EnableRegister: &stm32.RCC.APB1ENR,
|
||||
EnableFlag: stm32.RCC_APB1ENR_TIM7EN,
|
||||
Device: stm32.TIM7,
|
||||
})
|
||||
initTickTimer(&machine.TIM3)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user