mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
esp32: add interrupt-based UART RX and fix init order
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -47,18 +47,21 @@ func main() {
|
||||
// faster.
|
||||
clearbss()
|
||||
|
||||
// Initialize UART.
|
||||
machine.InitSerial()
|
||||
|
||||
// Initialize main system timer used for time.Now.
|
||||
initTimer()
|
||||
|
||||
// Set up the Xtensa interrupt vector table.
|
||||
// Set up the Xtensa interrupt vector table. This zeroes INTENABLE, so it
|
||||
// must run before any peripheral (UART, timer, etc) enables its own CPU
|
||||
// interrupt line - otherwise that enable would be wiped out here.
|
||||
interruptInit()
|
||||
|
||||
// Initialize timer alarm interrupt for the scheduler.
|
||||
initTimerInterrupt()
|
||||
|
||||
// Initialize UART. This enables the UART RX interrupt, which must happen
|
||||
// after interruptInit so the INTENABLE bit is not cleared again.
|
||||
machine.InitSerial()
|
||||
|
||||
// Initialize the heap, call main.main, etc.
|
||||
run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user