aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_atsamd51.go
diff options
context:
space:
mode:
authorsago35 <[email protected]>2022-03-29 08:25:04 +0900
committerRon Evans <[email protected]>2022-06-01 07:56:25 +0200
commit39805bca4598e3a3ad312a388a008c8d9f989eb2 (patch)
treeac03b2f534d650d551558160d2536e3b04323126 /src/runtime/runtime_atsamd51.go
parent97842b367c0fc92499f73b9b63014247906f9190 (diff)
downloadtinygo-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.go12
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)