mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
avr: use register wrappers that use runtime/volatile.*Uint8 calls
This avoids the //go:volatile pragma on types in Go source code, at least for AVR targets.
This commit is contained in:
committed by
Ron Evans
parent
6f6afb0515
commit
e0cf74e638
@@ -17,19 +17,19 @@ func sleepWDT(period uint8) {
|
||||
avr.Asm("cli")
|
||||
avr.Asm("wdr")
|
||||
// Start timed sequence.
|
||||
*avr.WDTCSR |= avr.WDTCSR_WDCE | avr.WDTCSR_WDE
|
||||
avr.WDTCSR.SetBits(avr.WDTCSR_WDCE | avr.WDTCSR_WDE)
|
||||
// Enable WDT and set new timeout
|
||||
*avr.WDTCSR = avr.WDTCSR_WDIE | avr.RegValue(period)
|
||||
avr.WDTCSR.SetBits(avr.WDTCSR_WDIE | period)
|
||||
avr.Asm("sei")
|
||||
|
||||
// Set sleep mode to idle and enable sleep mode.
|
||||
// Note: when using something other than idle, the UART won't work
|
||||
// correctly. This needs to be fixed, though, so we can truly sleep.
|
||||
*avr.SMCR = (0 << 1) | avr.SMCR_SE
|
||||
avr.SMCR.Set((0 << 1) | avr.SMCR_SE)
|
||||
|
||||
// go to sleep
|
||||
avr.Asm("sleep")
|
||||
|
||||
// disable sleep
|
||||
*avr.SMCR = 0
|
||||
avr.SMCR.Set(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user