nrf,sam,rp2040: add machine.HardwareID function

This commit is contained in:
Kenneth Bell
2023-10-20 11:47:05 +01:00
committed by Ron Evans
parent 9fd9d9c05a
commit 9fb5a5b9a4
9 changed files with 207 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package main
import (
"encoding/hex"
"machine"
"time"
)
func main() {
time.Sleep(2 * time.Second)
// For efficiency, it's best to get the device ID once and cache it
// (e.g. on RP2040 XIP flash and interrupts disabled for period of
// retrieving the hardware ID from ROM chip)
id := machine.DeviceID()
for {
println("Device ID:", hex.EncodeToString(id))
time.Sleep(1 * time.Second)
}
}