mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
stm32: add nucleo-l031k6 support
Adds i2c for all L0 series UART, Blinky (LED) and i2c tested
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// +build stm32l0x1
|
||||
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"device/stm32"
|
||||
"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_TIM21
|
||||
TICK_TIMER_FREQ = 32000000 // 32 MHz
|
||||
SLEEP_TIMER_IRQ = stm32.IRQ_TIM22
|
||||
SLEEP_TIMER_FREQ = 32000000 // 32 MHz
|
||||
)
|
||||
|
||||
const (
|
||||
FlashLatency = stm32.Flash_ACR_LATENCY_WS1
|
||||
)
|
||||
|
||||
func init() {
|
||||
initCLK()
|
||||
|
||||
initSleepTimer(&timerInfo{
|
||||
EnableRegister: &stm32.RCC.APB2ENR,
|
||||
EnableFlag: stm32.RCC_APB2ENR_TIM22EN,
|
||||
Device: stm32.TIM22,
|
||||
})
|
||||
|
||||
machine.UART0.Configure(machine.UARTConfig{})
|
||||
|
||||
initTickTimer(&timerInfo{
|
||||
EnableRegister: &stm32.RCC.APB2ENR,
|
||||
EnableFlag: stm32.RCC_APB2ENR_TIM21EN,
|
||||
Device: stm32.TIM21,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user