Skip to content

Commit 6b9b48d

Browse files
committed
WIP
1 parent 40ae2b1 commit 6b9b48d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/runtime/runtime_py32.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package runtime
44

55
import (
66
"device/arm"
7+
"machine"
78

89
"device/py32"
910
)
@@ -15,6 +16,7 @@ func main() {
1516
py32.RCC.SetICSCR_HSI_FS(py32.RCC_ICSCR_HSI_FS_Freq24MHz)
1617

1718
ConfigureSystemTimer(24e6)
19+
machine.InitSerial()
1820

1921
run()
2022
exit(0)
@@ -53,7 +55,15 @@ func sleepTicks(d timeUnit) {
5355
}
5456

5557
func putchar(c byte) {
58+
machine.Serial.WriteByte(c)
59+
}
5660

61+
func getchar() byte {
62+
for machine.Serial.Buffered() == 0 {
63+
Gosched()
64+
}
65+
v, _ := machine.Serial.ReadByte()
66+
return v
5767
}
5868

5969
//export SysTick_Handler

0 commit comments

Comments
 (0)