diff options
author | sago35 <[email protected]> | 2022-03-29 08:25:04 +0900 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-06-01 07:56:25 +0200 |
commit | 39805bca4598e3a3ad312a388a008c8d9f989eb2 (patch) | |
tree | ac03b2f534d650d551558160d2536e3b04323126 /src/runtime/runtime_atsamd51.go | |
parent | 97842b367c0fc92499f73b9b63014247906f9190 (diff) | |
download | tinygo-39805bca4598e3a3ad312a388a008c8d9f989eb2.tar.gz tinygo-39805bca4598e3a3ad312a388a008c8d9f989eb2.zip |
os, runtime: enable os.Stdin for baremetal target
Diffstat (limited to 'src/runtime/runtime_atsamd51.go')
-rw-r--r-- | src/runtime/runtime_atsamd51.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/runtime_atsamd51.go b/src/runtime/runtime_atsamd51.go index a2438bac8..8c7282fa2 100644 --- a/src/runtime/runtime_atsamd51.go +++ b/src/runtime/runtime_atsamd51.go @@ -39,6 +39,18 @@ func putchar(c byte) { machine.Serial.WriteByte(c) } +func getchar() byte { + for machine.Serial.Buffered() == 0 { + Gosched() + } + v, _ := machine.Serial.ReadByte() + return v +} + +func buffered() int { + return machine.Serial.Buffered() +} + func initClocks() { // set flash wait state sam.NVMCTRL.CTRLA.SetBits(0 << sam.NVMCTRL_CTRLA_RWS_Pos) |