serial: use common initialization for serial
Этот коммит содержится в:
родитель
7eaad62568
коммит
ff7c71c99c
22 изменённых файлов: 31 добавлений и 19 удалений
|
@ -5,3 +5,7 @@ package machine
|
|||
|
||||
// Serial is a null device: writes to it are ignored.
|
||||
var Serial = NullSerial{}
|
||||
|
||||
func InitSerial() {
|
||||
Serial.Configure(UARTConfig{})
|
||||
}
|
||||
|
|
|
@ -5,3 +5,7 @@ package machine
|
|||
|
||||
// Serial is implemented via the default (usually the first) UART on the chip.
|
||||
var Serial = DefaultUART
|
||||
|
||||
func InitSerial() {
|
||||
Serial.Configure(UARTConfig{})
|
||||
}
|
||||
|
|
|
@ -5,3 +5,7 @@ package machine
|
|||
|
||||
// Serial is implemented via USB (USB-CDC).
|
||||
var Serial = USB
|
||||
|
||||
func InitSerial() {
|
||||
Serial.Configure(UARTConfig{})
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func initUART() {
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
|
||||
func putchar(c byte) {
|
||||
|
|
|
@ -29,7 +29,7 @@ func init() {
|
|||
initADCClock()
|
||||
|
||||
// connect to USB CDC interface
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
if !machine.USB.Configured() {
|
||||
machine.USB.Configure(machine.UARTConfig{})
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ func init() {
|
|||
initADCClock()
|
||||
|
||||
// connect to USB CDC interface
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
if !machine.USB.Configured() {
|
||||
machine.USB.Configure(machine.UARTConfig{})
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ func main() {
|
|||
clearbss()
|
||||
|
||||
// Initialize UART.
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
// Initialize main system timer used for time.Now.
|
||||
initTimer()
|
||||
|
|
|
@ -48,7 +48,7 @@ func main() {
|
|||
rom_i2c_writeReg(103, 4, 2, 145)
|
||||
|
||||
// Initialize UART.
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
// Initialize timer. Bits:
|
||||
// ENABLE: timer enable
|
||||
|
|
|
@ -92,7 +92,7 @@ func initPeripherals() {
|
|||
sifive.RTC.RTCCFG.Set(sifive.RTC_RTCCFG_ENALWAYS)
|
||||
|
||||
// Configure the UART.
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
|
||||
func putchar(c byte) {
|
||||
|
|
|
@ -104,7 +104,7 @@ func initPeripherals() {
|
|||
// Enable FPIOA peripheral.
|
||||
kendryte.SYSCTL.CLK_EN_PERI.SetBits(kendryte.SYSCTL_CLK_EN_PERI_FPIOA_CLK_EN)
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
|
||||
func putchar(c byte) {
|
||||
|
|
|
@ -119,7 +119,7 @@ func initPins() {
|
|||
}
|
||||
|
||||
func initUART() {
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
|
||||
func putchar(c byte) {
|
||||
|
|
|
@ -28,7 +28,7 @@ func main() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
initLFCLK()
|
||||
initRTC()
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ func machineInit()
|
|||
func init() {
|
||||
machineInit()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
|
||||
//export Reset_Handler
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM4)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM2)
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ func initCLK() {
|
|||
|
||||
func initCOM() {
|
||||
if machine.NUM_UART_INTERFACES > 0 {
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ const (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM3)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM21)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM3)
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ type arrtype = uint32
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM15)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ const (
|
|||
func init() {
|
||||
initCLK()
|
||||
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
initTickTimer(&machine.TIM16)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ func init() {
|
|||
initCLK()
|
||||
|
||||
// UART init
|
||||
machine.Serial.Configure(machine.UARTConfig{})
|
||||
machine.InitSerial()
|
||||
|
||||
// Timers init
|
||||
initTickTimer(&machine.TIM1)
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче