File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ package machine
77
88// LEDs
99const (
10- LED2 = PA1
11- LED3 = PA5
12- LED4 = PA4
10+ LED1 = PA1
11+ LED2 = PA5
12+ LED3 = PA4
1313 LED = LED2
1414)
1515
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ package machine
77
88// LEDs
99const (
10- LED2 = PA2
11- LED3 = PA3
12- LED4 = PA4
10+ LED1 = PA2
11+ LED2 = PA3
12+ LED3 = PA4
1313 LED = LED2
1414)
1515
Original file line number Diff line number Diff line change @@ -7,8 +7,12 @@ import (
77 "machine"
88
99 "device/py32"
10+
11+ "runtime/volatile"
1012)
1113
14+ var tickCounter volatile.Register64
15+
1216//export Reset_Handler
1317func main () {
1418 preinit ()
@@ -36,11 +40,9 @@ func nanosecondsToTicks(ns int64) timeUnit {
3640 return timeUnit (ns / 1000_000 )
3741}
3842
39- var tickCounter uint64
40-
4143//go:linkname ticks runtime.ticks
4244func ticks () timeUnit {
43- return timeUnit (tickCounter )
45+ return timeUnit (tickCounter . Get () )
4446}
4547
4648func sleepTicks (d timeUnit ) {
@@ -72,5 +74,5 @@ func getchar() byte {
7274
7375//export SysTick_Handler
7476func handleSysTick () {
75- tickCounter = tickCounter + 1
77+ tickCounter . Set ( tickCounter . Get () + 1 )
7678}
You can’t perform that action at this time.
0 commit comments