[}}).
-
-## A note on the `recover` builtin
-
-The `recover` builtin is not yet supported. Instead, a `panic` will always terminate a program and `recover` simply returns nil.
-
-This is a deviation from the Go spec but so far works well in practice. While there are no immediate plans to implement `recover`, if it can be shown to be necessary for compatibility it will be implemented. Please note that this comes at a cost: it means that every `defer` call will need some extra memory (both code and stack), so this feature is not free. It might also be architecture dependent. If it gets implemented, it will likely be opt-in to not increase code size for existing projects.
diff --git a/content/lang-support/stdlib.md b/content/lang-support/stdlib.md
deleted file mode 100644
index 519650bc..00000000
--- a/content/lang-support/stdlib.md
+++ /dev/null
@@ -1,935 +0,0 @@
-
----
-title: Packages supported by TinyGo
----
-
-The following table shows all Go standard library packages and whether they can be imported by TinyGo. If they can't, you can click the 'no' link to jump to the explanation why the package cannot be compiled.
-
-Note that the fact they can be imported, does not mean that all functions and types in the program can be used. For example, sometimes using some functions or types of the package will still trigger compiler errors.
-
-Package | Importable
---- | --- |
-archive/tar | []✗ no](#archive-tar) |
-archive/zip | [✗ no](#archive-zip) |
-bufio | ✔ yes |
-bytes | ✔ yes |
-compress/bzip2 | ✔ yes |
-compress/flate | ✔ yes |
-compress/gzip | ✔ yes |
-compress/lzw | ✔ yes |
-compress/zlib | ✔ yes |
-container/heap | ✔ yes |
-container/list | ✔ yes |
-container/ring | ✔ yes |
-context | ✔ yes |
-crypto | ✔ yes |
-crypto/aes | ✔ yes |
-crypto/cipher | ✔ yes |
-crypto/des | ✔ yes |
-crypto/dsa | ✔ yes |
-crypto/ecdsa | [✗ no](#crypto-ecdsa) |
-crypto/ed25519 | ✔ yes |
-crypto/elliptic | ✔ yes |
-crypto/hmac | ✔ yes |
-crypto/md5 | ✔ yes |
-crypto/rand | ✔ yes |
-crypto/rc4 | ✔ yes |
-crypto/rsa | [✗ no](#crypto-rsa) |
-crypto/sha1 | ✔ yes |
-crypto/sha256 | ✔ yes |
-crypto/sha512 | ✔ yes |
-crypto/subtle | ✔ yes |
-crypto/tls | [✗ no](#crypto-tls) |
-crypto/x509 | [✗ no](#crypto-x509) |
-crypto/x509/pkix | [✗ no](#crypto-x509-pkix) |
-database/sql | ✔ yes |
-database/sql/driver | ✔ yes |
-debug/dwarf | ✔ yes |
-debug/elf | ✔ yes |
-debug/gosym | ✔ yes |
-debug/macho | ✔ yes |
-debug/pe | ✔ yes |
-debug/plan9obj | ✔ yes |
-encoding | ✔ yes |
-encoding/ascii85 | ✔ yes |
-encoding/asn1 | [✗ no](#encoding-asn1) |
-encoding/base32 | ✔ yes |
-encoding/base64 | ✔ yes |
-encoding/binary | ✔ yes |
-encoding/csv | ✔ yes |
-encoding/gob | [✗ no](#encoding-gob) |
-encoding/hex | ✔ yes |
-encoding/json | [✗ no](#encoding-json) |
-encoding/pem | ✔ yes |
-encoding/xml | [✗ no](#encoding-xml) |
-errors | ✔ yes |
-expvar | [✗ no](#expvar) |
-flag | ✔ yes |
-fmt | ✔ yes |
-go/ast | ✔ yes |
-go/build | [✗ no](#go-build) |
-go/constant | ✔ yes |
-go/doc | [✗ no](#go-doc) |
-go/format | ✔ yes |
-go/importer | [✗ no](#go-importer) |
-go/parser | ✔ yes |
-go/printer | ✔ yes |
-go/scanner | ✔ yes |
-go/token | ✔ yes |
-go/types | [✗ no](#go-types) |
-hash | ✔ yes |
-hash/adler32 | ✔ yes |
-hash/crc32 | ✔ yes |
-hash/crc64 | ✔ yes |
-hash/fnv | ✔ yes |
-hash/maphash | ✔ yes |
-html | ✔ yes |
-html/template | [✗ no](#html-template) |
-image | ✔ yes |
-image/color | ✔ yes |
-image/color/palette | ✔ yes |
-image/draw | ✔ yes |
-image/gif | ✔ yes |
-image/jpeg | ✔ yes |
-image/png | ✔ yes |
-index/suffixarray | ✔ yes |
-io | ✔ yes |
-io/ioutil | ✔ yes |
-log | ✔ yes |
-log/syslog | [✗ no](#log-syslog) |
-math | ✔ yes |
-math/big | ✔ yes |
-math/bits | ✔ yes |
-math/cmplx | ✔ yes |
-math/rand | ✔ yes |
-mime | ✔ yes |
-mime/multipart | [✗ no](#mime-multipart) |
-mime/quotedprintable | ✔ yes |
-net | [✗ no](#net) |
-net/http | [✗ no](#net-http) |
-net/http/cgi | [✗ no](#net-http-cgi) |
-net/http/cookiejar | [✗ no](#net-http-cookiejar) |
-net/http/fcgi | [✗ no](#net-http-fcgi) |
-net/http/httptest | [✗ no](#net-http-httptest) |
-net/http/httptrace | [✗ no](#net-http-httptrace) |
-net/http/httputil | [✗ no](#net-http-httputil) |
-net/http/pprof | [✗ no](#net-http-pprof) |
-net/mail | [✗ no](#net-mail) |
-net/rpc | [✗ no](#net-rpc) |
-net/rpc/jsonrpc | [✗ no](#net-rpc-jsonrpc) |
-net/smtp | [✗ no](#net-smtp) |
-net/textproto | [✗ no](#net-textproto) |
-net/url | ✔ yes |
-os | ✔ yes |
-os/exec | [✗ no](#os-exec) |
-os/signal | ✔ yes |
-os/user | [✗ no](#os-user) |
-path | ✔ yes |
-path/filepath | ✔ yes |
-plugin | ✔ yes |
-reflect | ✔ yes |
-regexp | ✔ yes |
-regexp/syntax | ✔ yes |
-sort | ✔ yes |
-strconv | ✔ yes |
-strings | ✔ yes |
-sync | ✔ yes |
-sync/atomic | ✔ yes |
-syscall | ✔ yes |
-syscall/js | ✔ yes |
-testing | ✔ yes |
-testing/iotest | ✔ yes |
-testing/quick | [✗ no](#testing-quick) |
-text/scanner | ✔ yes |
-text/tabwriter | ✔ yes |
-text/template | [✗ no](#text-template) |
-text/template/parse | ✔ yes |
-time | ✔ yes |
-time/tzdata | ✔ yes |
-unicode | ✔ yes |
-unicode/utf16 | ✔ yes |
-unicode/utf8 | ✔ yes |
-unsafe | ✔ yes |
-
-
-
-## archive/tar
-
-
-The compiler gave the following error when this package was imported:
-
-# archive/tar
-/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:554:32: os.FileMode(fi.h.Mode).Perm undefined (type os.FileMode has no field or method Perm)
-/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:636:15: fi.ModTime undefined (type os.FileInfo has no field or method ModTime)
-/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:637:21: fm.Perm undefined (type os.FileMode has no field or method Perm)
-/home/ron/.gvm/gos/go1.15/src/archive/tar/common.go:640:10: fm.IsRegular undefined (type os.FileMode has no field or method IsRegular)
-
-
-
-
-
-
-## archive/zip
-
-
-The compiler gave the following error when this package was imported:
-
-# archive/zip
-/home/ron/.gvm/gos/go1.15/src/archive/zip/struct.go:180:19: fi.ModTime undefined (type os.FileInfo has no field or method ModTime)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## crypto/ecdsa
-
-
-The compiler gave the following error when this package was imported:
-
-# encoding/asn1
-encoding/asn1/: interp: unknown GEP
-
-traceback:
-encoding/asn1/:
- %12 = getelementptr inbounds { %"encoding/asn1.BitString" }, { %"encoding/asn1.BitString" }* %11, i32 0, i32 0, !dbg !1934
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## crypto/rsa
-
-
-The compiler gave the following error when this package was imported:
-
-# crypto/rsa
-/home/ron/.gvm/gos/go1.15/src/math/big/nat.go:74:11: interp: unknown GEP
-
-traceback:
-/home/ron/.gvm/gos/go1.15/src/math/big/nat.go:74:11:
- %16 = getelementptr inbounds i32, i32* %4, i32 0, !dbg !1742
-/home/ron/.gvm/gos/go1.15/src/math/big/nat.go:84:19:
- %9 = call { i32*, i32, i32 } @"(math/big.nat).setWord"(i32* %6, i32 %7, i32 %8, i32 %3, i8* undef, i8* undef), !dbg !1749
-/home/ron/.gvm/gos/go1.15/src/math/big/int.go:55:25:
- %17 = call { i32*, i32, i32 } @"(math/big.nat).setUint64"(i32* %14, i32 %15, i32 %16, i64 %2, i8* undef, i8* undef), !dbg !1755
-/home/ron/.gvm/gos/go1.15/src/math/big/int.go:69:26:
- %2 = call %"math/big.Int"* @"(*math/big.Int).SetInt64"(%"math/big.Int"* %0, i64 %x, i8* undef, i8* undef), !dbg !1739
-crypto/rsa/:38:25:
- %288 = call %"math/big.Int"* @"math/big.NewInt"(i64 0, i8* undef, i8* undef), !dbg !1867
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## crypto/tls
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/ecdsa](#crypto-ecdsa)
- * [crypto/rsa](#crypto-rsa)
- * [crypto/x509](#crypto-x509)
- * [net](#net)
-
-
-
-
-
-## crypto/x509
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/ecdsa](#crypto-ecdsa)
- * [crypto/rsa](#crypto-rsa)
- * [crypto/x509/pkix](#crypto-x509-pkix)
- * [encoding/asn1](#encoding-asn1)
- * [net](#net)
-
-
-
-
-
-## crypto/x509/pkix
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [encoding/asn1](#encoding-asn1)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## encoding/asn1
-
-
-The compiler gave the following error when this package was imported:
-
-# encoding/asn1
-encoding/asn1/: interp: unknown GEP
-
-traceback:
-encoding/asn1/:
- %12 = getelementptr inbounds { %"encoding/asn1.BitString" }, { %"encoding/asn1.BitString" }* %11, i32 0, i32 0, !dbg !1837
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## encoding/gob
-
-
-The compiler gave the following error when this package was imported:
-
-# encoding/gob
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:562:21: MakeMapWithSize not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:948:22: PtrTo not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/decode.go:1118:30: srt.FieldByName undefined (type reflect.Type has no field or method FieldByName)
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/encode.go:603:16: PtrTo not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/encode.go:643:70: f.Index undefined (type reflect.StructField has no field or method Index)
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:119:12: cannot convert nil (untyped nil value) to reflect.Type
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:142:14: PtrTo not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:867:9: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)
-/home/ron/.gvm/gos/go1.15/src/encoding/gob/type.go:870:21: rt.PkgPath undefined (type reflect.Type has no field or method PkgPath)
-
-
-
-
-
-
-
-
-## encoding/json
-
-
-The compiler gave the following error when this package was imported:
-
-# encoding/json
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:160:15: cannot convert nil (untyped nil value) to reflect.Type
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:232:26: cannot convert nil (untyped nil value) to reflect.Type
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:249:30: cannot convert nil (untyped nil value) to reflect.Type
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:515:8: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:552:7: v.SetLen undefined (type reflect.Value has no field or method SetLen)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:589:6: v.SetLen undefined (type reflect.Value has no field or method SetLen)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:620:40: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:641:16: PtrTo not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:776:17: PtrTo not declared by package reflect
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:921:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:950:6: v.SetBytes undefined (type reflect.Value has no field or method SetBytes)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:957:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:990:9: v.NumMethod undefined (type reflect.Value has no field or method NumMethod)
-/home/ron/.gvm/gos/go1.15/src/encoding/json/decode.go:1014:23: v.OverflowFloat undefined (type reflect.Value has no field or method OverflowFloat)
-[...more lines following...]
-
-
-
-
-
-
-
-## encoding/xml
-
-
-The compiler gave the following error when this package was imported:
-
-# encoding/xml
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:286:8: val.SetLen undefined (type reflect.Value has no field or method SetLen)
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:402:6: v.SetLen undefined (type reflect.Value has no field or method SetLen)
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/read.go:665:7: dst.SetBytes undefined (type reflect.Value has no field or method SetBytes)
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/typeinfo.go:114:29: f.Index undefined (type *reflect.StructField has no field or method Index)
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/typeinfo.go:318:14: typ.FieldByIndex undefined (type reflect.Type has no field or method FieldByIndex)
-/home/ron/.gvm/gos/go1.15/src/encoding/xml/typeinfo.go:319:14: typ.FieldByIndex undefined (type reflect.Type has no field or method FieldByIndex)
-
-
-
-
-
-
-
-
-## expvar
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [encoding/json](#encoding-json)
- * [net/http](#net-http)
-
-
-
-
-
-
-
-
-
-
-
-## go/build
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [go/doc](#go-doc)
- * [os/exec](#os-exec)
-
-
-
-
-
-
-
-## go/doc
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [text/template](#text-template)
-
-
-
-
-
-
-
-## go/importer
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [go/build](#go-build)
- * [go/types](#go-types)
-
-
-
-
-
-
-
-
-
-
-
-
-
-## go/types
-
-
-The compiler gave the following error when this package was imported:
-
-# go/types
-/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:203:21: interp: load from a bitcast
-
-traceback:
-/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:203:21:
- %83 = load i8, i8* %82, !dbg !2170
-/home/ron/Development/tinygo/tinygo/src/runtime/hashmap.go:335:19:
- %13 = call i1 @runtime.hashmapGet(%runtime.hashmap* %m, i8* %12, i8* %value, i32 %valueSize, i32 %11, i8* undef, i32 ptrtoint (%runtime.funcValueWithSignature* @"runtime.hashmapStringEqual$withSignature" to i32), i8* undef, i8* undef), !dbg !2059
-/home/ron/.gvm/gos/go1.15/src/go/types/sizes.go:184:6:
- %13 = call i1 @runtime.hashmapStringGet(%runtime.hashmap* %9, i8* %11, i32 %12, i8* %hashmap.value.bitcast, i32 4, i8* undef, i8* null), !dbg !2055
-go/types/:202:24:
- %359 = call %runtime._interface @"go/types.SizesFor"(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"go/types.init$string.1271", i32 0, i32 0), i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @"go/types.init$string.1272", i32 0, i32 0), i32 5, i8* undef, i8* undef), !dbg !2199
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## html/template
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [encoding/json](#encoding-json)
- * [text/template](#text-template)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## log/syslog
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net](#net)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## mime/multipart
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net/textproto](#net-textproto)
-
-
-
-
-
-
-
-## net
-
-
-The compiler gave the following error when this package was imported:
-
-# net
-/home/ron/.gvm/gos/go1.15/src/net/parse.go:80:12: st.ModTime undefined (type os.FileInfo has no field or method ModTime)
-/home/ron/.gvm/gos/go1.15/src/net/pipe.go:156:16: ErrDeadlineExceeded not declared by package os
-/home/ron/.gvm/gos/go1.15/src/net/pipe.go:169:16: ErrDeadlineExceeded not declared by package os
-/home/ron/.gvm/gos/go1.15/src/net/pipe.go:188:16: ErrDeadlineExceeded not declared by package os
-/home/ron/.gvm/gos/go1.15/src/net/pipe.go:204:17: ErrDeadlineExceeded not declared by package os
-
-
-
-
-
-
-## net/http
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/tls](#crypto-tls)
- * [mime/multipart](#mime-multipart)
- * [net](#net)
- * [net/http/httptrace](#net-http-httptrace)
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/http/cgi
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/tls](#crypto-tls)
- * [net](#net)
- * [net/http](#net-http)
- * [net/textproto](#net-textproto)
- * [os/exec](#os-exec)
-
-
-
-
-
-## net/http/cookiejar
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net](#net)
- * [net/http](#net-http)
-
-
-
-
-
-## net/http/fcgi
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net](#net)
- * [net/http](#net-http)
- * [net/http/cgi](#net-http-cgi)
-
-
-
-
-
-## net/http/httptest
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/tls](#crypto-tls)
- * [crypto/x509](#crypto-x509)
- * [net](#net)
- * [net/http](#net-http)
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/http/httptrace
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/tls](#crypto-tls)
- * [net](#net)
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/http/httputil
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net](#net)
- * [net/http](#net-http)
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/http/pprof
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [html/template](#html-template)
- * [net/http](#net-http)
-
-
-
-
-
-## net/mail
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/rpc
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [encoding/gob](#encoding-gob)
- * [html/template](#html-template)
- * [net](#net)
- * [net/http](#net-http)
-
-
-
-
-
-## net/rpc/jsonrpc
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [encoding/json](#encoding-json)
- * [net](#net)
- * [net/rpc](#net-rpc)
-
-
-
-
-
-## net/smtp
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [crypto/tls](#crypto-tls)
- * [net](#net)
- * [net/textproto](#net-textproto)
-
-
-
-
-
-## net/textproto
-
-
-This package cannot be imported because the following dependencies cannot be compiled:
-
- * [net](#net)
-
-
-
-
-
-
-
-
-
-## os/exec
-
-
-The compiler gave the following error when this package was imported:
-
-# os/exec
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:130:14: Process not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:134:19: ProcessState not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:462:6: ProcessState not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:246:23: DevNull not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:258:20: Pipe not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:291:27: DevNull not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:303:20: Pipe not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:422:22: StartProcess not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:422:57: ProcAttr not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:584:20: Pipe not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:626:20: Pipe not declared by package os
-/home/ron/.gvm/gos/go1.15/src/os/exec/exec.go:651:20: Pipe not declared by package os
-
-
-
-
-
-
-
-
-## os/user
-
-
-The compiler gave the following error when this package was imported:
-
-# os/user
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:15:41: undeclared name: current
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:36:9: undeclared name: lookupUser
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:45:9: undeclared name: lookupUserId
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:51:9: undeclared name: lookupGroup
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:57:9: undeclared name: lookupGroupId
-/home/ron/.gvm/gos/go1.15/src/os/user/lookup.go:62:9: undeclared name: listGroups
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## testing/quick
-
-
-The compiler gave the following error when this package was imported:
-
-# testing/quick
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:273:11: fType.NumOut undefined (type reflect.Type has no field or method NumOut)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:276:11: fType.Out undefined (type reflect.Type has no field or method Out)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:280:43: fType.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:290:12: fVal.Call undefined (type reflect.Value has no field or method Call)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:320:43: xType.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:330:26: x.Call undefined (type reflect.Value has no field or method Call)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:331:26: y.Call undefined (type reflect.Value has no field or method Call)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:351:25: f.In undefined (type reflect.Type has no field or method In)
-/home/ron/.gvm/gos/go1.15/src/testing/quick/quick.go:353:95: f.In undefined (type reflect.Type has no field or method In)
-
-
-
-
-
-
-
-
-
-
-## text/template
-
-
-The compiler gave the following error when this package was imported:
-
-# text/template
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:377:20: val.Recv undefined (type reflect.Value has no field or method Recv)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:541:25: cannot convert nil (untyped nil value) to reflect.Type
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:603:19: ptr.MethodByName undefined (type reflect.Value has no field or method MethodByName)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:610:33: receiver.Type().FieldByName undefined (type reflect.Type has no field or method FieldByName)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:645:21: etyp.FieldByName undefined (type reflect.Type has no field or method FieldByName)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:678:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:679:18: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:681:79: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:683:25: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:684:69: typ.NumIn undefined (type reflect.Type has no field or method NumIn)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:688:71: typ.NumOut undefined (type reflect.Type has no field or method NumOut)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:695:32: typ.In undefined (type reflect.Type has no field or method In)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:698:9: typ.IsVariadic undefined (type reflect.Type has no field or method IsVariadic)
-/home/ron/.gvm/gos/go1.15/src/text/template/exec.go:699:18: typ.In undefined (type reflect.Type has no field or method In)
-[...more lines following...]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/content/media/_index.md b/content/media/_index.md
index 2731fa46..0d6ec90c 100644
--- a/content/media/_index.md
+++ b/content/media/_index.md
@@ -1,69 +1,16 @@
---
title: "Media"
-chapter: true
-weight: 8
+linkTitle: "Media"
+type: "docs"
+menu:
+ main:
+ weight: 40
+description: >
+ Here are some of the videos, podcasts, and blog posts written about TinyGo.
+
+cascade:
+ github_repo: https://github.com/tinygo-org/tinygo-site
+ github_subdir: content/media
+ path_base_for_github_subdir: content/media
+ github_branch: dev
---
-
-Here are some of the videos, podcasts, and blog posts written about TinyGo.
-
-### Podcasts/Videos
-
-**QCon 2020 London - "Tiny Go: Small is Going Big"** - *March 3, 2020*
-https://www.infoq.com/presentations/tiny-go/
-
-**FOSDEM 2020 - "Lightning talk: LED cube using TinyGo"** (start at 51:00) - *February 2, 2020*
-https://video.fosdem.org/2020/UB2.252A/golightning.mp4
-
-**FOSDEM 2020 - "TinyGo: Fast, Small, Concurrent: Choose Three"** - *February 2, 2020*
-https://video.fosdem.org/2020/UD2.218A/iottinygo.mp4
-
-**FOSDEM 2020 - "Build real-world gaming hardware with TinyGo"** - *February 2, 2020*
-https://video.fosdem.org/2020/UB2.252A/tinygotoys.mp4
-
-**Gophercon 2019 - "Small is Going Big: Go on Microcontrollers"** - *July 26, 2019*
-https://www.youtube.com/watch?v=EiB9ZVrvrz0
-
-**The Changelog - "Go is eating the world of software"** - *July 25, 2019*
-https://changelog.com/podcast/354
-
-**Go Time - "Hardware hacking with TinyGo and Gopherbot"** - *May 8, 2019*
-https://changelog.com/gotime/84
-
-**dotGo 2019 - "Get Going with WebAssembly"** - *March 25th, 2019*
-https://www.youtube.com/watch?v=osVHH7rjpxs
-
-**FOSDEM 2019 - "Go On Microcontrollers"** - *February 3, 2019*
-https://video.fosdem.org/2019/K.1.105/go_on_microcontrollers.mp4
-
-
-### Blog posts
-
-**Alan Wang - "TinyGo on Arduino Uno: An Introduction"** - *February 5, 2020*
-https://create.arduino.cc/projecthub/alankrantas/tinygo-on-arduino-uno-an-introduction-6130f6
-
-**Arduino - "TinyGo on Arduino"** - *August 23, 2019*
-https://blog.arduino.cc/2019/08/23/tinygo-on-arduino/
-
-**Sourcegraph - "Liveblog - GopherCon 2019 - Small is going big: Go On microcontrollers"** - *July 26, 2019*
-https://about.sourcegraph.com/go/gophercon-2019-small-is-going-big-go-on-microcontrollers
-
-**Ayke van Laëthem - "How the TinyGo playground simulates hardware"** - *July 17, 2019*
-https://aykevl.nl/2019/07/tinygo-plaground-simulator
-
-**Sendil Kumar N - "Reduce your WebAssembly binaries 72% - from 56KB to 26KB to 16KB"** - *July 7, 2019*
-https://dev.to/sendilkumarn/reduce-your-webassembly-binaries-72-from-56kb-to-26kb-to-16kb-40mi
-
-**Sendil Kumar N - "(Tiny)Go to WebAssembly"** - *July 5, 2019*
-https://dev.to/sendilkumarn/tiny-go-to-webassembly-5168
-
-**Adafruit - "Using tinyGo on an Adafruit ItsyBitsy M0 board"** - *June 7, 2019*
-https://blog.adafruit.com/2019/06/07/using-tinggo-on-an-adafruit-itsybitsy-m0-board-golang-tinygo-microcontrollers-adafruit-adafruit-deadprogram-tinggolang/
-
-**Ayke van Laëthem - "LLVM from a Go perspective"** - *April 28, 2019*
-https://aykevl.nl/2019/04/llvm-from-go
-
-**Adafruit - "TinyGo – Go on Microcontrollers runs on Adafruit Circuit Playground Express"** - *March 12, 2019*
-https://blog.adafruit.com/2019/03/12/tinygo-go-on-microcontrollers-tinygolang-tinygo-runs-on-adafruit-circuit-playground-express/
-
-**Ayke van Laëthem - "Goroutines in TinyGo"** - *February 25, 2019*
-https://aykevl.nl/2019/02/tinygo-goroutines
diff --git a/content/media/articles.md b/content/media/articles.md
new file mode 100644
index 00000000..8665e434
--- /dev/null
+++ b/content/media/articles.md
@@ -0,0 +1,52 @@
+---
+title: "Articles"
+linkTitle: "Articles"
+type: "docs"
+weight: 45
+description: >
+ Articles and blog posts talking about TinyGo
+---
+**Hriday Keni - "TinyGo for Embedded Applications: Coding Without the Code-Phobia"** - *February 1, 2025*
+https://medium.com/@hrkeni/tinygo-for-embedded-applications-coding-without-the-code-phobia-28ed90b5bcb0
+
+**Eric Gregory - "Compile Go directly to WebAssembly components with TinyGo and WASI P2"** - *July 2, 2024*
+https://wasmcloud.com/blog/compile-go-directly-to-webassembly-components-with-tinygo-and-wasi-p2/
+
+**Matt Butcher - "4 Big Developments in WebAssembly"** - *April 18, 2024*
+https://thenewstack.io/4-big-developments-in-webassembly/
+
+**Pragmatik.tech - Multiple articles on TinyGo and Raspberry Pi Pico** - *July 2022 onwards*
+https://pragmatik.tech/tags/tinygo/
+
+**Aurélie Vache - "Learning Go by examples: part 5 - Create a Game Boy Advance (GBA) game in Go"** - *August 11, 2021*
+https://dev.to/aurelievache/learning-go-by-examples-part-5-create-a-game-boy-advance-gba-game-in-go-5944
+
+**Alan Wang - "TinyGo on Arduino Uno: An Introduction"** - *February 5, 2020*
+https://create.arduino.cc/projecthub/alankrantas/tinygo-on-arduino-uno-an-introduction-6130f6
+
+**Arduino - "TinyGo on Arduino"** - *August 23, 2019*
+https://blog.arduino.cc/2019/08/23/tinygo-on-arduino/
+
+**Sourcegraph - "Liveblog - GopherCon 2019 - Small is going big: Go On microcontrollers"** - *July 26, 2019*
+https://about.sourcegraph.com/go/gophercon-2019-small-is-going-big-go-on-microcontrollers
+
+**Ayke van Laëthem - "How the TinyGo playground simulates hardware"** - *July 17, 2019*
+https://aykevl.nl/2019/07/tinygo-plaground-simulator
+
+**Sendil Kumar N - "Reduce your WebAssembly binaries 72% - from 56KB to 26KB to 16KB"** - *July 7, 2019*
+https://dev.to/sendilkumarn/reduce-your-webassembly-binaries-72-from-56kb-to-26kb-to-16kb-40mi
+
+**Sendil Kumar N - "(Tiny)Go to WebAssembly"** - *July 5, 2019*
+https://dev.to/sendilkumarn/tiny-go-to-webassembly-5168
+
+**Adafruit - "Using tinyGo on an Adafruit ItsyBitsy M0 board"** - *June 7, 2019*
+https://blog.adafruit.com/2019/06/07/using-tinggo-on-an-adafruit-itsybitsy-m0-board-golang-tinygo-microcontrollers-adafruit-adafruit-deadprogram-tinggolang/
+
+**Ayke van Laëthem - "LLVM from a Go perspective"** - *April 28, 2019*
+https://aykevl.nl/2019/04/llvm-from-go
+
+**Adafruit - "TinyGo – Go on Microcontrollers runs on Adafruit Circuit Playground Express"** - *March 12, 2019*
+https://blog.adafruit.com/2019/03/12/tinygo-go-on-microcontrollers-tinygolang-tinygo-runs-on-adafruit-circuit-playground-express/
+
+**Ayke van Laëthem - "Goroutines in TinyGo"** - *February 25, 2019*
+https://aykevl.nl/2019/02/tinygo-goroutines
diff --git a/content/media/video.md b/content/media/video.md
new file mode 100644
index 00000000..0717252b
--- /dev/null
+++ b/content/media/video.md
@@ -0,0 +1,75 @@
+---
+title: "Video"
+linkTitle: "Video"
+type: "docs"
+weight: 35
+description: >
+ Videos/Podcasts talking about TinyGo
+---
+
+**FOSDEM 2025 - Ron Evans - "Return To Go Without Wires"** - *February 8, 2025*
+https://cuddly.tube/w/pkw3cCH4NFbTht7vHttChg
+
+**FOSDEM 2025 - Daniel Esteban - "Playing games without a computer: Hardware fun with TinyGo"** - *February 8, 2025*
+https://cuddly.tube/w/2UGxR1utDVN8S6vcyW64rB
+
+**FOSDEM 2025 - Ayke van Laethem - "Implementing parallelism: how we added threading and multicore support in TinyGo"** - *February 8, 2025*
+https://cuddly.tube/w/32DjftoiTssyT1tPyjxr1w
+
+**GoLab 2024 - Josephine Winter - "TinyGo for Pet Automation"** - *November 13, 2024*
+https://www.youtube.com/watch?v=CmSohy0CNdk
+
+**GopherCon US 2024 - Patricio Whittingslow - "Go in the Smallest of Places"** - *July 10, 2024*
+https://www.youtube.com/watch?v=CQJJ6KS-PF4
+
+**FOSDEM 2024 - Ayke van Laethem - "Smartwatch firmware... in Go? On TinyGo, small displays, and building a delightful developer experience"** - *February 3, 2024*
+https://video.fosdem.org/2024/ud2218a/fosdem-2024-2562-smartwatch-firmware-in-go-on-tinygo-small-displays-and-building-a-delightful-developer-experience.av1.webm
+
+**FOSDEM 2024 - Ron Evans - "Go Without Wires Strikes Back"** - *February 3, 2024*
+https://video.fosdem.org/2024/ud2218a/fosdem-2024-2270-go-without-wires-strikes-back.av1.webm
+
+**FOSDEM 2023 - Ron Evans - Go Even Further Without Wires** - *February 4, 2023*
+https://video.fosdem.org/2023/UD2.218A/goevenfurtherwithoutwires.mp4
+
+**FOSDEM 2023 - Daniel Esteban - Visually programming Go** - *February 4, 2023*
+https://video.fosdem.org/2023/UD2.218A/govisuallyprogramming.mp4
+
+**GopherCon US 2022 - Donia Chaiehloudj - TinyGo: Getting the Upper Hen** - *October 8, 2022*
+https://www.youtube.com/watch?v=D46NzhBoQC0
+
+**Pragmatik.tech - Charath Ranganathan - Multiple videos on TinyGo and Raspberry Pi Pico** - *July 2022 onwards*
+https://www.youtube.com/channel/UChxDHx-FThGJscOn3ljTi6A
+
+**CALM - Thierry Chantier - "TinyGo sur Pygamer" [FR]** - *June 15, 2021*
+https://www.youtube.com/watch?v=FI0_tC6ESJA&t=694s
+
+**Microsoft LearnTV - "Hello World"** - *June 15, 2021*
+https://channel9.msdn.com/Shows/Hello-World/Hello-World-Tuesday-June-15-2021#time=03m09s
+
+**QCon 2020 London - "Tiny Go: Small is Going Big"** - *March 3, 2020*
+https://www.infoq.com/presentations/tiny-go/
+
+**FOSDEM 2020 - "Lightning talk: LED cube using TinyGo"** (start at 51:00) - *February 2, 2020*
+https://video.fosdem.org/2020/UB2.252A/golightning.mp4
+
+**FOSDEM 2020 - "TinyGo: Fast, Small, Concurrent: Choose Three"** - *February 2, 2020*
+https://video.fosdem.org/2020/UD2.218A/iottinygo.mp4
+
+**FOSDEM 2020 - "Build real-world gaming hardware with TinyGo"** - *February 2, 2020*
+https://video.fosdem.org/2020/UB2.252A/tinygotoys.mp4
+
+**Gophercon 2019 - "Small is Going Big: Go on Microcontrollers"** - *July 26, 2019*
+https://www.youtube.com/watch?v=EiB9ZVrvrz0
+
+**The Changelog - "Go is eating the world of software"** - *July 25, 2019*
+https://changelog.com/podcast/354
+
+**Go Time - "Hardware hacking with TinyGo and Gopherbot"** - *May 8, 2019*
+https://changelog.com/gotime/84
+
+**dotGo 2019 - "Get Going with WebAssembly"** - *March 25th, 2019*
+https://www.youtube.com/watch?v=osVHH7rjpxs
+
+**FOSDEM 2019 - "Go On Microcontrollers"** - *February 3, 2019*
+https://video.fosdem.org/2019/K.1.105/go_on_microcontrollers.mp4
+
diff --git a/content/microcontrollers/_index.md b/content/microcontrollers/_index.md
deleted file mode 100644
index ef5f6119..00000000
--- a/content/microcontrollers/_index.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: "Go on microcontrollers"
-chapter: true
-weight: 3
----
-
-# Go on microcontrollers
-
-TinyGo lets you run Go directly on microcontrollers.
-
-TinyGo has support for 48 different boards and devices such as the Arduino Nano33 IoT, Adafruit Circuit Playground Express, BBC micro:bit and more. Click on a board name found in the left menu to see the what features are supported for the given hardware.
-
-We also give you the ability to add new boards. If your target isn't listed here, please raise an issue in the [issue tracker](https://github.com/tinygo-org/tinygo/issues).
-
-Want to know the details about how it is possible to compile Go for microcontrollers? Check out the [microcontrollers](../compiler-internals/microcontrollers/) page in our "Compiler Internals" section.
diff --git a/content/microcontrollers/arduino-mega2560.md b/content/microcontrollers/arduino-mega2560.md
deleted file mode 100644
index ef6fdb45..00000000
--- a/content/microcontrollers/arduino-mega2560.md
+++ /dev/null
@@ -1,50 +0,0 @@
----
-title: "Arduino Mega 2560"
-weight: 3
----
-
-The [Arduino Mega 2560](https://store.arduino.cc/arduino-mega-2560-rev3) is based on the AVR [ATmega2560](https://www.microchip.com/wwwproducts/en/ATmega2560) microcontroller.
-
-Note: the AVR backend of LLVM is still experimental so you may encounter bugs.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Arduino Mega 2560](../machine/arduino-mega2560)
-
-## Installing dependencies
-
-The Arduino Mega 2560 needs a few extra dependencies to work, for example, if you get an error like this:
-
-```text
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
-collect2: error: ld returned 1 exit status
-```
-
-Or like this:
-
-```text
-/bin/sh: 1: avrdude: not found
-```
-
-To fix this, see the installation guide for [Linux](../../getting-started/linux/#avr-arduino) and for [macOS](../../getting-started/macos/#avr-arduino).
-
-## Flashing
-
-### AVRDude
-
-Programs are loaded onto the Arduino Mega 2560 using the `avrdude` command line utility program. You must install this program before you will be able to flash the Arduino Uno board with your TinyGo code.
-
-- Plug your Arduino Uno into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target arduino-mega2560 /path/to/code`
diff --git a/content/microcontrollers/arduino-nano.md b/content/microcontrollers/arduino-nano.md
deleted file mode 100644
index a4a34f90..00000000
--- a/content/microcontrollers/arduino-nano.md
+++ /dev/null
@@ -1,50 +0,0 @@
----
-title: "Arduino Nano"
-weight: 3
----
-
-The [Arduino Nano](https://store.arduino.cc/arduino-nano) is based on the AVR [ATmega328p](https://www.microchip.com/wwwproducts/en/ATmega328p) microcontroller.
-
-Note: the AVR backend of LLVM is still experimental so you may encounter bugs.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Arduino Nano](../machine/arduino-nano)
-
-## Installing dependencies
-
-The Arduino Nano needs a few extra dependencies to work, for example, if you get an error like this:
-
-```text
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
-collect2: error: ld returned 1 exit status
-```
-
-Or like this:
-
-```text
-/bin/sh: 1: avrdude: not found
-```
-
-To fix this, see the installation guide for [Linux](../../getting-started/linux/#avr-arduino) and for [macOS](../../getting-started/macos/#avr-arduino).
-
-## Flashing
-
-### AVRDude
-
-Programs are loaded onto the Arduino Uno using the `avrdude` command line utility program. You must install this program before you will be able to flash the Arduino Uno board with your TinyGo code.
-
-- Plug your Arduino Uno into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=arduino-nano`
diff --git a/content/microcontrollers/arduino-nano33-iot.md b/content/microcontrollers/arduino-nano33-iot.md
deleted file mode 100644
index 70052510..00000000
--- a/content/microcontrollers/arduino-nano33-iot.md
+++ /dev/null
@@ -1,109 +0,0 @@
----
-title: "Arduino Nano33 IoT"
-weight: 3
----
-
-The [Arduino Nano33 IoT](https://store.arduino.cc/nano-33-iot) is a very small ARM development board based on the Atmel [SAMD21](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of processors. It also has a NINA-W102 chip onboard which provides an wireless communication abilities based on the popular ESP32 family of wireless chips from Espressif.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Arduino Nano33 IoT](../machine/arduino-nano33)
-
-## Pin Mapping
-
-Since the pin labels are located on the other side of the board, here is a picture showing the pin numbering from the front side perspective:
-
-
-
-## Installing BOSSA
-
-In order to flash your TinyGo programs onto the Arduino Nano33 IoT board, you will need to install the "bossac" command line utility which is part of the [BOSSA command line utilities](https://github.com/shumatech/BOSSA).
-
-### macOS
-
-You can use Homebrew to install the BOSSA command line interface by using the following command:
-
-```shell
-brew cask install bossa
-```
-
-Or if you prefer, you can also download the installer from https://github.com/shumatech/BOSSA/releases/download/1.9.1/bossa-1.9.1.dmg
-
-Once you have downloaded it, double click on the .dmg file to perform the installation.
-
-### Linux
-
-On Linux, install from source:
-
-```shell
-sudo apt install libreadline-dev libwxgtk3.0-*
-git clone https://github.com/shumatech/BOSSA.git
-cd BOSSA
-make
-sudo cp bin/bossac /usr/local/bin
-```
-
-### Windows
-
-You can download BOSSA from https://github.com/shumatech/BOSSA/releases/download/1.9.1/bossa-x64-1.9.1.msi
-
-*VERY IMPORTANT*: During the installation, you much choose to install into `c:\Program Files`. The installer might have the wrong path, so edit it to match `c:\Program Files`.
-
-After the installation, you must add BOSSA to your PATH:
-
-```shell
-set PATH=%PATH%;"c:\Program Files\BOSSA";
-```
-
-Test that you have installed "BOSSA" correctly by running this command:
-
-```shell
-bossac --help
-```
-
-## Flashing
-
-Once you have installed the needed BOSSA command line utility, as in the previous section, you are ready to build and flash code to your Arduino Nano33 IoT board.
-
-### CLI Flashing
-
-- Plug your Arduino Nano33 IoT board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the Arduino Nano33 IoT with the blinky1 example:
-
- ```
- tinygo flash -target=arduino-nano33 examples/blinky1
- ```
-
-- The Arduino Nano33 IoT board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Arduino Nano33 IoTboard to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Arduino Nano33 IoT board ready to receive code.
-- Now try running the `tinygo flash` command as above:
-
- ```shell
- tinygo flash -target=arduino-nano33 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Arduino Nano33 IoT board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Arduino Nano33 IoT as a serial port. `UART0` refers to this connection.
-
-For information on how to use the built-in NINA-W102 wireless chip with the default firmware, please see the "wifinina" driver in the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/wifinina](https://github.com/tinygo-org/drivers/tree/release/wifinina).
-
-You can also use the Espressif ESP-AT firmware, although you will need to flash it yourself. Please see the "espat" driver in the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/espat](https://github.com/tinygo-org/drivers/tree/release/espat).
diff --git a/content/microcontrollers/arduino-uno.md b/content/microcontrollers/arduino-uno.md
deleted file mode 100644
index 3ae9fcbf..00000000
--- a/content/microcontrollers/arduino-uno.md
+++ /dev/null
@@ -1,50 +0,0 @@
----
-title: "Arduino Uno"
-weight: 3
----
-
-The [Arduino Uno](https://store.arduino.cc/arduino-uno-rev3) is based on the AVR [ATmega328p](https://www.microchip.com/wwwproducts/en/ATmega328p) microcontroller.
-
-Note: the AVR backend of LLVM is still experimental so you may encounter bugs.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Arduino Uno](../machine/arduino)
-
-## Installing dependencies
-
-The Arduino Uno needs a few extra dependencies to work, for example, if you get an error like this:
-
-```text
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lm
-/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: cannot find -lc
-collect2: error: ld returned 1 exit status
-```
-
-Or like this:
-
-```text
-/bin/sh: 1: avrdude: not found
-```
-
-To fix this, see the installation guide for [Linux](../../getting-started/linux/#avr-arduino) and for [macOS](../../getting-started/macos/#avr-arduino).
-
-## Flashing
-
-### AVRDude
-
-Programs are loaded onto the Arduino Uno using the `avrdude` command line utility program. You must install this program before you will be able to flash the Arduino Uno board with your TinyGo code.
-
-- Plug your Arduino Uno into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target arduino /path/to/code`
diff --git a/content/microcontrollers/arduino-zero.md b/content/microcontrollers/arduino-zero.md
deleted file mode 100644
index 0772fe08..00000000
--- a/content/microcontrollers/arduino-zero.md
+++ /dev/null
@@ -1,100 +0,0 @@
----
-title: "Arduino Zero"
-weight: 3
----
-
-The [Arduino Zero](https://store.arduino.cc/arduino-zero) is a very small ARM development board based on the Atmel [SAMD21](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of processors.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Arduino Zero](../machine/arduino-zero)
-
-## Installing BOSSA
-
-In order to flash your TinyGo programs onto the Arduino Zero board, you will need to install the "bossac" command line utility which is part of the [BOSSA command line utilities](https://github.com/shumatech/BOSSA).
-
-### macOS
-
-You can use Homebrew to install the BOSSA command line interface by using the following command:
-
-```shell
-brew cask install bossa
-```
-
-Or if you prefer, you can also download the installer from https://github.com/shumatech/BOSSA/releases/download/1.9.1/bossa-1.9.1.dmg
-
-Once you have downloaded it, double click on the .dmg file to perform the installation.
-
-### Linux
-
-On Linux, install from source:
-
-```shell
-sudo apt install libreadline-dev libwxgtk3.0-*
-git clone https://github.com/shumatech/BOSSA.git
-cd BOSSA
-make
-sudo cp bin/bossac /usr/local/bin
-```
-
-### Windows
-
-You can download BOSSA from https://github.com/shumatech/BOSSA/releases/download/1.9.1/bossa-x64-1.9.1.msi
-
-*VERY IMPORTANT*: During the installation, you much choose to install into `c:\Program Files`. The installer might have the wrong path, so edit it to match `c:\Program Files`.
-
-After the installation, you must add BOSSA to your PATH:
-
-```shell
-set PATH=%PATH%;"c:\Program Files\BOSSA";
-```
-
-Test that you have installed "BOSSA" correctly by running this command:
-
-```shell
-bossac --help
-```
-
-## Flashing
-
-Once you have installed the needed BOSSA command line utility, as in the previous section, you are ready to build and flash code to your Arduino Zero board.
-
-### CLI Flashing
-
-- Plug your Arduino Zero board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the Arduino Zero with the blinky1 example:
-
- ```
- tinygo flash -target=arduino-zero examples/blinky1
- ```
-
-- The Arduino Zero board should restart and then begin running your program.
-
-
-### Troubleshooting
-
-If you have troubles getting your Arduino Zero board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Arduino Zero board ready to receive code.
-- Now try running the `tinygo flash` command as above:
-
- ```shell
- tinygo flash -target=arduino-zero [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Arduino Zero board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Arduino Zero as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/bluepill.md b/content/microcontrollers/bluepill.md
deleted file mode 100644
index 5b392c8b..00000000
--- a/content/microcontrollers/bluepill.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: "Bluepill"
-weight: 3
----
-
-The [Bluepill](http://wiki.stm32duino.com/index.php?title=Blue_Pill) is a popular, ultra-cheap and compact ARM development board based on the ST Micro [STM32F103C8](https://www.st.com/en/microcontrollers/stm32f103c8.html) SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Bluepill](../machine/bluepill)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the Bluepill with a separate hardware programmer such as the [STLink v2](https://www.st.com/en/development-tools/st-link-v2.html) board, using the `openocd` command line utility program to perform the board flashing. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the Bluepill board with your TinyGo code.
-
-- Plug your STLink v2 programmer into your computer's USB port.
-- Plug your Bluepill into the STLink v2 programmer using the Bluepill `SWIO`, `SWCLK`, `3V3` and `GND` pins.
-- Build and flash your TinyGo program using `tinygo flash -target=bluepill`
diff --git a/content/microcontrollers/circuit-playground-bluefruit.md b/content/microcontrollers/circuit-playground-bluefruit.md
deleted file mode 100644
index e3c318ef..00000000
--- a/content/microcontrollers/circuit-playground-bluefruit.md
+++ /dev/null
@@ -1,62 +0,0 @@
----
-title: "Adafruit Circuit Playground Bluefruit"
-weight: 3
----
-
-The [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333) is small ARM development board based on the Nordic Semiconductor [nrf52840](https://www.nordicsemi.com/eng/Products/nRF52840) processor. It has several built-in devices such as WS2812 "NeoPixel" LEDs, buttons, an accelerometer, and some other sensors.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Circuit Playground Bluefruit](../machine/circuitplay-bluefruit)
-
-## Flashing
-
-### UF2
-
-The Circuit Playground Bluefruit comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Circuit Playground Bluefruit into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=circuitplay-bluefruit [PATH TO YOUR PROGRAM]
- ```
-
-- The Circuit Playground Bluefruit board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Circuit Playground Bluefruit board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Circuit Playground Bluefruit board ready to receive code.
-- The Circuit Playground Bluefruit board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=circuitplay-bluefruit [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Circuit Playground Bluefruit board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Circuit Playground Bluefruit as a serial port. `UART0` refers to this connection.
-
-For an example that uses the built-in Neopixel LEDs, take a look at the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/examples](https://github.com/tinygo-org/drivers)
-
-Bluetooth support is now available for the Circuit Playground Bluefruit board. See https://github.com/tinygo-org/bluetooth for more information.
-
diff --git a/content/microcontrollers/circuit-playground-express.md b/content/microcontrollers/circuit-playground-express.md
deleted file mode 100644
index 002a2864..00000000
--- a/content/microcontrollers/circuit-playground-express.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: "Adafruit Circuit Playground Express"
-weight: 3
----
-
-The [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333) is small ARM development board based on the Atmel [SAMD21](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of processors. It has several built-in devices such as WS2812 "NeoPixel" LEDs, buttons, an accelerometer, and some other sensors.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Circuit Playground Express](../machine/circuitplay-express)
-
-## Flashing
-
-### UF2
-
-The Circuit Playground Express comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Circuit Playground Express into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=circuitplay-express [PATH TO YOUR PROGRAM]
- ```
-
-- The Circuit Playground Express board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Circuit Playground Express board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Circuit Playground Express board ready to receive code.
-- The Circuit Playground Express board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=circuitplay-express [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Circuit Playground Express board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Circuit Playground Express as a serial port. `UART0` refers to this connection.
-
-For an example that uses the built-in Neopixel LEDs, take a look at the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/examples](https://github.com/tinygo-org/drivers)
diff --git a/content/microcontrollers/clue-alpha.md b/content/microcontrollers/clue-alpha.md
deleted file mode 100644
index daa4bab3..00000000
--- a/content/microcontrollers/clue-alpha.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: "Adafruit CLUE"
-weight: 3
----
-
-The [Adafruit CLUE](https://www.adafruit.com/product/4500) is small ARM development board based on the Nordic Semiconductor [nrf52840](https://www.nordicsemi.com/eng/Products/nRF52840) processor. It has several built-in devices such as WS2812 "NeoPixel" LEDs, buttons, an accelerometer, and some other sensors.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit CLUE](../machine/clue-alpha)
-
-## Flashing
-
-### UF2
-
-The CLUE comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your CLUE into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=clue-alpha [PATH TO YOUR PROGRAM]
- ```
-
-- The CLUE board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your CLUE board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the CLUE board ready to receive code.
-- The CLUE board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=clue-alpha [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your CLUE board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the CLUE as a serial port. `UART0` refers to this connection.
-
-For an example that uses the built-in Neopixel LEDs, take a look at the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/examples](https://github.com/tinygo-org/drivers)
-
-Bluetooth support is now available for the Adafruit CLUE board. See https://github.com/tinygo-org/bluetooth for more information.
diff --git a/content/microcontrollers/drivers/_index.md b/content/microcontrollers/drivers/_index.md
deleted file mode 100644
index da58ab12..00000000
--- a/content/microcontrollers/drivers/_index.md
+++ /dev/null
@@ -1,71 +0,0 @@
----
-title: "Drivers"
-chapter: true
-weight: 90
----
-
-# Drivers
-
-TinyGo has driver support for 53 different sensors and devices such as digital accelerometers and multicolor LEDs.
-
-All of the drivers code is in the TinyGo Drivers repository located at [https://github.com/tinygo-org/drivers/](https://github.com/tinygo-org/drivers/).
-
-The following 53 devices are supported.
-
-| Device Name | Interface Type |
-|----------|-------------|
-| [ADT7410 I2C Temperature Sensor](https://www.analog.com/media/en/technical-documentation/data-sheets/ADT7410.pdf) | I2C |
-| [ADXL345 accelerometer](http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf) | I2C |
-| [AMG88xx 8x8 Thermal camera sensor](https://cdn-learn.adafruit.com/assets/assets/000/043/261/original/Grid-EYE_SPECIFICATIONS%28Reference%29.pdf) | I2C |
-| [APA102 RGB LED](https://cdn-shop.adafruit.com/product-files/2343/APA102C.pdf) | SPI |
-| [AT24CX 2-wire serial EEPROM](https://www.openimpulse.com/blog/wp-content/uploads/wpsc/downloadables/24C32-Datasheet.pdf) | I2C |
-| [BBC micro:bit LED matrix](https://github.com/bbcmicrobit/hardware/blob/master/SCH_BBC-Microbit_V1.3B.pdf) | GPIO |
-| [BH1750 ambient light sensor](https://www.mouser.com/ds/2/348/bh1750fvi-e-186247.pdf) | I2C |
-| [BlinkM RGB LED](http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf) | I2C |
-| [BME280 humidity/pressure sensor](https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf) | I2C |
-| [BMI160 accelerometer/gyroscope](https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi160-ds000.pdf) | SPI |
-| [BMP180 barometer](https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf) | I2C |
-| [BMP280 temperature/barometer](https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp280-ds001.pdf) | I2C |
-| [Buzzer](https://en.wikipedia.org/wiki/Buzzer#Piezoelectric) | GPIO |
-| [DS1307 real time clock](https://datasheets.maximintegrated.com/en/ds/DS1307.pdf) | I2C |
-| [DS3231 real time clock](https://datasheets.maximintegrated.com/en/ds/DS3231.pdf) | I2C |
-| [ESP32 as WiFi Coprocessor with Arduino nina-fw](https://github.com/arduino/nina-fw) | SPI |
-| [ESP8266/ESP32 AT Command set for WiFi/TCP/UDP](https://github.com/espressif/esp32-at) | UART |
-| [GPS module](https://www.u-blox.com/en/product/neo-6-series) | I2C/UART |
-| [HC-SR04 Ultrasonic distance sensor](https://cdn.sparkfun.com/datasheets/Sensors/Proximity/HCSR04.pdf) | GPIO |
-| [HD44780 LCD controller](https://www.sparkfun.com/datasheets/LCD/HD44780.pdf) | GPIO/I2C |
-| [HUB75 RGB led matrix](https://cdn-learn.adafruit.com/downloads/pdf/32x16-32x32-rgb-led-matrix.pdf) | SPI |
-| [ILI9341 TFT color display](https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf) | SPI |
-| [L293x motor driver](https://www.ti.com/lit/ds/symlink/l293d.pdf) | GPIO/PWM |
-| [L9110x motor driver](https://www.elecrow.com/download/datasheet-l9110.pdf) | GPIO/PWM |
-| [LIS2MDL magnetometer](https://www.st.com/resource/en/datasheet/lis2mdl.pdf) | I2C |
-| [LIS3DH accelerometer](https://www.st.com/resource/en/datasheet/lis3dh.pdf) | I2C |
-| [LSM6DS3 accelerometer](https://www.st.com/resource/en/datasheet/lsm6ds3.pdf) | I2C |
-| [MAG3110 magnetometer](https://www.nxp.com/docs/en/data-sheet/MAG3110.pdf) | I2C |
-| [MCP3008 analog to digital converter (ADC)](http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf) | SPI |
-| [Microphone - PDM](https://cdn-learn.adafruit.com/assets/assets/000/049/977/original/MP34DT01-M.pdf) | I2S/PDM |
-| [MMA8653 accelerometer](https://www.nxp.com/docs/en/data-sheet/MMA8653FC.pdf) | I2C |
-| [MPU6050 accelerometer/gyroscope](https://store.invensense.com/datasheets/invensense/MPU-6050_DataSheet_V3%204.pdf) | I2C |
-| [PCD8544 display](http://eia.udg.edu/~forest/PCD8544_1.pdf) | SPI |
-| [Resistive Touchscreen (4-wire)](http://ww1.microchip.com/downloads/en/Appnotes/doc8091.pdf) | GPIO |
-| [Semihosting](https://wiki.segger.com/Semihosting) | Debug |
-| [Shift register (PISO)](https://en.wikipedia.org/wiki/Shift_register#Parallel-in_serial-out_\(PISO\)) | GPIO |
-| [Shift registers (SIPO)](https://en.wikipedia.org/wiki/Shift_register#Serial-in_parallel-out_(SIPO)) | GPIO |
-| [SHT3x Digital Humidity Sensor](https://www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/0_Datasheets/Humidity/Sensirion_Humidity_Sensors_SHT3x_Datasheet_digital.pdf) | I2C |
-| [SPI NOR Flash Memory](https://en.wikipedia.org/wiki/Flash_memory#NOR_flash) | SPI/QSPI |
-| [SSD1306 OLED display](https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf) | I2C / SPI |
-| [SSD1331 TFT color display](https://www.crystalfontz.com/controllers/SolomonSystech/SSD1331/381/) | SPI |
-| [SSD1351 OLED display](https://download.mikroe.com/documents/datasheets/ssd1351-revision-1.3.pdf) | SPI |
-| [ST7735 TFT color display](https://www.crystalfontz.com/controllers/Sitronix/ST7735R/319/) | SPI |
-| [ST7789 TFT color display](https://cdn-shop.adafruit.com/product-files/3787/3787_tft_QT154H2201__________20190228182902.pdf) | SPI |
-| [Stepper motor "Easystepper" controller](https://en.wikipedia.org/wiki/Stepper_motor) | GPIO |
-| [Thermistor](https://www.farnell.com/datasheets/33552.pdf) | ADC |
-| [TMP102 I2C Temperature Sensor](https://download.mikroe.com/documents/datasheets/tmp102-data-sheet.pdf) | I2C |
-| [VEML6070 UV light sensor](https://www.vishay.com/docs/84277/veml6070.pdf) | I2C |
-| [VL53L1X time-of-flight distance sensor](https://www.st.com/resource/en/datasheet/vl53l1x.pdf) | I2C |
-| [Waveshare 2.13" (B & C) e-paper display](https://www.waveshare.com/w/upload/d/d3/2.13inch-e-paper-b-Specification.pdf) | SPI |
-| [Waveshare 2.13" e-paper display](https://www.waveshare.com/w/upload/e/e6/2.13inch_e-Paper_Datasheet.pdf) | SPI |
-| [Waveshare 4.2" e-paper B/W display](https://www.waveshare.com/w/upload/6/6a/4.2inch-e-paper-specification.pdf) | SPI |
-| [WS2812 RGB LED](https://cdn-shop.adafruit.com/datasheets/WS2812.pdf) | GPIO |
-
-We also give you the ability to add new drivers. If your device isn't listed here, please raise an issue in the [issue tracker](https://github.com/tinygo-org/drivers/issues).
diff --git a/content/microcontrollers/esp32-coreboard-v2.md b/content/microcontrollers/esp32-coreboard-v2.md
deleted file mode 100644
index 3aef58b8..00000000
--- a/content/microcontrollers/esp32-coreboard-v2.md
+++ /dev/null
@@ -1,96 +0,0 @@
----
-title: "ESP32 - Core board"
-weight: 3
----
-
-The esp32-coreboard-v2 is a development board based on the [Espressif ESP32](https://www.espressif.com/en/products/socs/esp32) a powerful chip that is used on many different board mostly because of the built-in radio that can be used for WiFi or Bluetooth wireless connections.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | Not Yet |
-| ADC | YES | Not Yet |
-| PWM | YES | Not Yet |
-| WiFi | YES | Not Yet |
-| Bluetooth | YES | Not Yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the ESP32 Core board v2](../machine/esp32-coreboard-v2)
-
-## Flashing
-
-### CLI Flashing on Linux
-
-You need to install the Espressif toolchain for Linux to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/linux-setup.html#standard-setup-of-toolchain-for-linux
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-coreboard-v2 -port=/dev/ttyUSB0 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### CLI Flashing on macOS
-
-You need to install the Espressif toolchain for macOS to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/macos-setup.html
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-coreboard-v2 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### CLI Flashing on Windows
-
-You need to install the Espressif toolchain for Windows to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/windows-setup.html
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-coreboard-v2 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### Troubleshooting
-
-Goes here
-
-## Notes
-
-Goes here
diff --git a/content/microcontrollers/esp32-mini32.md b/content/microcontrollers/esp32-mini32.md
deleted file mode 100644
index 832815ba..00000000
--- a/content/microcontrollers/esp32-mini32.md
+++ /dev/null
@@ -1,96 +0,0 @@
----
-title: "ESP32 - mini32"
-weight: 3
----
-
-The mini32 is a small development board based on the popular [Espressif ESP32](https://www.espressif.com/en/products/socs/esp32). The ESP32 includes a built-in radio that can be used for WiFi or Bluetooth wireless connections.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | Not Yet |
-| ADC | YES | Not Yet |
-| PWM | YES | Not Yet |
-| WiFi | YES | Not Yet |
-| Bluetooth | YES | Not Yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the ESP32-mini32](../machine/esp32-mini32)
-
-## Flashing
-
-### CLI Flashing on Linux
-
-You need to install the Espressif toolchain for Linux to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/linux-setup.html#standard-setup-of-toolchain-for-linux
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-mini32 -port=/dev/ttyUSB0 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### CLI Flashing on macOS
-
-You need to install the Espressif toolchain for macOS to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/macos-setup.html
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-mini32 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### CLI Flashing on Windows
-
-You need to install the Espressif toolchain for Windows to use TinyGo with the ESP32:
-
-https://docs.espressif.com/projects/esp-idf/en/release-v3.0/get-started/windows-setup.html
-
-In addition, you must install the `esptool` flashing tool:
-
-https://github.com/espressif/esptool#easy-installation
-
-Now you should be able to flash your board as follows:
-
-- Plug your ESP32 board into your computer's USB port.
-- Build and flash your TinyGo code using the `tinygo flash` command. This command flashes the ESP32 with the blinky1 example:
-
- ```
- tinygo flash -target=esp32-mini32 examples/blinky1
- ```
-
-- The ESP32 board should restart and then begin running your program.
-
-### Troubleshooting
-
-Goes here
-
-## Notes
-
-Goes here
diff --git a/content/microcontrollers/feather-m0.md b/content/microcontrollers/feather-m0.md
deleted file mode 100644
index 40cdea2c..00000000
--- a/content/microcontrollers/feather-m0.md
+++ /dev/null
@@ -1,57 +0,0 @@
----
-title: "Adafruit Feather M0"
-weight: 3
----
-
-The [Adafruit Feather M0](https://www.adafruit.com/product/3403) is a tiny ARM development board based on the Atmel [ATSAMD21G18](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit Feather M0](../machine/feather-m0)
-
-## Flashing
-
-### UF2
-
-The Feather M0 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Feather M0 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=feather-m0 [PATH TO YOUR PROGRAM]
- ```
-
-- The Feather M0 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Feather M0 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Feather M0 board ready to receive code.
-- The Feather M0 board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=feather-m0 [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your Feather M0 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Feather M0 as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/feather-m4.md b/content/microcontrollers/feather-m4.md
deleted file mode 100644
index bd28de84..00000000
--- a/content/microcontrollers/feather-m4.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: "Adafruit Feather M4"
-weight: 3
----
-
-The [Adafruit Feather M4](https://www.adafruit.com/product/3857) is a tiny ARM development board based on the Atmel [ATSAMD51J19](https://www.microchip.com/wwwproducts/en/ATSAMD51J19A) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit Feather M4](../machine/feather-m4)
-
-## Flashing
-
-### UF2
-
-The Feather M4 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Feather M4 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=feather-m4 [PATH TO YOUR PROGRAM]
- ```
-
-- The Feather M4 board should restart and then begin running your program.
-
-
-### Troubleshooting
-
-If you have troubles getting your Feather M4 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Feather M4 board ready to receive code.
-- The Feather M4 board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=feather-m4 [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your Feather M4 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Feather M4 as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/feather-nrf52840.md b/content/microcontrollers/feather-nrf52840.md
deleted file mode 100644
index 73551ba1..00000000
--- a/content/microcontrollers/feather-nrf52840.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-title: "Adafruit Feather nRF52840"
-weight: 3
----
-
-The [Adafruit Feather nRF52840](https://www.adafruit.com/product/4500) is a small ARM development board based on the Nordic Semiconductor [nrf52840](https://www.nordicsemi.com/eng/Products/nRF52840) processor.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit Feather nRF52840](../machine/feather-nrf52840)
-
-## Flashing
-
-### UF2
-
-The Adafruit Feather nRF52840 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Adafruit Feather nRF52840 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=feather-nrf52840 [PATH TO YOUR PROGRAM]
- ```
-
-- The Adafruit Feather nRF52840 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Adafruit Feather nRF52840 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Adafruit Feather nRF52840 board ready to receive code.
-- The Adafruit Feather nRF52840 board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=feather-nrf52840 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Adafruit Feather nRF52840 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Adafruit Feather nRF52840 as a serial port. `UART0` refers to this connection.
-
-Bluetooth support is now available for the Adafruit Feather nRF52840 board. See https://github.com/tinygo-org/bluetooth for more information.
diff --git a/content/microcontrollers/feather-stm32f405.md b/content/microcontrollers/feather-stm32f405.md
deleted file mode 100644
index daa4bcdf..00000000
--- a/content/microcontrollers/feather-stm32f405.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Adafruit Feather STM32F405"
-weight: 3
----
-
-The [Adafruit Feather STM32F405](https://www.adafruit.com/product/4382) is a tiny ARM development board based on the ST Micro [STM32F405](https://www.st.com/resource/en/datasheet/dm00037051.pdf) family of microcontrollers.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit Feather STM32F405](../machine/feather-stm32f405)
-
-## Flashing
-
-Flashing this board using its DFU bootloader can be a bit cumbersome (see Adafruit docs at https://learn.adafruit.com/adafruit-stm32f405-feather-express/dfu-bootloader-details), but it is possible - without requiring an external programmer - by pulling the B0 pin high (you can use the board's 3.3V output pin) at bootup when connected to host PC via USB. This puts the device in bootloader mode.
-
-Once in bootloader mode, the device can be programmed using the open-source tool `dfu-util`.
-
-### CLI Flashing on Linux
-
-You must first install the `dfu-util` program in order to flash the Adafruit Feather STM32F405 board.
-
- sudo apt update
- sudo apt install dfu-util
-
-### CLI Flashing on macOS
-
-You must first install the `dfu-util` program in order to flash the Adafruit Feather STM32F405 board. You can do this using Homebrew on macOS:
-
- brew install dfu-util
-
-### CLI Flashing on Windows
-
-You must first install the `dfu-util` program in order to flash the Adafruit Feather STM32F405 board.
-
-- Download dfu-util from the website here: http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip
-- Decompress the files to a directory such as `C:\dfu-util`
-- Add `C:\dfu-util` to your `PATH`.
-
-### Troubleshooting
-
-If you run into trouble getting dfu-util installed and working on Windows, see the blog post at https://www.hanselman.com/blog/HowToFixDfuutilSTMWinUSBZadigBootloadersAndOtherFirmwareFlashingIssuesOnWindows.aspx
-
-## Notes
-
-Goes here
diff --git a/content/microcontrollers/gameboy-advance.md b/content/microcontrollers/gameboy-advance.md
deleted file mode 100644
index ddc10eaa..00000000
--- a/content/microcontrollers/gameboy-advance.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-title: "Game Boy Advance"
-weight: 3
----
-
-The [Game Boy Advance](https://en.wikipedia.org/wiki/Game_Boy_Advance) is a handheld videogame platform based on the [ARM7TDMI](http://infocenter.arm.com/help/topic/com.arm.doc.ddi0210c/DDI0210B.pdf) microcontroller.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | ? | ? |
-| UART | ? | ? |
-| SPI | ? | ? |
-| I2C | ? | ? |
-| ADC | ? | ? |
-| PWM | ? | ? |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Gameboy Advance](../machine/gameboy-advance)
-
-## Installing dependencies
-
-You can use a Game Boy Advance software emulator such as MGBA (https://mgba.io) to test your programs.
-
-
-## Building code
-
-Build your Game Boy Advance programs using `-target gameboy-advance` like this:
-
-```shell
-tinygo build -o main.gba -target gameboy-advance examples/gba-display
-```
-
-You can now use the GBA file with your emulator or flash it onto your physical hardware.
-
-## Flashing
-
-Information needed here...
diff --git a/content/microcontrollers/hifive1b.md b/content/microcontrollers/hifive1b.md
deleted file mode 100644
index 40fbe033..00000000
--- a/content/microcontrollers/hifive1b.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-title: "HiFive1 RevB"
-weight: 3
----
-
-The [HiFive1 Rev B](https://www.sifive.com/boards/hifive1-rev-b) is low-cost, Arduino-compatible development board featuring the [Freedom E310](https://www.sifive.com/chip-designer#fe310) 320+ MHz [RISC-V](https://riscv.org/) chip.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Write only |
-| I2C | YES | YES |
-| ADC | NO | NO |
-| PWM | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the SiFive HiFive1b](../machine/hifive1b)
-
-## Flashing
-
-### MSD Flashing
-
-The HiFive1 RevB comes with a bootloader that allows Mass Storage Device (MSD) flashing. This means you can just copy the compiled `.hex` file generated by TinyGo onto it, no additional flashing software is needed.
-
-- Plug your HiFive1 RevB into your computer's USB port.
-
-- The HiFive1 RevB board will appear to your computer like a USB drive.
-
-- Build and flash your TinyGo program using `tinygo flash` like this:
-
- ```shell
- tinygo flash -target=hifive1b [PATH TO YOUR PROGRAM]
- ```
-
-- The HiFive1 RevB should restart and begin running your program.
diff --git a/content/microcontrollers/itsybitsy-m0.md b/content/microcontrollers/itsybitsy-m0.md
deleted file mode 100644
index 6b49fe1f..00000000
--- a/content/microcontrollers/itsybitsy-m0.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Adafruit ItsyBitsy M0"
-weight: 3
----
-
-The [Adafruit ItsyBitsy M0](https://www.adafruit.com/product/3727) is very compact ARM development board based on the Atmel [SAMD21](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit ItsyBitsy M0](../machine/itsybitsy-m0)
-
-## Flashing
-
-### UF2
-
-The ItsyBitsy M0 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your ItsyBitsy M0 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=itsybitsy-m0 [PATH TO YOUR PROGRAM]
- ```
-
-- The ItsyBitsy M0 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your ItsyBitsy M0 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the ItsyBitsy M0 board ready to receive code.
-- The ItsyBitsy M0 board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=itsybitsy-m0 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your ItsyBitsy M0 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the ItsyBitsy M0 as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/itsybitsy-m4.md b/content/microcontrollers/itsybitsy-m4.md
deleted file mode 100644
index 411c9282..00000000
--- a/content/microcontrollers/itsybitsy-m4.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Adafruit ItsyBitsy M4"
-weight: 3
----
-
-The [Adafruit ItsyBitsy M4](https://www.adafruit.com/product/3800) is very compact ARM development board based on the Atmel [SAMD51](https://www.microchip.com/wwwproducts/en/ATSAMD51G19A) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit ItsyBitsy M4](../machine/itsybitsy-m4)
-
-## Flashing
-
-### UF2
-
-The ItsyBitsy M4 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your ItsyBitsy M4 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=itsybitsy-m4 [PATH TO YOUR PROGRAM]
- ```
-
-- The ItsyBitsy M4 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your ItsyBitsy M4 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the ItsyBitsy M4 board ready to receive code.
-- The ItsyBitsy M4 board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
- ```shell
- tinygo flash -target=itsybitsy-m4 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your ItsyBitsy M4 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the ItsyBitsy M4 as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/itsybitsy-nrf52840.md b/content/microcontrollers/itsybitsy-nrf52840.md
deleted file mode 100644
index 7c880d64..00000000
--- a/content/microcontrollers/itsybitsy-nrf52840.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: "Adafruit ItsyBitsy-nRF52840"
-weight: 3
----
-
-The [Adafruit ItsyBitsy-nRF52840](https://www.adafruit.com/product/4333) is a small ARM development board based on the Nordic Semiconductor [nrf52840](https://www.nordicsemi.com/eng/Products/nRF52840) processor.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the ItsyBitsy-nRF52840](../machine/itsybitsy-nrf52840)
-
-## Flashing
-
-### UF2
-
-The ItsyBitsy-nRF52840 comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your ItsyBitsy-nRF52840 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=itsybitsy-nrf52840 [PATH TO YOUR PROGRAM]
- ```
-
-- The ItsyBitsy-nRF52840 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your ItsyBitsy-nRF52840 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the ItsyBitsy-nRF52840 board ready to receive code.
-- The ItsyBitsy-nRF52840 board will appear to your computer like a USB drive.
-- Now try running the command:
-
- ```shell
- tinygo flash -target=itsybitsy-nrf52840 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your ItsyBitsy-nRF52840 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the ItsyBitsy-nRF52840 as a serial port. `UART0` refers to this connection.
-
-For an example that uses the built-in Neopixel LEDs, take a look at the TinyGo drivers repository located at [https://github.com/tinygo-org/drivers/tree/release/examples](https://github.com/tinygo-org/drivers)
-
-Bluetooth support is now available for the ItsyBitsy-nRF52840 board. See https://github.com/tinygo-org/bluetooth for more information.
diff --git a/content/microcontrollers/machine/arduino-mega2560.md b/content/microcontrollers/machine/arduino-mega2560.md
deleted file mode 100644
index 82916f0d..00000000
--- a/content/microcontrollers/machine/arduino-mega2560.md
+++ /dev/null
@@ -1,664 +0,0 @@
-
----
-title: arduino-mega2560
----
-
-
-## Constants
-
-```go
-const (
- AREF Pin = NoPin
- LED Pin = PB7
-
- A0 Pin = PF0
- A1 Pin = PF1
- A2 Pin = PF2
- A3 Pin = PF3
- A4 Pin = PF4
- A5 Pin = PF5
- A6 Pin = PF6
- A7 Pin = PF7
- A8 Pin = PK0
- A9 Pin = PK1
- A10 Pin = PK2
- A11 Pin = PK3
- A12 Pin = PK4
- A13 Pin = PK5
- A14 Pin = PK6
- A15 Pin = PK7
-
- // Analog Input
- ADC0 Pin = PF0
- ADC1 Pin = PF1
- ADC2 Pin = PF2
- ADC3 Pin = PF3
- ADC4 Pin = PF4
- ADC5 Pin = PF5
- ADC6 Pin = PF6
- ADC7 Pin = PF7
- ADC8 Pin = PK0
- ADC9 Pin = PK1
- ADC10 Pin = PK2
- ADC11 Pin = PK3
- ADC12 Pin = PK4
- ADC13 Pin = PK5
- ADC14 Pin = PK6
- ADC15 Pin = PK7
-
- // Digital pins
- D0 Pin = PE0
- D1 Pin = PE1
- D2 Pin = PE4
- D3 Pin = PE5
- D4 Pin = PG5
- D5 Pin = PE3
- D6 Pin = PH3
- D7 Pin = PH4
- D8 Pin = PH5
- D9 Pin = PH6
- D10 Pin = PB4
- D11 Pin = PB5
- D12 Pin = PB6
- D13 Pin = PB7
- D14 Pin = PJ1
- D15 Pin = PJ0
- D16 Pin = PH1
- D17 Pin = PH0
- D18 Pin = PD3
- D19 Pin = PD2
- D20 Pin = PD1
- D21 Pin = PD0
- D22 Pin = PA0
- D23 Pin = PA1
- D24 Pin = PA2
- D25 Pin = PA3
- D26 Pin = PA4
- D27 Pin = PA5
- D28 Pin = PA6
- D29 Pin = PA7
- D30 Pin = PC7
- D31 Pin = PC6
- D32 Pin = PC5
- D33 Pin = PC4
- D34 Pin = PC3
- D35 Pin = PC2
- D36 Pin = PC1
- D37 Pin = PC0
- D38 Pin = PD7
- D39 Pin = PG2
- D40 Pin = PG1
- D41 Pin = PG0
- D42 Pin = PL7
- D43 Pin = PL6
- D44 Pin = PL5
- D45 Pin = PL4
- D46 Pin = PL3
- D47 Pin = PL2
- D48 Pin = PL1
- D49 Pin = PL0
- D50 Pin = PB3
- D51 Pin = PB2
- D52 Pin = PB1
- D53 Pin = PB0
-)
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD7 = portD + 7
- PE0 = portE + 0
- PE1 = portE + 1
- PE3 = portE + 3
- PE4 = portE + 4
- PE5 = portE + 5
- PE6 = portE + 6
- PF0 = portF + 0
- PF1 = portF + 1
- PF2 = portF + 2
- PF3 = portF + 3
- PF4 = portF + 4
- PF5 = portF + 5
- PF6 = portF + 6
- PF7 = portF + 7
- PG0 = portG + 0
- PG1 = portG + 1
- PG2 = portG + 2
- PG5 = portG + 5
- PH0 = portH + 0
- PH1 = portH + 1
- PH3 = portH + 3
- PH4 = portH + 4
- PH5 = portH + 5
- PH6 = portH + 6
- PJ0 = portJ + 0
- PJ1 = portJ + 1
- PK0 = portK + 0
- PK1 = portK + 1
- PK2 = portK + 2
- PK3 = portK + 3
- PK4 = portH + 4
- PK5 = portH + 5
- PK6 = portH + 6
- PK7 = portH + 7
- PL0 = portL + 0
- PL1 = portL + 1
- PL2 = portL + 2
- PL3 = portL + 3
- PL4 = portL + 4
- PL5 = portL + 5
- PL6 = portL + 6
- PL7 = portL + 7
-)
-```
-
-
-
-```go
-const (
- PinInput PinMode = iota
- PinInputPullup
- PinOutput
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var I2C0 = I2C{}
-```
-
-I2C0 is the only I2C interface on most AVRs.
-
-
-```go
-var (
- // UART0 is the hardware serial port on the AVR.
- UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
-has an ADC of 10 bits precision so the lower 6 bits will be zero.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
-}
-```
-
-I2C on AVR.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the pin to input or output.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set changes the value of the GPIO pin. The pin must be configured as output.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the AVR.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART on the AVR. Defaults to 9600 baud on Arduino.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/arduino-nano.md b/content/microcontrollers/machine/arduino-nano.md
deleted file mode 100644
index 312a1ec5..00000000
--- a/content/microcontrollers/machine/arduino-nano.md
+++ /dev/null
@@ -1,598 +0,0 @@
-
----
-title: arduino-nano
----
-
-
-## Constants
-
-```go
-const (
- D0 = PD0 // RX0
- D1 = PD1 // TX1
- D2 = PD2
- D3 = PD3
- D4 = PD4
- D5 = PD5
- D6 = PD6
- D7 = PD7
- D8 = PB0
- D9 = PB1
- D10 = PB2
- D11 = PB3
- D12 = PB4
- D13 = PB5
-)
-```
-
-Digital pins.
-
-
-```go
-const LED Pin = D13
-```
-
-LED on the Arduino
-
-
-```go
-const (
- ADC0 Pin = PC0
- ADC1 Pin = PC1
- ADC2 Pin = PC2
- ADC3 Pin = PC3
- ADC4 Pin = PC4 // Used by TWI for SDA
- ADC5 Pin = PC5 // Used by TWI for SCL
-)
-```
-
-ADC on the Arduino
-
-
-```go
-const (
- UART_TX_PIN Pin = PD1
- UART_RX_PIN Pin = PD0
-)
-```
-
-UART pins
-
-
-```go
-const (
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
-)
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinInputPullup
- PinOutput
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var I2C0 = I2C{}
-```
-
-I2C0 is the only I2C interface on most AVRs.
-
-
-```go
-var (
- // UART0 is the hardware serial port on the AVR.
- UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
-has an ADC of 10 bits precision so the lower 6 bits will be zero.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
-}
-```
-
-I2C on AVR.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value. On the AVR this is normally a
-8-bit value ranging from 0 to 255.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the pin to input or output.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set changes the value of the GPIO pin. The pin must be configured as output.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the AVR.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART on the AVR. Defaults to 9600 baud on Arduino.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/arduino-nano33.md b/content/microcontrollers/machine/arduino-nano33.md
deleted file mode 100644
index d2650851..00000000
--- a/content/microcontrollers/machine/arduino-nano33.md
+++ /dev/null
@@ -1,1663 +0,0 @@
-
----
-title: arduino-nano33
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0x07738135
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- RX0 Pin = PB23 // UART2 RX
- TX1 Pin = PB22 // UART2 TX
-
- D2 Pin = PB10 // PWM available
- D3 Pin = PB11 // PWM available
- D4 Pin = PA07
- D5 Pin = PA05 // PWM available
- D6 Pin = PA04 // PWM available
- D7 Pin = PA06
-
- D8 Pin = PA18
- D9 Pin = PA20 // PWM available
- D10 Pin = PA21 // PWM available
- D11 Pin = PA16 // PWM available
- D12 Pin = PA19 // PWM available
-
- D13 Pin = PA17
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 Pin = PA02 // ADC/AIN[0]
- A1 Pin = PB02 // ADC/AIN[10]
- A2 Pin = PA11 // ADC/AIN[19]
- A3 Pin = PA10 // ADC/AIN[18],
- A4 Pin = PB08 // ADC/AIN[2], SCL: SERCOM2/PAD[1]
- A5 Pin = PB09 // ADC/AIN[3], SDA: SERCOM2/PAD[1]
- A6 Pin = PA09 // ADC/AIN[17]
- A7 Pin = PB03 // ADC/AIN[11]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN Pin = PA24
- USBCDC_DP_PIN Pin = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN Pin = PA22
- UART_RX_PIN Pin = PA23
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SDA_PIN Pin = A4 // SDA: SERCOM4/PAD[1]
- SCL_PIN Pin = A5 // SCL: SERCOM4/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = D13 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN Pin = D11 // SDO: SERCOM1/PAD[0]
- SPI0_SDI_PIN Pin = D12 // SDI: SERCOM1/PAD[3]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- NINA_SDO Pin = PA12
- NINA_SDI Pin = PA13
- NINA_CS Pin = PA14
- NINA_SCK Pin = PA15
- NINA_GPIO0 Pin = PA27
- NINA_RESETN Pin = PA08
- NINA_ACK Pin = PA28
- NINA_TX Pin = PA22
- NINA_RX Pin = PA23
-)
-```
-
-NINA-W102 Pins
-
-
-```go
-const (
- I2S_SCK_PIN Pin = PA10
- I2S_SD_PIN Pin = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino Nano 33.
-)
-```
-
-I2S pins
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM3_USART,
- SERCOM: 3,
- }
-)
-```
-
-UART1 on the Arduino Nano 33 connects to the onboard NINA-W102 WiFi chip.
-
-
-```go
-var (
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM5_USART,
- SERCOM: 5,
- }
-)
-```
-
-UART2 on the Arduino Nano 33 connects to the normal TX/RX pins.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM4_I2CM,
- SERCOM: 4,
- }
-)
-```
-
-I2C on the Arduino Nano 33.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM1_SPI,
- SERCOM: 1,
- }
-)
-```
-
-SPI on the Arduino Nano 33.
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: sam.SERCOM2_SPI,
- SERCOM: 2,
- }
- NINA_SPI = SPI1
-)
-```
-
-SPI1 is connected to the NINA-W102 chip on the Arduino Nano 33.
-
-
-```go
-var (
- I2S0 = I2S{Bus: sam.I2S}
-)
-```
-
-I2S on the Arduino Nano 33.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/arduino-zero.md b/content/microcontrollers/machine/arduino-zero.md
deleted file mode 100644
index 36e685e6..00000000
--- a/content/microcontrollers/machine/arduino-zero.md
+++ /dev/null
@@ -1,1603 +0,0 @@
-
----
-title: arduino-zero
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0x07738135
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA11 // RX
- D1 = PA10 // TX
- D2 = PA14
- D3 = PA09 // PWM available
- D4 = PA08 // PWM available
- D5 = PA15 // PWM available
- D6 = PA20 // PWM available
- D7 = PA21
-)
-```
-
-GPIO Pins - Digital Low
-
-
-```go
-const (
- D8 = PA06 // PWM available
- D9 = PA07 // PWM available
- D10 = PA18 // PWM available
- D11 = PA16 // PWM available
- D12 = PA19 // PWM available
- D13 = PA17 // PWM available
-)
-```
-
-GPIO Pins - Digital High
-
-
-```go
-const (
- LED = LED1
- LED1 Pin = D13
- LED2 Pin = PA27 // TX LED
- LED3 Pin = PB03 // RX LED
-)
-```
-
-LEDs on the Arduino Zero
-
-
-```go
-const (
- AREF Pin = PA03
- ADC0 Pin = PA02
- ADC1 Pin = PB08
- ADC2 Pin = PB09
- ADC3 Pin = PA04
- ADC4 Pin = PA05
- ADC5 Pin = PB02
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SPI0_SDO_PIN Pin = PA16 // MOSI: SERCOM1/PAD[0]
- SPI0_SDI_PIN Pin = PA19 // MISO: SERCOM1/PAD[2]
- SPI0_SCK_PIN Pin = PA17 // SCK: SERCOM1/PAD[3]
-)
-```
-
-SPI pins - EDBG connected
-
-
-```go
-const (
- SPI1_SDO_PIN Pin = PB10 // MOSI: SERCOM4/PAD[2] - Pin 4
- SPI1_SDI_PIN Pin = PA12 // MISO: SERCOM4/PAD[0] - Pin 1
- SPI1_SCK_PIN Pin = PB11 // SCK: SERCOM4/PAD[3] - Pin 3
-)
-```
-
-SPI pins (Legacy ICSP)
-
-
-```go
-const (
- SDA_PIN Pin = PA22 // SDA: SERCOM3/PAD[0] - Pin 20
- SCL_PIN Pin = PA23 // SCL: SERCOM3/PAD[1] - Pin 21
-)
-```
-
-I2C pins - EDBG connected
-
-
-```go
-const (
- I2S_SCK_PIN Pin = PA10
- I2S_SD_PIN Pin = PA07
- I2S_WS_PIN Pin = PA11
-)
-```
-
-I2S pins - might not be exposed
-
-
-```go
-const (
- UART_RX_PIN Pin = D0
- UART_TX_PIN Pin = D1
-)
-```
-
-UART0 pins - EDBG connected
-
-
-```go
-const (
- USBCDC_DM_PIN Pin = PA24
- USBCDC_DP_PIN Pin = PA25
-)
-```
-
-'native' USB port pins
-
-
-```go
-const (
- XIN32 Pin = PA00
- XOUT32 Pin = PA01
-)
-```
-
-32.768 KHz Crystal
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/arduino.md b/content/microcontrollers/machine/arduino.md
deleted file mode 100644
index edf8d3cd..00000000
--- a/content/microcontrollers/machine/arduino.md
+++ /dev/null
@@ -1,598 +0,0 @@
-
----
-title: arduino
----
-
-
-## Constants
-
-```go
-const (
- D0 = PD0 // RX
- D1 = PD1 // TX
- D2 = PD2
- D3 = PD3
- D4 = PD4
- D5 = PD5
- D6 = PD6
- D7 = PD7
- D8 = PB0
- D9 = PB1
- D10 = PB2
- D11 = PB3
- D12 = PB4
- D13 = PB5
-)
-```
-
-Digital pins, marked as plain numbers on the board.
-
-
-```go
-const LED Pin = D13
-```
-
-LED on the Arduino
-
-
-```go
-const (
- ADC0 Pin = PC0
- ADC1 Pin = PC1
- ADC2 Pin = PC2
- ADC3 Pin = PC3
- ADC4 Pin = PC4 // Used by TWI for SDA
- ADC5 Pin = PC5 // Used by TWI for SCL
-)
-```
-
-ADC on the Arduino
-
-
-```go
-const (
- UART_TX_PIN Pin = PD1
- UART_RX_PIN Pin = PD0
-)
-```
-
-UART pins
-
-
-```go
-const (
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
-)
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinInputPullup
- PinOutput
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var I2C0 = I2C{}
-```
-
-I2C0 is the only I2C interface on most AVRs.
-
-
-```go
-var (
- // UART0 is the hardware serial port on the AVR.
- UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
-has an ADC of 10 bits precision so the lower 6 bits will be zero.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
-}
-```
-
-I2C on AVR.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value. On the AVR this is normally a
-8-bit value ranging from 0 to 255.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the pin to input or output.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set changes the value of the GPIO pin. The pin must be configured as output.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the AVR.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART on the AVR. Defaults to 9600 baud on Arduino.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/atmega1284p.md b/content/microcontrollers/machine/atmega1284p.md
deleted file mode 100644
index 72c2410a..00000000
--- a/content/microcontrollers/machine/atmega1284p.md
+++ /dev/null
@@ -1,525 +0,0 @@
-
----
-title: atmega1284p
----
-
-
-## Constants
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
-)
-```
-
-
-
-```go
-const (
- PinInput PinMode = iota
- PinInputPullup
- PinOutput
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var I2C0 = I2C{}
-```
-
-I2C0 is the only I2C interface on most AVRs.
-
-
-```go
-var (
- // UART0 is the hardware serial port on the AVR.
- UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff. The AVR
-has an ADC of 10 bits precision so the lower 6 bits will be zero.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
-}
-```
-
-I2C on AVR.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the pin to input or output.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*volatile.Register8, uint8)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: there are no separate pin set/clear registers on the AVR. The
-returned mask is only valid as long as no other pin in the same port has been
-changed.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set changes the value of the GPIO pin. The pin must be configured as output.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the AVR.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART on the AVR. Defaults to 9600 baud on Arduino.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/bluepill.md b/content/microcontrollers/machine/bluepill.md
deleted file mode 100644
index f254f3d5..00000000
--- a/content/microcontrollers/machine/bluepill.md
+++ /dev/null
@@ -1,669 +0,0 @@
-
----
-title: bluepill
----
-
-
-## Constants
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PA8 = portA + 8
- PA9 = portA + 9
- PA10 = portA + 10
- PA11 = portA + 11
- PA12 = portA + 12
- PA13 = portA + 13
- PA14 = portA + 14
- PA15 = portA + 15
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PB8 = portB + 8
- PB9 = portB + 9
- PB10 = portB + 10
- PB11 = portB + 11
- PB12 = portB + 12
- PB13 = portB + 13
- PB14 = portB + 14
- PB15 = portB + 15
- PC13 = portC + 13
- PC14 = portC + 14
- PC15 = portC + 15
-)
-```
-
-https://wiki.stm32duino.com/index.php?title=File:Bluepillpinout.gif
-
-
-```go
-const (
- LED = PC13
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN = PA9
- UART_RX_PIN = PA10
- UART_ALT_TX_PIN = PB6
- UART_ALT_RX_PIN = PB7
-)
-```
-
-UART pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA5
- SPI0_SDO_PIN = PA7
- SPI0_SDI_PIN = PA6
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = PB7
- SCL_PIN = PB6
-)
-```
-
-I2C pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = 0 // Input mode
- PinOutput10MHz PinMode = 1 // Output mode, max speed 10MHz
- PinOutput2MHz PinMode = 2 // Output mode, max speed 2MHz
- PinOutput50MHz PinMode = 3 // Output mode, max speed 50MHz
- PinOutput PinMode = PinOutput2MHz
-
- PinInputModeAnalog PinMode = 0 // Input analog mode
- PinInputModeFloating PinMode = 4 // Input floating mode
- PinInputModePullUpDown PinMode = 8 // Input pull up/down mode
- PinInputModeReserved PinMode = 12 // Input mode (reserved)
-
- PinOutputModeGPPushPull PinMode = 0 // Output mode general purpose push/pull
- PinOutputModeGPOpenDrain PinMode = 4 // Output mode general purpose open drain
- PinOutputModeAltPushPull PinMode = 8 // Output mode alt. purpose push/pull
- PinOutputModeAltOpenDrain PinMode = 12 // Output mode alt. purpose open drain
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- // USART1 is the first hardware serial port on the STM32.
- // Both UART0 and UART1 refer to USART1.
- UART0 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART1,
- }
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART2,
- }
-)
-```
-
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- SPI1 = SPI{Bus: stm32.SPI1}
- SPI0 = SPI1
-)
-```
-
-There are 3 SPI interfaces on the STM32F103xx.
-Since the first interface is named SPI1, both SPI0 and SPI1 refer to SPI1.
-TODO: implement SPI2 and SPI3.
-
-
-```go
-var (
- I2C1 = I2C{Bus: stm32.I2C1}
- I2C0 = I2C1
-)
-```
-
-There are 2 I2C interfaces on the STM32F103xx.
-Since the first interface is named I2C1, both I2C0 and I2C1 refer to I2C1.
-TODO: implement I2C2.
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *stm32.I2C_Type
-}
-```
-
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given I/O settings.
-stm32f1xx uses different technique for setting the GPIO pins than the stm32f407
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *stm32.SPI_Type
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the STM32 SPI1 interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *stm32.USART_Type
- Interrupt interrupt.Interrupt
-}
-```
-
-UART representation
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART. Defer to chip-specific
-routines for calculation
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/circuitplay-bluefruit.md b/content/microcontrollers/machine/circuitplay-bluefruit.md
deleted file mode 100644
index da6dc975..00000000
--- a/content/microcontrollers/machine/circuitplay-bluefruit.md
+++ /dev/null
@@ -1,1380 +0,0 @@
-
----
-title: circuitplay-bluefruit
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = false
-```
-
-
-
-```go
-const (
- D0 = P0_30
- D1 = P0_14
- D2 = P0_05
- D3 = P0_04
- D4 = P1_02
- D5 = P1_15
- D6 = P0_02
- D7 = P1_06
- D8 = P0_13
- D9 = P0_29
- D10 = P0_03
- D11 = P1_04
- D12 = P0_26
- D13 = P1_14
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A1 = P0_02
- A2 = P0_29
- A3 = P0_03
- A4 = P0_04
- A5 = P0_05
- A6 = P0_30
- A7 = P0_14
- A8 = P0_28
- A9 = P0_31
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D13
- NEOPIXELS = D8
-
- BUTTONA = D4
- BUTTONB = D5
- SLIDER = D7 // built-in slide switch
-
- BUTTON = BUTTONA
- BUTTON1 = BUTTONB
-
- LIGHTSENSOR = A8
- TEMPSENSOR = A9
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN = P0_14 // PORTB
- UART_RX_PIN = P0_30 // PORTB
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = P0_05 // I2C0 external
- SCL_PIN = P0_04 // I2C0 external
-
- SDA1_PIN = P0_00 // I2C1 internal
- SCL1_PIN = P0_01 // I2C1 internal
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = P0_19 // SCK
- SPI0_SDO_PIN = P0_21 // SDO
- SPI0_SDI_PIN = P0_23 // SDI
-)
-```
-
-SPI pins (internal flash)
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- DFU_MAGIC_SERIAL_ONLY_RESET = 0x4e
- DFU_MAGIC_UF2_RESET = 0x57
- DFU_MAGIC_OTA_RESET = 0xA8
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func EnterOTABootloader
-
-```go
-func EnterOTABootloader()
-```
-
-EnterOTABootloader resets the chip into the bootloader so that it can be
-flashed via an OTA update
-
-
-### func EnterSerialBootloader
-
-```go
-func EnterSerialBootloader()
-```
-
-EnterSerialBootloader resets the chip into the serial bootloader. After
-reset, it can be flashed using serial/nrfutil.
-
-
-### func EnterUF2Bootloader
-
-```go
-func EnterUF2Bootloader()
-```
-
-EnterUF2Bootloader resets the chip into the UF2 bootloader. After reset, it
-can be flashed via nrfutil or by copying a UF2 file to the mass storage device
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/circuitplay-express.md b/content/microcontrollers/machine/circuitplay-express.md
deleted file mode 100644
index 17fefef7..00000000
--- a/content/microcontrollers/machine/circuitplay-express.md
+++ /dev/null
@@ -1,1641 +0,0 @@
-
----
-title: circuitplay-express
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PB09
- D1 = PB08
- D2 = PB02
- D3 = PB03
- D4 = PA28
- D5 = PA14
- D6 = PA05
- D7 = PA15
- D8 = PB23
- D9 = PA06
- D10 = PA07
- D11 = NoPin // does not seem to exist
- D12 = PA02
- D13 = PA17 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // PWM available, also ADC/AIN[0]
- A1 = PA05 // ADC/AIN[5]
- A2 = PA06 // PWM available, also ADC/AIN[6]
- A3 = PA07 // PWM available, also ADC/AIN[7]
- A4 = PB03 // PORTB
- A5 = PB02 // PORTB
- A6 = PB09 // PORTB
- A7 = PB08 // PORTB
- A8 = PA11 // ADC/AIN[19]
- A9 = PA09 // ADC/AIN[17]
- A10 = PA04
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D13
- NEOPIXELS = D8
-
- BUTTONA = D4
- BUTTONB = D5
- SLIDER = D7 // built-in slide switch
-
- BUTTON = BUTTONA
- BUTTON1 = BUTTONB
-
- LIGHTSENSOR = A8
- TEMPSENSOR = A9
- PROXIMITY = A10
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-USBCDC pins (logical UART0)
-
-
-```go
-const (
- UART_TX_PIN = PB08 // PORTB
- UART_RX_PIN = PB09 // PORTB
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = PB02 // I2C0 external
- SCL_PIN = PB03 // I2C0 external
-
- SDA1_PIN = PA00 // I2C1 internal
- SCL1_PIN = PA01 // I2C1 internal
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA21 // SCK: SERCOM3/PAD[3]
- SPI0_SDO_PIN = PA20 // SDO: SERCOM3/PAD[2]
- SPI0_SDI_PIN = PA16 // SDI: SERCOM3/PAD[0]
-)
-```
-
-SPI pins (internal flash)
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // no WS, instead uses SCK to sync
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM4_USART,
- SERCOM: 4,
- }
-)
-```
-
-UART1 on the Circuit Playground Express.
-
-
-```go
-var (
- // external device
- I2C0 = I2C{
- Bus: sam.SERCOM5_I2CM,
- SERCOM: 5,
- }
- // internal device
- I2C1 = I2C{
- Bus: sam.SERCOM1_I2CM,
- SERCOM: 1,
- }
-)
-```
-
-I2C on the Circuit Playground Express.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM3_SPI,
- SERCOM: 3,
- }
-)
-```
-
-SPI on the Circuit Playground Express.
-
-
-```go
-var (
- I2S0 = I2S{Bus: sam.I2S}
-)
-```
-
-I2S on the Circuit Playground Express.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/clue-alpha.md b/content/microcontrollers/machine/clue-alpha.md
deleted file mode 100644
index 0e580802..00000000
--- a/content/microcontrollers/machine/clue-alpha.md
+++ /dev/null
@@ -1,1424 +0,0 @@
-
----
-title: clue-alpha
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- D0 = P0_04
- D1 = P0_05
- D2 = P0_03
- D3 = P0_28
- D4 = P0_02
- D5 = P1_02
- D6 = P1_09
- D7 = P0_07
- D8 = P1_07
- D9 = P0_27
- D10 = P0_30
- D11 = P1_10
- D12 = P0_31
- D13 = P0_08
- D14 = P0_06
- D15 = P0_26
- D16 = P0_29
- D17 = P1_01
- D18 = P0_16
- D19 = P0_25
- D20 = P0_24
- D21 = A0
- D22 = A1
- D23 = A2
- D24 = A3
- D25 = A4
- D26 = A5
- D27 = A6
- D28 = A7
- D29 = P0_14
- D30 = P0_15
- D31 = P0_12
- D32 = P0_13
- D33 = P1_03
- D34 = P1_05
- D35 = P0_00
- D36 = P0_01
- D37 = P0_19
- D38 = P0_20
- D39 = P0_17
- D40 = P0_22
- D41 = P0_23
- D42 = P0_21
- D43 = P0_10
- D44 = P0_09
- D45 = P1_06
- D46 = P1_00
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D12
- A1 = D16
- A2 = D0
- A3 = D1
- A4 = D2
- A5 = D3
- A6 = D4
- A7 = D10
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D17
- LED1 = LED
- LED2 = D43
- NEOPIXEL = D18
-
- BUTTON_LEFT = D5
- BUTTON_RIGHT = D11
-
- // 240x240 ST7789 display is connected to these pins (use RowOffset = 80)
- TFT_SCK = D29
- TFT_SDO = D30
- TFT_CS = D31
- TFT_DC = D32
- TFT_RESET = D33
- TFT_LITE = D34
-
- PDM_DAT = D35
- PDM_CLK = D36
-
- QSPI_SCK = D37
- QSPI_CS = D38
- QSPI_DATA0 = D39
- QSPI_DATA1 = D40
- QSPI_DATA2 = D41
- QSPI_DATA3 = D42
-
- SPEAKER = D46
-)
-```
-
-
-
-```go
-const (
- UART_RX_PIN = D0
- UART_TX_PIN = D1
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = D20 // I2C0 external
- SCL_PIN = D19 // I2C0 external
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D13 // SCK
- SPI0_SDO_PIN = D15 // SDO
- SPI0_SDI_PIN = D14 // SDI
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- DFU_MAGIC_SERIAL_ONLY_RESET = 0x4e
- DFU_MAGIC_UF2_RESET = 0x57
- DFU_MAGIC_OTA_RESET = 0xA8
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func EnterOTABootloader
-
-```go
-func EnterOTABootloader()
-```
-
-EnterOTABootloader resets the chip into the bootloader so that it can be
-flashed via an OTA update
-
-
-### func EnterSerialBootloader
-
-```go
-func EnterSerialBootloader()
-```
-
-EnterSerialBootloader resets the chip into the serial bootloader. After
-reset, it can be flashed using serial/nrfutil.
-
-
-### func EnterUF2Bootloader
-
-```go
-func EnterUF2Bootloader()
-```
-
-EnterUF2Bootloader resets the chip into the UF2 bootloader. After reset, it
-can be flashed via nrfutil or by copying a UF2 file to the mass storage device
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/clue_alpha.md b/content/microcontrollers/machine/clue_alpha.md
deleted file mode 100644
index 9f4ac990..00000000
--- a/content/microcontrollers/machine/clue_alpha.md
+++ /dev/null
@@ -1,1423 +0,0 @@
-
----
-title: clue_alpha
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- D0 = P0_04
- D1 = P0_05
- D2 = P0_03
- D3 = P0_28
- D4 = P0_02
- D5 = P1_02
- D6 = P1_09
- D7 = P0_07
- D8 = P1_07
- D9 = P0_27
- D10 = P0_30
- D11 = P1_10
- D12 = P0_31
- D13 = P0_08
- D14 = P0_06
- D15 = P0_26
- D16 = P0_29
- D17 = P1_01
- D18 = P0_16
- D19 = P0_25
- D20 = P0_24
- D21 = A0
- D22 = A1
- D23 = A2
- D24 = A3
- D25 = A4
- D26 = A5
- D27 = A6
- D28 = A7
- D29 = P0_14
- D30 = P0_15
- D31 = P0_12
- D32 = P0_13
- D33 = P1_03
- D34 = P1_05
- D35 = P0_00
- D36 = P0_01
- D37 = P0_19
- D38 = P0_20
- D39 = P0_17
- D40 = P0_22
- D41 = P0_23
- D42 = P0_21
- D43 = P0_10
- D44 = P0_09
- D45 = P1_06
- D46 = P1_00
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D12
- A1 = D16
- A2 = D0
- A3 = D1
- A4 = D2
- A5 = D3
- A6 = D4
- A7 = D10
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D17
- LED1 = LED
- LED2 = D43
- NEOPIXEL = D18
-
- BUTTON_LEFT = D5
- BUTTON_RIGHT = D11
-
- // 240x240 ST7789 display is connected to these pins (use RowOffset = 80)
- TFT_SCK = D29
- TFT_SDO = D30
- TFT_CS = D31
- TFT_DC = D32
- TFT_RESET = D33
- TFT_LITE = D34
-
- PDM_DAT = D35
- PDM_CLK = D36
-
- QSPI_SCK = D37
- QSPI_CS = D38
- QSPI_DATA0 = D39
- QSPI_DATA1 = D40
- QSPI_DATA2 = D41
- QSPI_DATA3 = D42
-
- SPEAKER = D46
-)
-```
-
-
-
-```go
-const (
- UART_RX_PIN = D0
- UART_TX_PIN = D1
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = D20 // I2C0 external
- SCL_PIN = D19 // I2C0 external
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D13 // SCK
- SPI0_SDO_PIN = D15 // SDO
- SPI0_SDI_PIN = D14 // SDI
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- DFU_MAGIC_SERIAL_ONLY_RESET = 0x4e
- DFU_MAGIC_UF2_RESET = 0x57
- DFU_MAGIC_OTA_RESET = 0xA8
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func EnterOTABootloader
-
-```go
-func EnterOTABootloader()
-```
-
-EnterOTABootloader resets the chip into the bootloader so that it can be
-flashed via an OTA update
-
-
-### func EnterSerialBootloader
-
-```go
-func EnterSerialBootloader()
-```
-
-EnterSerialBootloader resets the chip into the serial bootloader. After
-reset, it can be flashed using serial/nrfutil.
-
-
-### func EnterUF2Bootloader
-
-```go
-func EnterUF2Bootloader()
-```
-
-EnterUF2Bootloader resets the chip into the UF2 bootloader. After reset, it
-can be flashed via nrfutil or by copying a UF2 file to the mass storage device
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/cortex-m-qemu.md b/content/microcontrollers/machine/cortex-m-qemu.md
deleted file mode 100644
index c6d640e6..00000000
--- a/content/microcontrollers/machine/cortex-m-qemu.md
+++ /dev/null
@@ -1,177 +0,0 @@
-
----
-title: cortex-m-qemu
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
diff --git a/content/microcontrollers/machine/d1mini.md b/content/microcontrollers/machine/d1mini.md
deleted file mode 100644
index 9f6f36fd..00000000
--- a/content/microcontrollers/machine/d1mini.md
+++ /dev/null
@@ -1,415 +0,0 @@
-
----
-title: d1mini
----
-
-
-## Constants
-
-```go
-const (
- D0 Pin = 16
- D1 Pin = 5
- D2 Pin = 4
- D3 Pin = 0
- D4 Pin = 2
- D5 Pin = 14
- D6 Pin = 12
- D7 Pin = 13
- D8 Pin = 15
-)
-```
-
-GPIO pins on the NodeMCU board.
-
-
-```go
-const LED = D4
-```
-
-Onboard blue LED (on the AI-Thinker module).
-
-
-```go
-const (
- SPI0_SCK_PIN = D5
- SPI0_SDO_PIN = D7
- SPI0_SDI_PIN = D6
- SPI0_CS0_PIN = D8
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = D2
- SCL_PIN = D1
-)
-```
-
-I2C pins
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN Pin = 1
- UART_RX_PIN Pin = 3
-)
-```
-
-Pins that are fixed by the chip.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var UART0 = UART{Buffer: NewRingBuffer()}
-```
-
-UART0 is a hardware UART that supports both TX and RX.
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the given pin as output or input pin.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set sets the output value of this pin to high (true) or low (false).
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART baud rate. TX and RX pins are fixed by the hardware so
-cannot be modified and will be ignored.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a single byte to the output buffer. Note that the hardware
-includes a buffer of 128 bytes which will be used first.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/esp32-coreboard-v2.md b/content/microcontrollers/machine/esp32-coreboard-v2.md
deleted file mode 100644
index eb034712..00000000
--- a/content/microcontrollers/machine/esp32-coreboard-v2.md
+++ /dev/null
@@ -1,568 +0,0 @@
-
----
-title: esp32-coreboard-v2
----
-
-
-## Constants
-
-```go
-const LED = IO2
-```
-
-Built-in LED on some ESP32 boards.
-
-
-```go
-const (
- CLK Pin = 6
- CMD Pin = 11
- IO0 Pin = 0
- IO1 Pin = 1
- IO10 Pin = 10
- IO16 Pin = 16
- IO17 Pin = 17
- IO18 Pin = 18
- IO19 Pin = 19
- IO2 Pin = 2
- IO21 Pin = 21
- IO22 Pin = 22
- IO23 Pin = 23
- IO25 Pin = 25
- IO26 Pin = 26
- IO27 Pin = 27
- IO3 Pin = 3
- IO32 Pin = 32
- IO33 Pin = 33
- IO34 Pin = 34
- IO35 Pin = 35
- IO36 Pin = 36
- IO39 Pin = 39
- IO4 Pin = 4
- IO5 Pin = 5
- IO9 Pin = 9
- RXD Pin = 3
- SD0 Pin = 7
- SD1 Pin = 8
- SD2 Pin = 9
- SD3 Pin = 10
- SVN Pin = 39
- SVP Pin = 36
- TCK Pin = 13
- TD0 Pin = 15
- TDI Pin = 12
- TMS Pin = 14
- TXD Pin = 1
-)
-```
-
-
-
-```go
-const (
- SPI0_SCK_PIN = IO18
- SPI0_SDO_PIN = IO23
- SPI0_SDI_PIN = IO19
- SPI0_CS0_PIN = IO5
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = IO21
- SCL_PIN = IO22
-)
-```
-
-I2C pins
-
-
-```go
-const (
- ADC0 Pin = IO34
- ADC1 Pin = IO35
- ADC2 Pin = IO36
- ADC3 Pin = IO39
-)
-```
-
-ADC pins
-
-
-```go
-const (
- UART_TX_PIN = IO1
- UART_RX_PIN = IO3
-)
-```
-
-UART0 pins
-
-
-```go
-const (
- UART1_TX_PIN = IO9
- UART1_RX_PIN = IO10
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- PWM0_PIN Pin = IO2
- PWM1_PIN Pin = IO0
- PWM2_PIN Pin = IO4
-)
-```
-
-PWM pins
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrInvalidSPIBus = errors.New("machine: invalid SPI bus")
-)
-```
-
-
-
-```go
-var (
- UART0 = UART{Bus: esp.UART0, Buffer: NewRingBuffer()}
- UART1 = UART{Bus: esp.UART1, Buffer: NewRingBuffer()}
- UART2 = UART{Bus: esp.UART2, Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- // SPI0 and SPI1 are reserved for use by the caching system etc.
- SPI2 = SPI{esp.SPI2}
- SPI3 = SPI{esp.SPI3}
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-CPUFrequency returns the current CPU frequency of the chip.
-Currently it is a fixed frequency but it may allow changing in the future.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *esp.SPI_Type
-}
-```
-
-Serial Peripheral Interface on the ESP32.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure and make the SPI peripheral ready to use.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface. If you need to
-transfer larger amounts of data, Tx will be faster.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-This is accomplished by sending zero bits if r is bigger than w or discarding
-the incoming data if w is bigger than r.
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig configures a SPI peripheral on the ESP32. Make sure to set at least
-SCK, SDO and SDI (possibly to NoPin if not in use). The default for LSBFirst
-(false) and Mode (0) are good for most applications. The frequency defaults
-to 1MHz if not set but can be configured up to 40MHz. Possible values are
-40MHz and integer divisions from 40MHz such as 20MHz, 13.3MHz, 10MHz, 8MHz,
-etc.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus *esp.UART_Type
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/esp32-mini32.md b/content/microcontrollers/machine/esp32-mini32.md
deleted file mode 100644
index 17dae035..00000000
--- a/content/microcontrollers/machine/esp32-mini32.md
+++ /dev/null
@@ -1,568 +0,0 @@
-
----
-title: esp32-mini32
----
-
-
-## Constants
-
-```go
-const LED = IO2
-```
-
-Built-in LED on some ESP32 boards.
-
-
-```go
-const (
- CLK Pin = 6
- CMD Pin = 11
- IO0 Pin = 0
- IO1 Pin = 1
- IO10 Pin = 10
- IO16 Pin = 16
- IO17 Pin = 17
- IO18 Pin = 18
- IO19 Pin = 19
- IO2 Pin = 2
- IO21 Pin = 21
- IO22 Pin = 22
- IO23 Pin = 23
- IO25 Pin = 25
- IO26 Pin = 26
- IO27 Pin = 27
- IO3 Pin = 3
- IO32 Pin = 32
- IO33 Pin = 33
- IO34 Pin = 34
- IO35 Pin = 35
- IO36 Pin = 36
- IO39 Pin = 39
- IO4 Pin = 4
- IO5 Pin = 5
- IO9 Pin = 9
- RXD Pin = 3
- SD0 Pin = 7
- SD1 Pin = 8
- SD2 Pin = 9
- SD3 Pin = 10
- SVN Pin = 39
- SVP Pin = 36
- TCK Pin = 13
- TD0 Pin = 15
- TDI Pin = 12
- TMS Pin = 14
- TXD Pin = 1
-)
-```
-
-
-
-```go
-const (
- SPI0_SCK_PIN = IO18
- SPI0_SDO_PIN = IO23
- SPI0_SDI_PIN = IO19
- SPI0_CS0_PIN = IO5
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = IO21
- SCL_PIN = IO22
-)
-```
-
-I2C pins
-
-
-```go
-const (
- ADC0 Pin = IO34
- ADC1 Pin = IO35
- ADC2 Pin = IO36
- ADC3 Pin = IO39
-)
-```
-
-ADC pins
-
-
-```go
-const (
- UART_TX_PIN = IO1
- UART_RX_PIN = IO3
-)
-```
-
-UART0 pins
-
-
-```go
-const (
- UART1_TX_PIN = IO9
- UART1_RX_PIN = IO10
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- PWM0_PIN Pin = IO2
- PWM1_PIN Pin = IO0
- PWM2_PIN Pin = IO4
-)
-```
-
-PWM pins
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrInvalidSPIBus = errors.New("machine: invalid SPI bus")
-)
-```
-
-
-
-```go
-var (
- UART0 = UART{Bus: esp.UART0, Buffer: NewRingBuffer()}
- UART1 = UART{Bus: esp.UART1, Buffer: NewRingBuffer()}
- UART2 = UART{Bus: esp.UART2, Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- // SPI0 and SPI1 are reserved for use by the caching system etc.
- SPI2 = SPI{esp.SPI2}
- SPI3 = SPI{esp.SPI3}
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-CPUFrequency returns the current CPU frequency of the chip.
-Currently it is a fixed frequency but it may allow changing in the future.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *esp.SPI_Type
-}
-```
-
-Serial Peripheral Interface on the ESP32.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure and make the SPI peripheral ready to use.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface. If you need to
-transfer larger amounts of data, Tx will be faster.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-This is accomplished by sending zero bits if r is bigger than w or discarding
-the incoming data if w is bigger than r.
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig configures a SPI peripheral on the ESP32. Make sure to set at least
-SCK, SDO and SDI (possibly to NoPin if not in use). The default for LSBFirst
-(false) and Mode (0) are good for most applications. The frequency defaults
-to 1MHz if not set but can be configured up to 40MHz. Possible values are
-40MHz and integer divisions from 40MHz such as 20MHz, 13.3MHz, 10MHz, 8MHz,
-etc.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus *esp.UART_Type
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/esp32.md b/content/microcontrollers/machine/esp32.md
deleted file mode 100644
index fa07d925..00000000
--- a/content/microcontrollers/machine/esp32.md
+++ /dev/null
@@ -1,451 +0,0 @@
-
----
-title: esp32
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrInvalidSPIBus = errors.New("machine: invalid SPI bus")
-)
-```
-
-
-
-```go
-var (
- UART0 = UART{Bus: esp.UART0, Buffer: NewRingBuffer()}
- UART1 = UART{Bus: esp.UART1, Buffer: NewRingBuffer()}
- UART2 = UART{Bus: esp.UART2, Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- // SPI0 and SPI1 are reserved for use by the caching system etc.
- SPI2 = SPI{esp.SPI2}
- SPI3 = SPI{esp.SPI3}
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-CPUFrequency returns the current CPU frequency of the chip.
-Currently it is a fixed frequency but it may allow changing in the future.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *esp.SPI_Type
-}
-```
-
-Serial Peripheral Interface on the ESP32.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure and make the SPI peripheral ready to use.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface. If you need to
-transfer larger amounts of data, Tx will be faster.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-This is accomplished by sending zero bits if r is bigger than w or discarding
-the incoming data if w is bigger than r.
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig configures a SPI peripheral on the ESP32. Make sure to set at least
-SCK, SDO and SDI (possibly to NoPin if not in use). The default for LSBFirst
-(false) and Mode (0) are good for most applications. The frequency defaults
-to 1MHz if not set but can be configured up to 40MHz. Possible values are
-40MHz and integer divisions from 40MHz such as 20MHz, 13.3MHz, 10MHz, 8MHz,
-etc.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus *esp.UART_Type
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/esp8266.md b/content/microcontrollers/machine/esp8266.md
deleted file mode 100644
index 420cc750..00000000
--- a/content/microcontrollers/machine/esp8266.md
+++ /dev/null
@@ -1,369 +0,0 @@
-
----
-title: esp8266
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN Pin = 1
- UART_RX_PIN Pin = 3
-)
-```
-
-Pins that are fixed by the chip.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var UART0 = UART{Buffer: NewRingBuffer()}
-```
-
-UART0 is a hardware UART that supports both TX and RX.
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the given pin as output or input pin.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set sets the output value of this pin to high (true) or low (false).
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART baud rate. TX and RX pins are fixed by the hardware so
-cannot be modified and will be ignored.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a single byte to the output buffer. Note that the hardware
-includes a buffer of 128 bytes which will be used first.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/feather-m0.md b/content/microcontrollers/machine/feather-m0.md
deleted file mode 100644
index 9002606c..00000000
--- a/content/microcontrollers/machine/feather-m0.md
+++ /dev/null
@@ -1,1606 +0,0 @@
-
----
-title: feather-m0
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA11 // UART0 RX
- D1 = PA10 // UART0 TX
- D2 = NoPin // does not seem to exist
- D3 = PA09
- D4 = PA08
- D5 = PA15 // PWM available
- D6 = PA20 // PWM available
- D7 = NoPin // does not seem to exist
- D8 = PA06
- D9 = PA07 // PWM available
- D10 = PA18 // can be used for PWM or UART1 TX
- D11 = PA16 // can be used for PWM or UART1 RX
- D12 = PA19 // PWM available
- D13 = PA17 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PB08 // ADC/AIN[2]
- A2 = PB09 // ADC/AIN[3]
- A3 = PA04 // ADC/AIN[4]
- A4 = PA05 // ADC/AIN[5]
- A5 = PB02 // ADC/AIN[10]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D10
- UART_RX_PIN = D11
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SDA_PIN = PA22 // SDA: SERCOM3/PAD[0]
- SCL_PIN = PA23 // SCL: SERCOM3/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3]
- SPI0_SDO_PIN = PB10 // SDO: SERCOM4/PAD[2]
- SPI0_SDI_PIN = PA12 // SDI: SERCOM4/PAD[0]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on Feather M0.
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM1_USART,
- SERCOM: 1,
- }
-)
-```
-
-UART1 on the Feather M0.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM3_I2CM,
- SERCOM: 3,
- }
-)
-```
-
-I2C on the Feather M0.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM4_SPI,
- SERCOM: 4,
- }
-)
-```
-
-SPI on the Feather M0.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/feather-m4.md b/content/microcontrollers/machine/feather-m4.md
deleted file mode 100644
index 0c25df5d..00000000
--- a/content/microcontrollers/machine/feather-m4.md
+++ /dev/null
@@ -1,1681 +0,0 @@
-
----
-title: feather-m4
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PB17 // UART0 RX/PWM available
- D1 = PB16 // UART0 TX/PWM available
- D4 = PA14 // PWM available
- D5 = PA16 // PWM available
- D6 = PA18 // PWM available
- D8 = PB03 // built-in neopixel
- D9 = PA19 // PWM available
- D10 = PA20 // can be used for PWM or UART1 TX
- D11 = PA21 // can be used for PWM or UART1 RX
- D12 = PA22 // PWM available
- D13 = PA23 // PWM available
- D21 = PA13 // PWM available
- D22 = PA12 // PWM available
- D23 = PB22 // PWM available
- D24 = PB23 // PWM available
- D25 = PA17 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA05 // ADC/AIN[2]
- A2 = PB08 // ADC/AIN[3]
- A3 = PB09 // ADC/AIN[4]
- A4 = PA04 // ADC/AIN[5]
- A5 = PA06 // ADC/AIN[10]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-
-
-```go
-const (
- UART2_TX_PIN = A4
- UART2_RX_PIN = A5
-)
-```
-
-
-
-```go
-const (
- SDA_PIN = D22 // SDA: SERCOM2/PAD[0]
- SCL_PIN = D21 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D25 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN = D24 // SDO: SERCOM1/PAD[3]
- SPI0_SDI_PIN = D23 // SDI: SERCOM1/PAD[2]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM5_USART_INT,
- SERCOM: 5,
- }
-
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART_INT,
- SERCOM: 0,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the Feather M4.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM1_SPIM,
- SERCOM: 1,
- }
-)
-```
-
-SPI on the Feather M4.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/feather-nrf52840.md b/content/microcontrollers/machine/feather-nrf52840.md
deleted file mode 100644
index 1d1995d8..00000000
--- a/content/microcontrollers/machine/feather-nrf52840.md
+++ /dev/null
@@ -1,1396 +0,0 @@
-
----
-title: feather-nrf52840
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- D0 = P0_25 // UART TX
- D1 = P0_24 // UART RX
- D2 = P0_10 // NFC2
- D3 = P1_15 // LED1
- D4 = P1_10 // LED2
- D5 = P1_08
- D6 = P0_07
- D7 = P1_02 // Button
- D8 = P0_16 // NeoPixel
- D9 = P0_26
- D10 = P0_27
- D11 = P0_06
- D12 = P0_08
- D13 = P1_09
- D14 = P0_04 // A0
- D15 = P0_05 // A1
- D16 = P0_30 // A2
- D17 = P0_28 // A3
- D18 = P0_02 // A4
- D19 = P0_03 // A5
- D20 = P0_29 // Battery
- D21 = P0_31 // AREF
- D22 = P0_12 // I2C SDA
- D23 = P0_11 // I2C SCL
- D24 = P0_15 // SPI MISO
- D25 = P0_13 // SPI MOSI
- D26 = P0_14 // SPI SCK
- D27 = P0_19 // QSPI CLK
- D28 = P0_20 // QSPI CS
- D29 = P0_17 // QSPI Data 0
- D30 = P0_22 // QSPI Data 1
- D31 = P0_23 // QSPI Data 2
- D32 = P0_21 // QSPI Data 3
- D33 = P0_09 // NFC1 (test point on bottom of board)
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D14
- A1 = D15
- A2 = D16
- A3 = D17
- A4 = D18
- A5 = D19
- A6 = D20 // Battery
- A7 = D21 // ARef
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D3
- LED1 = LED
- LED2 = D4
- NEOPIXEL = D8
- BUTTON = D7
-
- QSPI_SCK = D27
- QSPI_CS = D28
- QSPI_DATA0 = D29
- QSPI_DATA1 = D30
- QSPI_DATA2 = D31
- QSPI_DATA3 = D32
-)
-```
-
-
-
-```go
-const (
- UART_RX_PIN = D0
- UART_TX_PIN = D1
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = D22 // I2C0 external
- SCL_PIN = D23 // I2C0 external
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D26 // SCK
- SPI0_SDO_PIN = D25 // SDO
- SPI0_SDI_PIN = D24 // SDI
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- DFU_MAGIC_SERIAL_ONLY_RESET = 0x4e
- DFU_MAGIC_UF2_RESET = 0x57
- DFU_MAGIC_OTA_RESET = 0xA8
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func EnterOTABootloader
-
-```go
-func EnterOTABootloader()
-```
-
-EnterOTABootloader resets the chip into the bootloader so that it can be
-flashed via an OTA update
-
-
-### func EnterSerialBootloader
-
-```go
-func EnterSerialBootloader()
-```
-
-EnterSerialBootloader resets the chip into the serial bootloader. After
-reset, it can be flashed using serial/nrfutil.
-
-
-### func EnterUF2Bootloader
-
-```go
-func EnterUF2Bootloader()
-```
-
-EnterUF2Bootloader resets the chip into the UF2 bootloader. After reset, it
-can be flashed via nrfutil or by copying a UF2 file to the mass storage device
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/feather-stm32f405.md b/content/microcontrollers/machine/feather-stm32f405.md
deleted file mode 100644
index ae463606..00000000
--- a/content/microcontrollers/machine/feather-stm32f405.md
+++ /dev/null
@@ -1,914 +0,0 @@
-
----
-title: feather-stm32f405
----
-
-
-## Constants
-
-```go
-const (
- NUM_DIGITAL_IO_PINS = 39
- NUM_ANALOG_IO_PINS = 7
-)
-```
-
-
-
-```go
-const (
- // Arduino pin = MCU port pin // primary functions (alternate functions)
- D0 = PB11 // USART3 RX, PWM TIM2_CH4 (I2C2 SDA)
- D1 = PB10 // USART3 TX, PWM TIM2_CH3 (I2C2 SCL, I2S2 BCK)
- D2 = PB3 // GPIO, SPI3 FLASH SCK
- D3 = PB4 // GPIO, SPI3 FLASH MISO
- D4 = PB5 // GPIO, SPI3 FLASH MOSI
- D5 = PC7 // GPIO, PWM TIM3_CH2 (USART6 RX, I2S3 MCK)
- D6 = PC6 // GPIO, PWM TIM3_CH1 (USART6 TX, I2S2 MCK)
- D7 = PA15 // GPIO, SPI3 FLASH CS
- D8 = PC0 // GPIO, Neopixel
- D9 = PB8 // GPIO, PWM TIM4_CH3 (CAN1 RX, I2C1 SCL)
- D10 = PB9 // GPIO, PWM TIM4_CH4 (CAN1 TX, I2C1 SDA, I2S2 WSL)
- D11 = PC3 // GPIO (I2S2 SD, SPI2 MOSI)
- D12 = PC2 // GPIO (I2S2ext SD, SPI2 MISO)
- D13 = PC1 // GPIO, Builtin LED
- D14 = PB7 // I2C1 SDA, PWM TIM4_CH2 (USART1 RX)
- D15 = PB6 // I2C1 SCL, PWM TIM4_CH1 (USART1 TX, CAN2 TX)
- D16 = PA4 // A0 (DAC OUT1)
- D17 = PA5 // A1 (DAC OUT2, SPI1 SCK)
- D18 = PA6 // A2, PWM TIM3_CH1 (SPI1 MISO)
- D19 = PA7 // A3, PWM TIM3_CH2 (SPI1 MOSI)
- D20 = PC4 // A4
- D21 = PC5 // A5
- D22 = PA3 // A6
- D23 = PB13 // SPI2 SCK, PWM TIM1_CH1N (I2S2 BCK, CAN2 TX)
- D24 = PB14 // SPI2 MISO, PWM TIM1_CH2N (I2S2ext SD)
- D25 = PB15 // SPI2 MOSI, PWM TIM1_CH3N (I2S2 SD)
- D26 = PC8 // SDIO
- D27 = PC9 // SDIO
- D28 = PC10 // SDIO
- D29 = PC11 // SDIO
- D30 = PC12 // SDIO
- D31 = PD2 // SDIO
- D32 = PB12 // SD Detect
- D33 = PC14 // OSC32
- D34 = PC15 // OSC32
- D35 = PA11 // USB D+
- D36 = PA12 // USB D-
- D37 = PA13 // SWDIO
- D38 = PA14 // SWCLK
-)
-```
-
-Digital pins
-
-
-```go
-const (
- A0 = D16 // ADC12 IN4
- A1 = D17 // ADC12 IN5
- A2 = D18 // ADC12 IN6
- A3 = D19 // ADC12 IN7
- A4 = D20 // ADC12 IN14
- A5 = D21 // ADC12 IN15
- A6 = D22 // VBAT
-)
-```
-
-Analog pins
-
-
-```go
-const (
- NUM_BOARD_LED = 1
- NUM_BOARD_NEOPIXEL = 1
-
- LED_RED = D13
- LED_NEOPIXEL = D8
- LED_BUILTIN = LED_RED
- LED = LED_BUILTIN
-)
-```
-
-
-
-```go
-const (
- // #===========#==========#==============#============#=======#=======#
- // | Interface | Hardware | Bus(Freq) | RX/TX Pins | AltFn | Alias |
- // #===========#==========#==============#============#=======#=======#
- // | UART1 | USART3 | APB1(42 MHz) | D0/D1 | 7 | ~ |
- // | UART2 | USART6 | APB2(84 MHz) | D5/D6 | 8 | ~ |
- // | UART3 | USART1 | APB2(84 MHz) | D14/D15 | 7 | ~ |
- // | --------- | -------- | ------------ | ---------- | ----- | ----- |
- // | UART0 | USART3 | APB1(42 MHz) | D0/D1 | 7 | UART1 |
- // #===========#==========#==============#============#=======#=======#
- NUM_UART_INTERFACES = 3
-
- UART1_RX_PIN = D0 // UART1 = hardware: USART3
- UART1_TX_PIN = D1 //
-
- UART2_RX_PIN = D5 // UART2 = hardware: USART6
- UART2_TX_PIN = D6 //
-
- UART3_RX_PIN = D14 // UART3 = hardware: USART1
- UART3_TX_PIN = D15 //
-
- UART0_RX_PIN = UART1_RX_PIN // UART0 = alias: UART1
- UART0_TX_PIN = UART1_TX_PIN //
-
- UART_RX_PIN = UART0_RX_PIN // default/primary UART pins
- UART_TX_PIN = UART0_TX_PIN //
-)
-```
-
-
-
-```go
-const (
- // #===========#==========#==============#==================#=======#=======#
- // | Interface | Hardware | Bus(Freq) | SCK/SDI/SDO Pins | AltFn | Alias |
- // #===========#==========#==============#==================#=======#=======#
- // | SPI1 | SPI2 | APB1(42 MHz) | D23/D24/D25 | 5 | ~ |
- // | SPI2 | SPI3 | APB1(42 MHz) | D2/D3/D4 | 6 | ~ |
- // | SPI3 | SPI1 | APB2(84 MHz) | D17/D18/D19 | 5 | ~ |
- // | --------- | -------- | ------------ | ---------------- | ----- | ----- |
- // | SPI0 | SPI2 | APB1(42 MHz) | D23/D24/D25 | 5 | SPI1 |
- // #===========#==========#==============#==================#=======#=======#
- NUM_SPI_INTERFACES = 3
-
- SPI1_SCK_PIN = D23 //
- SPI1_SDI_PIN = D24 // SPI1 = hardware: SPI2
- SPI1_SDO_PIN = D25 //
-
- SPI2_SCK_PIN = D2 //
- SPI2_SDI_PIN = D3 // SPI2 = hardware: SPI3
- SPI2_SDO_PIN = D4 //
-
- SPI3_SCK_PIN = D17 //
- SPI3_SDI_PIN = D18 // SPI3 = hardware: SPI1
- SPI3_SDO_PIN = D19 //
-
- SPI0_SCK_PIN = SPI1_SCK_PIN //
- SPI0_SDI_PIN = SPI1_SDI_PIN // SPI0 = alias: SPI1
- SPI0_SDO_PIN = SPI1_SDO_PIN //
-
- SPI_SCK_PIN = SPI0_SCK_PIN //
- SPI_SDI_PIN = SPI0_SDI_PIN // default/primary SPI pins
- SPI_SDO_PIN = SPI0_SDO_PIN //
-)
-```
-
-
-
-```go
-const (
- // #===========#==========#==============#==============#=======#=======#
- // | Interface | Hardware | Bus(Freq) | SDA/SCL Pins | AltFn | Alias |
- // #===========#==========#==============#==============#=======#=======#
- // | I2C1 | I2C1 | APB1(42 MHz) | D14/D15 | 4 | ~ |
- // | I2C2 | I2C2 | APB1(42 MHz) | D0/D1 | 4 | ~ |
- // | I2C3 | I2C1 | APB1(42 MHz) | D9/D10 | 4 | ~ |
- // | --------- | -------- | ------------ | ------------ | ----- | ----- |
- // | I2C0 | I2C1 | APB1(42 MHz) | D14/D15 | 4 | I2C1 |
- // #===========#==========#==============#==============#=======#=======#
- NUM_I2C_INTERFACES = 3
-
- I2C1_SDA_PIN = D14 // I2C1 = hardware: I2C1
- I2C1_SCL_PIN = D15 //
-
- I2C2_SDA_PIN = D0 // I2C2 = hardware: I2C2
- I2C2_SCL_PIN = D1 //
-
- I2C3_SDA_PIN = D9 // I2C3 = hardware: I2C1
- I2C3_SCL_PIN = D10 // (interface duplicated on second pair of pins)
-
- I2C0_SDA_PIN = I2C1_SDA_PIN // I2C0 = alias: I2C1
- I2C0_SCL_PIN = I2C1_SCL_PIN //
-
- I2C_SDA_PIN = I2C0_SDA_PIN // default/primary I2C pins
- I2C_SCL_PIN = I2C0_SCL_PIN //
-)
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- DutyCycle2 = 0
- DutyCycle16x9 = 1
-)
-```
-
-I2C fast mode (Fm) duty cycle
-
-
-```go
-const (
- // Mode Flag
- PinOutput PinMode = 0
- PinInput PinMode = PinInputFloating
- PinInputFloating PinMode = 1
- PinInputPulldown PinMode = 2
- PinInputPullup PinMode = 3
-
- // for UART
- PinModeUARTTX PinMode = 4
- PinModeUARTRX PinMode = 5
-
- // for I2C
- PinModeI2CSCL PinMode = 6
- PinModeI2CSDA PinMode = 7
-
- // for SPI
- PinModeSPICLK PinMode = 8
- PinModeSPISDO PinMode = 9
- PinModeSPISDI PinMode = 10
-
- // for analog/ADC
- PinInputAnalog PinMode = 11
-)
-```
-
-
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PA8 = portA + 8
- PA9 = portA + 9
- PA10 = portA + 10
- PA11 = portA + 11
- PA12 = portA + 12
- PA13 = portA + 13
- PA14 = portA + 14
- PA15 = portA + 15
-
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PB8 = portB + 8
- PB9 = portB + 9
- PB10 = portB + 10
- PB11 = portB + 11
- PB12 = portB + 12
- PB13 = portB + 13
- PB14 = portB + 14
- PB15 = portB + 15
-
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PC8 = portC + 8
- PC9 = portC + 9
- PC10 = portC + 10
- PC11 = portC + 11
- PC12 = portC + 12
- PC13 = portC + 13
- PC14 = portC + 14
- PC15 = portC + 15
-
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
- PD8 = portD + 8
- PD9 = portD + 9
- PD10 = portD + 10
- PD11 = portD + 11
- PD12 = portD + 12
- PD13 = portD + 13
- PD14 = portD + 14
- PD15 = portD + 15
-
- PE0 = portE + 0
- PE1 = portE + 1
- PE2 = portE + 2
- PE3 = portE + 3
- PE4 = portE + 4
- PE5 = portE + 5
- PE6 = portE + 6
- PE7 = portE + 7
- PE8 = portE + 8
- PE9 = portE + 9
- PE10 = portE + 10
- PE11 = portE + 11
- PE12 = portE + 12
- PE13 = portE + 13
- PE14 = portE + 14
- PE15 = portE + 15
-
- PH0 = portH + 0
- PH1 = portH + 1
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART3,
- AltFuncSelector: stm32.AF7_USART1_2_3,
- }
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART6,
- AltFuncSelector: stm32.AF8_USART4_5_6,
- }
- UART3 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART1,
- AltFuncSelector: stm32.AF7_USART1_2_3,
- }
- UART0 = UART1
-)
-```
-
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: stm32.SPI2,
- AltFuncSelector: stm32.AF5_SPI1_SPI2,
- }
- SPI2 = SPI{
- Bus: stm32.SPI3,
- AltFuncSelector: stm32.AF6_SPI3,
- }
- SPI3 = SPI{
- Bus: stm32.SPI1,
- AltFuncSelector: stm32.AF5_SPI1_SPI2,
- }
- SPI0 = SPI1
-)
-```
-
-
-
-```go
-var (
- I2C1 = I2C{
- Bus: stm32.I2C1,
- AltFuncSelector: stm32.AF4_I2C1_2_3,
- }
- I2C2 = I2C{
- Bus: stm32.I2C2,
- AltFuncSelector: stm32.AF4_I2C1_2_3,
- }
- I2C3 = I2C{
- Bus: stm32.I2C1,
- AltFuncSelector: stm32.AF4_I2C1_2_3,
- }
- I2C0 = I2C1
-)
-```
-
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *stm32.I2C_Type
- AltFuncSelector stm32.AltFunc
-}
-```
-
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the STM32 I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
- DutyCycle uint8
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration
-
-
-### func (Pin) ConfigureAltFunc
-
-```go
-func (p Pin) ConfigureAltFunc(config PinConfig, altFunc stm32.AltFunc)
-```
-
-Configure this pin with the given configuration including alternate
- function mapping if necessary.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetAltFunc
-
-```go
-func (p Pin) SetAltFunc(af stm32.AltFunc)
-```
-
-SetAltFunc maps the given alternative function to the I/O pin
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *stm32.SPI_Type
- AltFuncSelector stm32.AltFunc
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the STM32 SPI1 interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *stm32.USART_Type
- Interrupt interrupt.Interrupt
- AltFuncSelector stm32.AltFunc
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART. Defer to chip-specific
-routines for calculation
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/gameboy-advance.md b/content/microcontrollers/machine/gameboy-advance.md
deleted file mode 100644
index b44c3ea1..00000000
--- a/content/microcontrollers/machine/gameboy-advance.md
+++ /dev/null
@@ -1,271 +0,0 @@
-
----
-title: gameboy-advance
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- IRQ_VBLANK = 0
- IRQ_HBLANK = 1
- IRQ_VCOUNT = 2
- IRQ_TIMER0 = 3
- IRQ_TIMER1 = 4
- IRQ_TIMER2 = 5
- IRQ_TIMER3 = 6
- IRQ_COM = 7
- IRQ_DMA0 = 8
- IRQ_DMA1 = 9
- IRQ_DMA2 = 10
- IRQ_DMA3 = 11
- IRQ_KEYPAD = 12
- IRQ_GAMEPAK = 13
-)
-```
-
-Interrupt numbers as used on the GameBoy Advance. Register them with
-runtime/interrupt.New.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var Display = FramebufDisplay{(*[160][240]volatile.Register16)(unsafe.Pointer(uintptr(0x06000000)))}
-```
-
-
-
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type FramebufDisplay
-
-```go
-type FramebufDisplay struct {
- port *[160][240]volatile.Register16
-}
-```
-
-
-
-
-### func (FramebufDisplay) Configure
-
-```go
-func (d FramebufDisplay) Configure()
-```
-
-
-
-### func (FramebufDisplay) Display
-
-```go
-func (d FramebufDisplay) Display() error
-```
-
-
-
-### func (FramebufDisplay) SetPixel
-
-```go
-func (d FramebufDisplay) SetPixel(x, y int16, c color.RGBA)
-```
-
-
-
-### func (FramebufDisplay) Size
-
-```go
-func (d FramebufDisplay) Size() (x, y int16)
-```
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set has not been implemented.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
diff --git a/content/microcontrollers/machine/hifive1-qemu.md b/content/microcontrollers/machine/hifive1-qemu.md
deleted file mode 100644
index e64f1575..00000000
--- a/content/microcontrollers/machine/hifive1-qemu.md
+++ /dev/null
@@ -1,657 +0,0 @@
-
----
-title: hifive1-qemu
----
-
-
-## Constants
-
-```go
-const (
- P00 Pin = 0
- P01 Pin = 1
- P02 Pin = 2
- P03 Pin = 3
- P04 Pin = 4
- P05 Pin = 5
- P06 Pin = 6
- P07 Pin = 7
- P08 Pin = 8
- P09 Pin = 9
- P10 Pin = 10
- P11 Pin = 11
- P12 Pin = 12
- P13 Pin = 13
- P14 Pin = 14
- P15 Pin = 15
- P16 Pin = 16
- P17 Pin = 17
- P18 Pin = 18
- P19 Pin = 19
- P20 Pin = 20
- P21 Pin = 21
- P22 Pin = 22
- P23 Pin = 23
- P24 Pin = 24
- P25 Pin = 25
- P26 Pin = 26
- P27 Pin = 27
- P28 Pin = 28
- P29 Pin = 29
- P30 Pin = 30
- P31 Pin = 31
-)
-```
-
-
-
-```go
-const (
- D0 = P16
- D1 = P17
- D2 = P18
- D3 = P19 // Green LED/PWM (PWM1_PWM1)
- D4 = P20 // PWM (PWM1_PWM0)
- D5 = P21 // Blue LED/PWM (PWM1_PWM2)
- D6 = P22 // Red LED/PWM (PWM1_PWM3)
- D7 = P16
- D8 = NoPin // PWM?
- D9 = P01
- D10 = P02 // SPI1_CS0
- D11 = P03 // SPI1_DQ0
- D12 = P04 // SPI1_DQ1
- D13 = P05 // SPI1_SCK
- D14 = NoPin // not connected
- D15 = P09 // does not seem to work?
- D16 = P10 // PWM (PWM2_PWM0)
- D17 = P11 // PWM (PWM2_PWM1)
- D18 = P12 // SDA (I2C0_SDA)/PWM (PWM2_PWM2)
- D19 = P13 // SDL (I2C0_SCL)/PWM (PWM2_PWM3)
-)
-```
-
-
-
-```go
-const (
- LED = LED1
- LED1 = LED_RED
- LED2 = LED_GREEN
- LED3 = LED_BLUE
- LED_RED = P22
- LED_GREEN = P19
- LED_BLUE = P21
-)
-```
-
-
-
-```go
-const (
- // TODO: figure out the pin numbers for these.
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-
-
-```go
-const (
- SPI0_SCK_PIN = NoPin
- SPI0_SDO_PIN = NoPin
- SPI0_SDI_PIN = NoPin
-
- SPI1_SCK_PIN = D13
- SPI1_SDO_PIN = D11
- SPI1_SDI_PIN = D12
-)
-```
-
-SPI pins
-
-
-```go
-const (
- I2C0_SDA_PIN = D18
- I2C0_SCL_PIN = D19
-)
-```
-
-I2C pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinOutput
- PinPWM
- PinSPI
- PinI2C = PinSPI
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- SPI1 = SPI{
- Bus: sifive.QSPI1,
- }
-)
-```
-
-SPI on the HiFive1.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sifive.I2C0,
- }
-)
-```
-
-I2C on the HiFive1 rev B.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- UART0 = UART{Bus: sifive.UART0, Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sifive.I2C_Type
-}
-```
-
-I2C on the FE310-G002.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sifive.QSPI_Type
-}
-```
-
-SPI on the FE310. The normal SPI0 is actually a quad-SPI meant for flash, so it is best
-to use SPI1 or SPI2 port for most applications.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus *sifive.UART_Type
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte)
-```
-
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/itsybitsy-m0.md b/content/microcontrollers/machine/itsybitsy-m0.md
deleted file mode 100644
index 3b2d27bb..00000000
--- a/content/microcontrollers/machine/itsybitsy-m0.md
+++ /dev/null
@@ -1,1639 +0,0 @@
-
----
-title: itsybitsy-m0
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA11 // UART0 RX
- D1 = PA10 // UART0 TX
- D2 = PA14
- D3 = PA09 // PWM available
- D4 = PA08 // PWM available
- D5 = PA15 // PWM available
- D6 = PA20 // PWM available
- D7 = PA21 // PWM available
- D8 = PA06 // PWM available
- D9 = PA07 // PWM available
- D10 = PA18 // can be used for PWM or UART1 TX
- D11 = PA16 // can be used for PWM or UART1 RX
- D12 = PA19 // PWM available
- D13 = PA17 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PB08 // ADC/AIN[2]
- A2 = PB09 // ADC/AIN[3]
- A3 = PA04 // ADC/AIN[4]
- A4 = PA05 // ADC/AIN[5]
- A5 = PB02 // ADC/AIN[10]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D10
- UART_RX_PIN = D11
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SDA_PIN = PA22 // SDA: SERCOM3/PAD[0]
- SCL_PIN = PA23 // SCL: SERCOM3/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PB11 // SCK: SERCOM4/PAD[3]
- SPI0_SDO_PIN = PB10 // SDO: SERCOM4/PAD[2]
- SPI0_SDI_PIN = PA12 // SDI: SERCOM4/PAD[0]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_CS_PIN = PA27
- SPI1_SCK_PIN = PB23
- SPI1_SDO_PIN = PB22
- SPI1_SDI_PIN = PB03
-)
-```
-
-"Internal" SPI pins; SPI flash is attached to these on ItsyBitsy M0
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on ItsyBitsy M0.
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM1_USART,
- SERCOM: 1,
- }
-)
-```
-
-UART1 on the ItsyBitsy M0.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM3_I2CM,
- SERCOM: 3,
- }
-)
-```
-
-I2C on the ItsyBitsy M0.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM4_SPI,
- SERCOM: 4,
- }
-)
-```
-
-SPI on the ItsyBitsy M0.
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: sam.SERCOM5_SPI,
- SERCOM: 5,
- }
-)
-```
-
-"Internal" SPI on Sercom 5
-
-
-```go
-var (
- I2S0 = I2S{Bus: sam.I2S}
-)
-```
-
-I2S on the ItsyBitsy M0.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/itsybitsy-m4.md b/content/microcontrollers/machine/itsybitsy-m4.md
deleted file mode 100644
index 904ed8a1..00000000
--- a/content/microcontrollers/machine/itsybitsy-m4.md
+++ /dev/null
@@ -1,1680 +0,0 @@
-
----
-title: itsybitsy-m4
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA16 // UART0 RX/PWM available
- D1 = PA17 // UART0 TX/PWM available
- D2 = PA07
- D3 = PB22
- D4 = PA14 // PWM available
- D5 = PA15 // PWM available
- D6 = PB02 // dotStar clock
- D7 = PA18 // PWM available
- D8 = PB03 // dotStar data
- D9 = PA19 // PWM available
- D10 = PA20 // can be used for PWM or UART1 TX
- D11 = PA21 // can be used for PWM or UART1 RX
- D12 = PA23 // PWM available
- D13 = PA22 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA05 // ADC/AIN[2]
- A2 = PB08 // ADC/AIN[3]
- A3 = PB09 // ADC/AIN[4]
- A4 = PA04 // ADC/AIN[5]
- A5 = PA06 // ADC/AIN[10]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- UART2_TX_PIN = A4
- UART2_RX_PIN = D2
-)
-```
-
-
-
-```go
-const (
- SDA_PIN = PA12 // SDA: SERCOM2/PAD[0]
- SCL_PIN = PA13 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA01 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN = PA00 // SDO: SERCOM1/PAD[0]
- SPI0_SDI_PIN = PB23 // SDI: SERCOM1/PAD[3]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM3_USART_INT,
- SERCOM: 3,
- }
-
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART_INT,
- SERCOM: 0,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the ItsyBitsy M4.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM1_SPIM,
- SERCOM: 1,
- }
-)
-```
-
-SPI on the ItsyBitsy M4.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/itsybitsy-nrf52840.md b/content/microcontrollers/machine/itsybitsy-nrf52840.md
deleted file mode 100644
index 20603ff1..00000000
--- a/content/microcontrollers/machine/itsybitsy-nrf52840.md
+++ /dev/null
@@ -1,1391 +0,0 @@
-
----
-title: itsybitsy-nrf52840
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- D0 = P0_25 // UART TX
- D1 = P0_24 // UART RX
- D2 = P1_02
- D3 = P0_06 // LED1
- D4 = P0_29 // Button
- D5 = P0_27
- D6 = P1_09 // DotStar Clock
- D7 = P1_08
- D8 = P0_08 // DotStar Data
- D9 = P0_07
- D10 = P0_05
- D11 = P0_26
- D12 = P0_11
- D13 = P0_12
- D14 = P0_04 // A0
- D15 = P0_30 // A1
- D16 = P0_28 // A2
- D17 = P0_31 // A3
- D18 = P0_02 // A4
- D19 = P0_03 // A5
- D20 = P0_05 // A6
- D21 = P0_16 // I2C SDA
- D22 = P0_14 // I2C SCL
- D23 = P0_20 // SPI SDI
- D24 = P0_15 // SPI SDO
- D25 = P0_13 // SPI SCK
- D26 = P0_19 // QSPI SCK
- D27 = P0_23 // QSPI CS
- D28 = P0_21 // QSPI Data 0
- D29 = P0_22 // QSPI Data 1
- D30 = P1_00 // QSPI Data 2
- D31 = P0_17 // QSPI Data 3
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D14
- A1 = D15
- A2 = D16
- A3 = D17
- A4 = D18
- A5 = D19
- A6 = D20
-)
-```
-
-Analog Pins
-
-
-```go
-const (
- LED = D3
- LED1 = LED
- BUTTON = D4
-
- QSPI_SCK = D26
- QSPI_CS = D27
- QSPI_DATA0 = D28
- QSPI_DATA1 = D29
- QSPI_DATA2 = D30
- QSPI_DATA3 = D31
-)
-```
-
-
-
-```go
-const (
- UART_RX_PIN = D0
- UART_TX_PIN = D1
-)
-```
-
-UART0 pins (logical UART1)
-
-
-```go
-const (
- SDA_PIN = D21 // I2C0 external
- SCL_PIN = D22 // I2C0 external
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D25
- SPI0_SDO_PIN = D24
- SPI0_SDI_PIN = D23
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- DFU_MAGIC_SERIAL_ONLY_RESET = 0x4e
- DFU_MAGIC_UF2_RESET = 0x57
- DFU_MAGIC_OTA_RESET = 0xA8
-)
-```
-
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func EnterOTABootloader
-
-```go
-func EnterOTABootloader()
-```
-
-EnterOTABootloader resets the chip into the bootloader so that it can be
-flashed via an OTA update
-
-
-### func EnterSerialBootloader
-
-```go
-func EnterSerialBootloader()
-```
-
-EnterSerialBootloader resets the chip into the serial bootloader. After
-reset, it can be flashed using serial/nrfutil.
-
-
-### func EnterUF2Bootloader
-
-```go
-func EnterUF2Bootloader()
-```
-
-EnterUF2Bootloader resets the chip into the UF2 bootloader. After reset, it
-can be flashed via nrfutil or by copying a UF2 file to the mass storage device
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/metro-m4-airlift.md b/content/microcontrollers/machine/metro-m4-airlift.md
deleted file mode 100644
index 798558cf..00000000
--- a/content/microcontrollers/machine/metro-m4-airlift.md
+++ /dev/null
@@ -1,1724 +0,0 @@
-
----
-title: metro-m4-airlift
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA23 // UART0 RX/PWM available
- D1 = PA22 // UART0 TX/PWM available
- D2 = PB17 // PWM available
- D3 = PB16 // PWM available
- D4 = PB13 // PWM available
- D5 = PB14 // PWM available
- D6 = PB15 // PWM available
- D7 = PB12 // PWM available
-
- D8 = PA21 // PWM available
- D9 = PA20 // PWM available
- D10 = PA18 // can be used for PWM or UART1 TX
- D11 = PA19 // can be used for PWM or UART1 RX
- D12 = PA17 // PWM available
- D13 = PA16 // PWM available
-
- D40 = PB22 // built-in neopixel
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA05 // ADC/AIN[2]
- A2 = PB06 // ADC/AIN[3]
- A3 = PB00 // ADC/AIN[4] // NOTE: different between "airlift" and non-airlift versions
- A4 = PB08 // ADC/AIN[5]
- A5 = PB09 // ADC/AIN[10]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-
-
-```go
-const (
- UART2_TX_PIN = PA04
- UART2_RX_PIN = PA07
-)
-```
-
-
-
-```go
-const (
- NINA_CS = PA15
- NINA_ACK = PB04
- NINA_GPIO0 = PB01
- NINA_RESETN = PB05
-
- NINA_TX = PA04
- NINA_RX = PA07
- NINA_RTS = PB23
-)
-```
-
-
-
-```go
-const (
- SDA_PIN = PB02 // SDA: SERCOM5/PAD[0]
- SCL_PIN = PB03 // SCL: SERCOM5/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA13 // SCK: SERCOM2/PAD[1]
- SPI0_SDO_PIN = PA12 // SDO: SERCOM2/PAD[0]
- SPI0_SDI_PIN = PA14 // SDI: SERCOM2/PAD[2]
-
- NINA_SDO = SPI0_SDO_PIN
- NINA_SDI = SPI0_SDI_PIN
- NINA_SCK = SPI0_SCK_PIN
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN = D12 // SDI: SERCOM1/PAD[1]
- SPI1_SDO_PIN = D11 // SDO: SERCOM1/PAD[3]
- SPI1_SDI_PIN = D13 // SCK: SERCOM1/PAD[0]
-)
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM3_USART_INT,
- SERCOM: 3,
- }
-
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART_INT,
- SERCOM: 0,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM5_I2CM,
- SERCOM: 5,
- }
-)
-```
-
-I2C on the Metro M4.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM2_SPIM,
- SERCOM: 2,
- }
- NINA_SPI = SPI0
-)
-```
-
-SPI on the Metro M4.
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: sam.SERCOM1_SPIM,
- SERCOM: 1,
- }
-)
-```
-
-SPI1 on the Metro M4 on pins 11,12,13
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/microbit-s110v8.md b/content/microcontrollers/machine/microbit-s110v8.md
deleted file mode 100644
index da38515f..00000000
--- a/content/microcontrollers/machine/microbit-s110v8.md
+++ /dev/null
@@ -1,710 +0,0 @@
-
----
-title: microbit-s110v8
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = false
-```
-
-The micro:bit does not have a 32kHz crystal on board.
-
-
-```go
-const (
- BUTTON Pin = BUTTONA
- BUTTONA Pin = 17
- BUTTONB Pin = 26
-)
-```
-
-Buttons on the micro:bit (A and B)
-
-
-```go
-const (
- UART_TX_PIN Pin = 24
- UART_RX_PIN Pin = 25
-)
-```
-
-UART pins
-
-
-```go
-const (
- ADC0 Pin = 3 // P0 on the board
- ADC1 Pin = 2 // P1 on the board
- ADC2 Pin = 1 // P2 on the board
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 30 // P20 on the board
- SCL_PIN Pin = 0 // P19 on the board
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 23 // P13 on the board
- SPI0_SDO_PIN Pin = 21 // P15 on the board
- SPI0_SDI_PIN Pin = 22 // P14 on the board
-)
-```
-
-SPI pins
-
-
-```go
-const (
- P0 Pin = 3
- P1 Pin = 2
- P2 Pin = 1
- P3 Pin = 4
- P4 Pin = 5
- P5 Pin = 17
- P6 Pin = 12
- P7 Pin = 11
- P8 Pin = 18
- P9 Pin = 10
- P10 Pin = 6
- P11 Pin = 26
- P12 Pin = 20
- P13 Pin = 23
- P14 Pin = 22
- P15 Pin = 21
- P16 Pin = 16
-)
-```
-
-GPIO/Analog pins
-
-
-```go
-const (
- LED_COL_1 Pin = 4
- LED_COL_2 Pin = 5
- LED_COL_3 Pin = 6
- LED_COL_4 Pin = 7
- LED_COL_5 Pin = 8
- LED_COL_6 Pin = 9
- LED_COL_7 Pin = 10
- LED_COL_8 Pin = 11
- LED_COL_9 Pin = 12
- LED_ROW_1 Pin = 13
- LED_ROW_2 Pin = 14
- LED_ROW_3 Pin = 15
-)
-```
-
-LED matrix pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/microbit.md b/content/microcontrollers/machine/microbit.md
deleted file mode 100644
index 241393b4..00000000
--- a/content/microcontrollers/machine/microbit.md
+++ /dev/null
@@ -1,710 +0,0 @@
-
----
-title: microbit
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = false
-```
-
-The micro:bit does not have a 32kHz crystal on board.
-
-
-```go
-const (
- BUTTON Pin = BUTTONA
- BUTTONA Pin = 17
- BUTTONB Pin = 26
-)
-```
-
-Buttons on the micro:bit (A and B)
-
-
-```go
-const (
- UART_TX_PIN Pin = 24
- UART_RX_PIN Pin = 25
-)
-```
-
-UART pins
-
-
-```go
-const (
- ADC0 Pin = 3 // P0 on the board
- ADC1 Pin = 2 // P1 on the board
- ADC2 Pin = 1 // P2 on the board
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 30 // P20 on the board
- SCL_PIN Pin = 0 // P19 on the board
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 23 // P13 on the board
- SPI0_SDO_PIN Pin = 21 // P15 on the board
- SPI0_SDI_PIN Pin = 22 // P14 on the board
-)
-```
-
-SPI pins
-
-
-```go
-const (
- P0 Pin = 3
- P1 Pin = 2
- P2 Pin = 1
- P3 Pin = 4
- P4 Pin = 5
- P5 Pin = 17
- P6 Pin = 12
- P7 Pin = 11
- P8 Pin = 18
- P9 Pin = 10
- P10 Pin = 6
- P11 Pin = 26
- P12 Pin = 20
- P13 Pin = 23
- P14 Pin = 22
- P15 Pin = 21
- P16 Pin = 16
-)
-```
-
-GPIO/Analog pins
-
-
-```go
-const (
- LED_COL_1 Pin = 4
- LED_COL_2 Pin = 5
- LED_COL_3 Pin = 6
- LED_COL_4 Pin = 7
- LED_COL_5 Pin = 8
- LED_COL_6 Pin = 9
- LED_COL_7 Pin = 10
- LED_COL_8 Pin = 11
- LED_COL_9 Pin = 12
- LED_ROW_1 Pin = 13
- LED_ROW_2 Pin = 14
- LED_ROW_3 Pin = 15
-)
-```
-
-LED matrix pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/nintendoswitch.md b/content/microcontrollers/machine/nintendoswitch.md
deleted file mode 100644
index c27512c2..00000000
--- a/content/microcontrollers/machine/nintendoswitch.md
+++ /dev/null
@@ -1,509 +0,0 @@
-
----
-title: nintendoswitch
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinOutput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- SPI0 = SPI{0}
- I2C0 = I2C{0}
- UART0 = UART{0}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC enables support for ADC peripherals.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM enables support for PWM peripherals.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (adc ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (adc ADC) Get() uint16
-```
-
-Get reads the current analog value from this ADC peripheral.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus uint8
-}
-```
-
-I2C is a generic implementation of the Inter-IC communication protocol.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- Mode uint8
-}
-```
-
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the UART.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-WriteByte writes a single byte to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/nodemcu.md b/content/microcontrollers/machine/nodemcu.md
deleted file mode 100644
index 4faaf97c..00000000
--- a/content/microcontrollers/machine/nodemcu.md
+++ /dev/null
@@ -1,415 +0,0 @@
-
----
-title: nodemcu
----
-
-
-## Constants
-
-```go
-const (
- D0 Pin = 16
- D1 Pin = 5
- D2 Pin = 4
- D3 Pin = 0
- D4 Pin = 2
- D5 Pin = 14
- D6 Pin = 12
- D7 Pin = 13
- D8 Pin = 15
-)
-```
-
-GPIO pins on the NodeMCU board.
-
-
-```go
-const LED = D4
-```
-
-Onboard blue LED (on the AI-Thinker module).
-
-
-```go
-const (
- SPI0_SCK_PIN = D5
- SPI0_SDO_PIN = D7
- SPI0_SDI_PIN = D6
- SPI0_CS0_PIN = D8
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = D2
- SCL_PIN = D1
-)
-```
-
-I2C pins
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinOutput PinMode = iota
- PinInput
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN Pin = 1
- UART_RX_PIN Pin = 3
-)
-```
-
-Pins that are fixed by the chip.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var UART0 = UART{Buffer: NewRingBuffer()}
-```
-
-UART0 is a hardware UART that supports both TX and RX.
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure sets the given pin as output or input pin.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin when the pin is configured as an
-input.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-Warning: only use this on an output pin!
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-Set sets the output value of this pin to high (true) or low (false).
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART baud rate. TX and RX pins are fixed by the hardware so
-cannot be modified and will be ignored.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a single byte to the output buffer. Note that the hardware
-includes a buffer of 128 bytes which will be used first.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/nrf52840-mdk.md b/content/microcontrollers/machine/nrf52840-mdk.md
deleted file mode 100644
index 3aaaef8d..00000000
--- a/content/microcontrollers/machine/nrf52840-mdk.md
+++ /dev/null
@@ -1,1291 +0,0 @@
-
----
-title: nrf52840-mdk
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = LED_GREEN
- LED_GREEN Pin = 22
- LED_RED Pin = 23
- LED_BLUE Pin = 24
-)
-```
-
-LEDs on the nrf52840-mdk (nRF52840 dev board)
-
-
-```go
-const (
- UART_TX_PIN Pin = 20
- UART_RX_PIN Pin = 19
-)
-```
-
-UART pins
-
-
-```go
-const (
- SDA_PIN = NoPin
- SCL_PIN = NoPin
-)
-```
-
-I2C pins (unused)
-
-
-```go
-const (
- SPI0_SCK_PIN = NoPin
- SPI0_SDO_PIN = NoPin
- SPI0_SDI_PIN = NoPin
-)
-```
-
-SPI pins (unused)
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = USB
-)
-```
-
-UART0 is the USB device
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/nucleo-f103rb.md b/content/microcontrollers/machine/nucleo-f103rb.md
deleted file mode 100644
index bb1ba467..00000000
--- a/content/microcontrollers/machine/nucleo-f103rb.md
+++ /dev/null
@@ -1,709 +0,0 @@
-
----
-title: nucleo-f103rb
----
-
-
-## Constants
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PA8 = portA + 8
- PA9 = portA + 9
- PA10 = portA + 10
- PA11 = portA + 11
- PA12 = portA + 12
- PA13 = portA + 13
- PA14 = portA + 14
- PA15 = portA + 15
-
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PB8 = portB + 8
- PB9 = portB + 9
- PB10 = portB + 10
- PB11 = portB + 11
- PB12 = portB + 12
- PB13 = portB + 13
- PB14 = portB + 14
- PB15 = portB + 15
-
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PC8 = portC + 8
- PC9 = portC + 9
- PC10 = portC + 10
- PC11 = portC + 11
- PC12 = portC + 12
- PC13 = portC + 13
- PC14 = portC + 14
- PC15 = portC + 15
-
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
- PD8 = portD + 8
- PD9 = portD + 9
- PD10 = portD + 10
- PD11 = portD + 11
- PD12 = portD + 12
- PD13 = portD + 13
- PD14 = portD + 14
- PD15 = portD + 15
-)
-```
-
-
-
-```go
-const (
- LED = LED_BUILTIN
- LED_BUILTIN = LED_GREEN
- LED_GREEN = PA5
-)
-```
-
-
-
-```go
-const (
- BUTTON = BUTTON_USER
- BUTTON_USER = PC13
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN = PA2
- UART_RX_PIN = PA3
- UART_ALT_TX_PIN = PD5
- UART_ALT_RX_PIN = PD6
-)
-```
-
-UART pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA5
- SPI0_SDI_PIN = PA6
- SPI0_SDO_PIN = PA7
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SCL_PIN = PB6
- SDA_PIN = PB7
-)
-```
-
-I2C pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = 0 // Input mode
- PinOutput10MHz PinMode = 1 // Output mode, max speed 10MHz
- PinOutput2MHz PinMode = 2 // Output mode, max speed 2MHz
- PinOutput50MHz PinMode = 3 // Output mode, max speed 50MHz
- PinOutput PinMode = PinOutput2MHz
-
- PinInputModeAnalog PinMode = 0 // Input analog mode
- PinInputModeFloating PinMode = 4 // Input floating mode
- PinInputModePullUpDown PinMode = 8 // Input pull up/down mode
- PinInputModeReserved PinMode = 12 // Input mode (reserved)
-
- PinOutputModeGPPushPull PinMode = 0 // Output mode general purpose push/pull
- PinOutputModeGPOpenDrain PinMode = 4 // Output mode general purpose open drain
- PinOutputModeAltPushPull PinMode = 8 // Output mode alt. purpose push/pull
- PinOutputModeAltOpenDrain PinMode = 12 // Output mode alt. purpose open drain
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- // USART2 is the hardware serial port connected to the onboard ST-LINK
- // debugger to be exposed as virtual COM port over USB on Nucleo boards.
- // Both UART0 and UART1 refer to USART2.
- UART0 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART2,
- }
- UART2 = &UART0
-)
-```
-
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- SPI1 = SPI{Bus: stm32.SPI1}
- SPI0 = SPI1
-)
-```
-
-There are 3 SPI interfaces on the STM32F103xx.
-Since the first interface is named SPI1, both SPI0 and SPI1 refer to SPI1.
-TODO: implement SPI2 and SPI3.
-
-
-```go
-var (
- I2C1 = I2C{Bus: stm32.I2C1}
- I2C0 = I2C1
-)
-```
-
-There are 2 I2C interfaces on the STM32F103xx.
-Since the first interface is named I2C1, both I2C0 and I2C1 refer to I2C1.
-TODO: implement I2C2.
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *stm32.I2C_Type
-}
-```
-
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given I/O settings.
-stm32f1xx uses different technique for setting the GPIO pins than the stm32f407
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *stm32.SPI_Type
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the STM32 SPI1 interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *stm32.USART_Type
- Interrupt interrupt.Interrupt
-}
-```
-
-UART representation
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART. Defer to chip-specific
-routines for calculation
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/particle-3rd-gen.md b/content/microcontrollers/machine/particle-3rd-gen.md
deleted file mode 100644
index f137240d..00000000
--- a/content/microcontrollers/machine/particle-3rd-gen.md
+++ /dev/null
@@ -1,1233 +0,0 @@
-
----
-title: particle-3rd-gen
----
-
-
-## Constants
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/particle-argon.md b/content/microcontrollers/machine/particle-argon.md
deleted file mode 100644
index 5c18ff8d..00000000
--- a/content/microcontrollers/machine/particle-argon.md
+++ /dev/null
@@ -1,1363 +0,0 @@
-
----
-title: particle-argon
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = 44
- LED_GREEN Pin = 14
- LED_RED Pin = 13
- LED_BLUE Pin = 15
-)
-```
-
-LEDs
-
-
-```go
-const (
- A0 Pin = 3
- A1 Pin = 4
- A2 Pin = 28
- A3 Pin = 29
- A4 Pin = 30
- A5 Pin = 31
- D0 Pin = 26 // Also SDA
- D1 Pin = 27 // Also SCL
- D2 Pin = 33
- D3 Pin = 34
- D4 Pin = 40
- D5 Pin = 42
- D6 Pin = 43
- D7 Pin = 44 // Also LED
- D8 Pin = 35
- D9 Pin = 6 // Also TX
- D10 Pin = 8 // Also RX
- D11 Pin = 46 // Also SDI
- D12 Pin = 45 // Also SDO
- D13 Pin = 47 // Also SCK
-)
-```
-
-GPIOs
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47
- SPI0_SDO_PIN Pin = 45
- SPI0_SDI_PIN Pin = 46
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN Pin = 19
- SPI1_SDO_PIN Pin = 20
- SPI1_SDI_PIN Pin = 21
- SPI1_CS_PIN Pin = 17
- SPI1_WP_PIN Pin = 22
- SPI1_HOLD_PIN Pin = 23
-)
-```
-
-Internal 4MB SPI Flash
-
-
-```go
-const (
- ESP32_TXD_PIN Pin = 36
- ESP32_RXD_PIN Pin = 37
- ESP32_CTS_PIN Pin = 39
- ESP32_RTS_PIN Pin = 38
- ESP32_BOOT_MODE_PIN Pin = 16
- ESP32_WIFI_EN_PIN Pin = 24
- ESP32_HOST_WK_PIN Pin = 7
-)
-```
-
-ESP32 coprocessor
-
-
-```go
-const (
- MODE_BUTTON_PIN Pin = 11
- CHARGE_STATUS_PIN Pin = 41
- LIPO_VOLTAGE_PIN Pin = 5
- PCB_ANTENNA_PIN Pin = 2
- EXTERNAL_UFL_PIN Pin = 25
- NFC1_PIN Pin = 9
- NFC2_PIN Pin = 10
-)
-```
-
-Other peripherals
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- Serial = USB
- UART0 = NRF_UART0
-)
-```
-
-UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/particle-boron.md b/content/microcontrollers/machine/particle-boron.md
deleted file mode 100644
index 56174049..00000000
--- a/content/microcontrollers/machine/particle-boron.md
+++ /dev/null
@@ -1,1366 +0,0 @@
-
----
-title: particle-boron
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = 44
- LED_GREEN Pin = 14
- LED_RED Pin = 13
- LED_BLUE Pin = 15
-)
-```
-
-LEDs
-
-
-```go
-const (
- A0 Pin = 3
- A1 Pin = 4
- A2 Pin = 28
- A3 Pin = 29
- A4 Pin = 30
- A5 Pin = 31
- D0 Pin = 26 // Also SDA
- D1 Pin = 27 // Also SCL
- D2 Pin = 33
- D3 Pin = 34
- D4 Pin = 40
- D5 Pin = 42
- D6 Pin = 43
- D7 Pin = 44 // Also LED
- D8 Pin = 35
- D9 Pin = 6 // Also TX
- D10 Pin = 8 // Also RX
- D11 Pin = 46 // Also SDI
- D12 Pin = 45 // Also SDO
- D13 Pin = 47 // Also SCK
-)
-```
-
-GPIOs
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-
- // Internal I2C with MAX17043 (Fuel gauge) and BQ24195 (Power management) chips on it
- SDA1_PIN Pin = 24
- SCL1_PIN Pin = 41
- INT1_PIN Pin = 5
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47
- SPI0_SDO_PIN Pin = 45
- SPI0_SDI_PIN Pin = 46
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN Pin = 19
- SPI1_SDO_PIN Pin = 20
- SPI1_SDI_PIN Pin = 21
- SPI1_CS_PIN Pin = 17
- SPI1_WP_PIN Pin = 22
- SPI1_HOLD_PIN Pin = 23
-)
-```
-
-Internal 4MB SPI Flash
-
-
-```go
-const (
- SARA_TXD_PIN Pin = 37
- SARA_RXD_PIN Pin = 36
- SARA_CTS_PIN Pin = 38
- SARA_RTS_PIN Pin = 39
- SARA_RESET_PIN Pin = 12
- SARA_POWER_ON_PIN Pin = 16
- SARA_BUFF_EN_PIN Pin = 25
- SARA_VINT_PIN Pin = 2
-)
-```
-
-u-blox SARA coprocessor
-
-
-```go
-const (
- MODE_BUTTON_PIN Pin = 11
- ANTENNA_SEL_PIN Pin = 7 // Low: chip antenna, High: External uFL
- NFC1_PIN Pin = 9
- NFC2_PIN Pin = 10
-)
-```
-
-Other peripherals
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- Serial = USB
- UART0 = NRF_UART0
-)
-```
-
-UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/particle-xenon.md b/content/microcontrollers/machine/particle-xenon.md
deleted file mode 100644
index d6984a58..00000000
--- a/content/microcontrollers/machine/particle-xenon.md
+++ /dev/null
@@ -1,1348 +0,0 @@
-
----
-title: particle-xenon
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = 44
- LED_GREEN Pin = 14
- LED_RED Pin = 13
- LED_BLUE Pin = 15
-)
-```
-
-LEDs
-
-
-```go
-const (
- A0 Pin = 3
- A1 Pin = 4
- A2 Pin = 28
- A3 Pin = 29
- A4 Pin = 30
- A5 Pin = 31
- D0 Pin = 26 // Also SDA
- D1 Pin = 27 // Also SCL
- D2 Pin = 33
- D3 Pin = 34
- D4 Pin = 40
- D5 Pin = 42
- D6 Pin = 43
- D7 Pin = 44 // Also LED
- D8 Pin = 35
- D9 Pin = 6 // Also TX
- D10 Pin = 8 // Also RX
- D11 Pin = 46 // Also SDI
- D12 Pin = 45 // Also SDO
- D13 Pin = 47 // Also SCK
-)
-```
-
-GPIOs
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47
- SPI0_SDO_PIN Pin = 45
- SPI0_SDI_PIN Pin = 46
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN Pin = 19
- SPI1_SDO_PIN Pin = 20
- SPI1_SDI_PIN Pin = 21
- SPI1_CS_PIN Pin = 17
- SPI1_WP_PIN Pin = 22
- SPI1_HOLD_PIN Pin = 23
-)
-```
-
-Internal 4MB SPI Flash
-
-
-```go
-const (
- MODE_BUTTON_PIN Pin = 11
- CHARGE_STATUS_PIN Pin = 41
- LIPO_VOLTAGE_PIN Pin = 5
- PCB_ANTENNA_PIN Pin = 24
- EXTERNAL_UFL_PIN Pin = 25
- NFC1_PIN Pin = 9
- NFC2_PIN Pin = 10
-)
-```
-
-Other peripherals
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- Serial = USB
- UART0 = NRF_UART0
-)
-```
-
-UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/pca10031.md b/content/microcontrollers/machine/pca10031.md
deleted file mode 100644
index 8adb561d..00000000
--- a/content/microcontrollers/machine/pca10031.md
+++ /dev/null
@@ -1,658 +0,0 @@
-
----
-title: pca10031
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-The pca10031 has a 32kHz crystal on board.
-
-
-```go
-const (
- LED Pin = LED_RED
- LED1 Pin = LED_RED
- LED2 Pin = LED_GREEN
- LED3 Pin = LED_BLUE
- LED_RED Pin = 21
- LED_GREEN Pin = 22
- LED_BLUE Pin = 23
-)
-```
-
-LED on the pca10031
-
-
-```go
-const (
- UART_TX_PIN Pin = 9
- UART_RX_PIN Pin = 11
-)
-```
-
-UART pins
-
-
-```go
-const (
- SDA_PIN = NoPin
- SCL_PIN = NoPin
-)
-```
-
-I2C pins (disabled)
-
-
-```go
-const (
- SPI0_SCK_PIN = NoPin
- SPI0_SDO_PIN = NoPin
- SPI0_SDI_PIN = NoPin
-)
-```
-
-SPI pins (unused)
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/pca10040-s132v6.md b/content/microcontrollers/machine/pca10040-s132v6.md
deleted file mode 100644
index 32ac628e..00000000
--- a/content/microcontrollers/machine/pca10040-s132v6.md
+++ /dev/null
@@ -1,737 +0,0 @@
-
----
-title: pca10040-s132v6
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-The PCA10040 has a low-frequency (32kHz) crystal oscillator on board.
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = 17
- LED2 Pin = 18
- LED3 Pin = 19
- LED4 Pin = 20
-)
-```
-
-LEDs on the PCA10040 (nRF52832 dev board)
-
-
-```go
-const (
- BUTTON Pin = BUTTON1
- BUTTON1 Pin = 13
- BUTTON2 Pin = 14
- BUTTON3 Pin = 15
- BUTTON4 Pin = 16
-)
-```
-
-Buttons on the PCA10040 (nRF52832 dev board)
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins for NRF52840-DK
-
-
-```go
-const (
- ADC0 Pin = 3
- ADC1 Pin = 4
- ADC2 Pin = 28
- ADC3 Pin = 29
- ADC4 Pin = 30
- ADC5 Pin = 31
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 25
- SPI0_SDO_PIN Pin = 23
- SPI0_SDI_PIN Pin = 24
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/pca10040.md b/content/microcontrollers/machine/pca10040.md
deleted file mode 100644
index d9cc6aa8..00000000
--- a/content/microcontrollers/machine/pca10040.md
+++ /dev/null
@@ -1,737 +0,0 @@
-
----
-title: pca10040
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-The PCA10040 has a low-frequency (32kHz) crystal oscillator on board.
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = 17
- LED2 Pin = 18
- LED3 Pin = 19
- LED4 Pin = 20
-)
-```
-
-LEDs on the PCA10040 (nRF52832 dev board)
-
-
-```go
-const (
- BUTTON Pin = BUTTON1
- BUTTON1 Pin = 13
- BUTTON2 Pin = 14
- BUTTON3 Pin = 15
- BUTTON4 Pin = 16
-)
-```
-
-Buttons on the PCA10040 (nRF52832 dev board)
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins for NRF52840-DK
-
-
-```go
-const (
- ADC0 Pin = 3
- ADC1 Pin = 4
- ADC2 Pin = 28
- ADC3 Pin = 29
- ADC4 Pin = 30
- ADC5 Pin = 31
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 25
- SPI0_SDO_PIN Pin = 23
- SPI0_SDI_PIN Pin = 24
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/pca10056-s140v7.md b/content/microcontrollers/machine/pca10056-s140v7.md
deleted file mode 100644
index 07c2fcf0..00000000
--- a/content/microcontrollers/machine/pca10056-s140v7.md
+++ /dev/null
@@ -1,1319 +0,0 @@
-
----
-title: pca10056-s140v7
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = 13
- LED2 Pin = 14
- LED3 Pin = 15
- LED4 Pin = 16
-)
-```
-
-LEDs on the pca10056
-
-
-```go
-const (
- BUTTON Pin = BUTTON1
- BUTTON1 Pin = 11
- BUTTON2 Pin = 12
- BUTTON3 Pin = 24
- BUTTON4 Pin = 25
-)
-```
-
-Buttons on the pca10056
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins
-
-
-```go
-const (
- ADC0 Pin = 3
- ADC1 Pin = 4
- ADC2 Pin = 28
- ADC3 Pin = 29
- ADC4 Pin = 30
- ADC5 Pin = 31
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 26 // P0.26
- SCL_PIN Pin = 27 // P0.27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47 // P1.15
- SPI0_SDO_PIN Pin = 45 // P1.13
- SPI0_SDI_PIN Pin = 46 // P1.14
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-UART0 is the NRF UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/pca10056.md b/content/microcontrollers/machine/pca10056.md
deleted file mode 100644
index 18800c4a..00000000
--- a/content/microcontrollers/machine/pca10056.md
+++ /dev/null
@@ -1,1319 +0,0 @@
-
----
-title: pca10056
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = 13
- LED2 Pin = 14
- LED3 Pin = 15
- LED4 Pin = 16
-)
-```
-
-LEDs on the pca10056
-
-
-```go
-const (
- BUTTON Pin = BUTTON1
- BUTTON1 Pin = 11
- BUTTON2 Pin = 12
- BUTTON3 Pin = 24
- BUTTON4 Pin = 25
-)
-```
-
-Buttons on the pca10056
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins
-
-
-```go
-const (
- ADC0 Pin = 3
- ADC1 Pin = 4
- ADC2 Pin = 28
- ADC3 Pin = 29
- ADC4 Pin = 30
- ADC5 Pin = 31
-)
-```
-
-ADC pins
-
-
-```go
-const (
- SDA_PIN Pin = 26 // P0.26
- SCL_PIN Pin = 27 // P0.27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47 // P1.15
- SPI0_SDO_PIN Pin = 45 // P1.13
- SPI0_SDI_PIN Pin = 46 // P1.14
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-UART0 is the NRF UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/pinetime-devkit0.md b/content/microcontrollers/machine/pinetime-devkit0.md
deleted file mode 100644
index 4e4a5d39..00000000
--- a/content/microcontrollers/machine/pinetime-devkit0.md
+++ /dev/null
@@ -1,746 +0,0 @@
-
----
-title: pinetime-devkit0
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-The PineTime has a low-frequency (32kHz) crystal oscillator on board.
-
-
-```go
-const (
- LED = LED1
- LED1 = LCD_BACKLIGHT_HIGH
- LED2 = LCD_BACKLIGHT_MID
- LED3 = LCD_BACKLIGHT_LOW
-)
-```
-
-LEDs simply expose the three brightness level LEDs on the PineTime. They can
-be useful for simple "hello world" style programs.
-
-
-```go
-const (
- UART_TX_PIN Pin = 11 // TP29 (TXD)
- UART_RX_PIN Pin = NoPin
-)
-```
-
-UART pins for PineTime. Note that RX is set to NoPin as RXD is not listed in
-the PineTime schematic 1.0:
-http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 2
- SPI0_SDO_PIN Pin = 3
- SPI0_SDI_PIN Pin = 4
-)
-```
-
-SPI pins for the PineTime.
-
-
-```go
-const (
- SDA_PIN Pin = 6
- SCL_PIN Pin = 7
-)
-```
-
-I2C pins for the PineTime.
-
-
-```go
-const (
- BUTTON_IN Pin = 13
- BUTTON_OUT Pin = 15
-)
-```
-
-Button pins. For some reason, there are two pins for the button.
-
-
-```go
-const VIBRATOR_PIN Pin = 16
-```
-
-Pin for the vibrator.
-
-
-```go
-const (
- LCD_SCK = SPI0_SCK_PIN
- LCD_SDI = SPI0_SDO_PIN
- LCD_RS Pin = 18
- LCD_CS Pin = 25
- LCD_RESET Pin = 26
- LCD_BACKLIGHT_LOW Pin = 14
- LCD_BACKLIGHT_MID Pin = 22
- LCD_BACKLIGHT_HIGH Pin = 23
-)
-```
-
-LCD pins, using the naming convention of the official docs:
-http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/pybadge.md b/content/microcontrollers/machine/pybadge.md
deleted file mode 100644
index 3dfce486..00000000
--- a/content/microcontrollers/machine/pybadge.md
+++ /dev/null
@@ -1,1736 +0,0 @@
-
----
-title: pybadge
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PB17 // UART0 RX/PWM available
- D1 = PB16 // UART0 TX/PWM available
- D2 = PB03
- D3 = PB02
- D4 = PA14 // PWM available
- D5 = PA16 // PWM available
- D6 = PA18 // PWM available
- D7 = PB14
- D8 = PA15 // built-in neopixel
- D9 = PA19 // PWM available
- D10 = PA20 // can be used for PWM or UART1 TX
- D11 = PA21 // can be used for PWM or UART1 RX
- D12 = PA22 // PWM available
- D13 = PA23 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA05 // ADC/AIN[2]
- A2 = PB08 // ADC/AIN[3]
- A3 = PB09 // ADC/AIN[4]
- A4 = PA04 // ADC/AIN[5]
- A5 = PA06 // ADC/AIN[6]
- A6 = PB01 // ADC/AIN[12]/VMEAS
- A7 = PB04 // ADC/AIN[6]/LIGHT
- A8 = D2 // ADC/AIN[14]
- A9 = D3 // ADC/AIN[15]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
- NEOPIXELS = D8
-
- LIGHTSENSOR = A7
-
- BUTTON_LATCH = PB00
- BUTTON_OUT = PB30
- BUTTON_CLK = PB31
-
- TFT_DC = PB05
- TFT_CS = PB07
- TFT_RST = PA00
- TFT_LITE = PA01
-
- SPEAKER_ENABLE = PA27
-)
-```
-
-
-
-```go
-const (
- BUTTON_LEFT_MASK = 1
- BUTTON_UP_MASK = 2
- BUTTON_DOWN_MASK = 4
- BUTTON_RIGHT_MASK = 8
- BUTTON_SELECT_MASK = 16
- BUTTON_START_MASK = 32
- BUTTON_A_MASK = 64
- BUTTON_B_MASK = 128
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- UART2_TX_PIN = A4
- UART2_RX_PIN = A5
-)
-```
-
-
-
-```go
-const (
- SDA_PIN = PA12 // SDA: SERCOM2/PAD[0]
- SCL_PIN = PA13 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA17 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN = PB23 // SDO: SERCOM1/PAD[3]
- SPI0_SDI_PIN = PB22 // SDI: SERCOM1/PAD[2]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN = PB13 // SCK: SERCOM4/PAD[1]
- SPI1_SDO_PIN = PB15 // SDO: SERCOM4/PAD[3]
- SPI1_SDI_PIN = NoPin
-)
-```
-
-TFT SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM5_USART_INT,
- SERCOM: 5,
- }
-
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART_INT,
- SERCOM: 0,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the ItsyBitsy M4.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM1_SPIM,
- SERCOM: 1,
- }
-)
-```
-
-SPI on the PyBadge.
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: sam.SERCOM4_SPIM,
- SERCOM: 4,
- }
-)
-```
-
-TFT SPI on the PyBadge.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/pygamer.md b/content/microcontrollers/machine/pygamer.md
deleted file mode 100644
index 801fd155..00000000
--- a/content/microcontrollers/machine/pygamer.md
+++ /dev/null
@@ -1,1720 +0,0 @@
-
----
-title: pygamer
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PB17 // UART0 RX/PWM available
- D1 = PB16 // UART0 TX/PWM available
- D2 = PB03
- D3 = PB02
- D4 = PA14 // PWM available
- D5 = PA16 // PWM available
- D6 = PA18 // PWM available
- D7 = PB14 // CS for microSD card slot
- D8 = PA15 // built-in neopixel
- D9 = PA19 // PWM available
- D10 = PA20 // can be used for PWM or UART1 TX
- D11 = PA21 // can be used for PWM or UART1 RX
- D12 = PA22 // PWM available
- D13 = PA23 // PWM available
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA05 // ADC/AIN[2]
- A2 = PB08 // ADC/AIN[3]
- A3 = PB09 // ADC/AIN[4]
- A4 = PA04 // ADC/AIN[5]
- A5 = PA06 // ADC/AIN[6]
- A6 = PB01 // ADC/AIN[12]/VMEAS
- A7 = PB04 // ADC/AIN[6]/LIGHT
- A8 = D2 // ADC/AIN[14]
- A9 = D3 // ADC/AIN[15]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
- NEOPIXELS = D8
-
- SD_CS = D7
-
- LIGHTSENSOR = A7
-
- BUTTON_LATCH = PB00
- BUTTON_OUT = PB30
- BUTTON_CLK = PB31
-
- JOYY = PB06
- JOYX = PB07
-
- TFT_DC = PB05
- TFT_CS = PB12
- TFT_RST = PA00
- TFT_LITE = PA01
-
- SPEAKER_ENABLE = PA27
-)
-```
-
-
-
-```go
-const (
- BUTTON_SELECT_MASK = 16
- BUTTON_START_MASK = 32
- BUTTON_A_MASK = 64
- BUTTON_B_MASK = 128
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- UART2_TX_PIN = A4
- UART2_RX_PIN = A5
-)
-```
-
-UART2 pins
-
-
-```go
-const (
- SDA_PIN = PA12 // SDA: SERCOM2/PAD[0]
- SCL_PIN = PA13 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA17 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN = PB23 // SDO: SERCOM1/PAD[3]
- SPI0_SDI_PIN = PB22 // SDI: SERCOM1/PAD[2]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SPI1_SCK_PIN = PB13 // SCK: SERCOM4/PAD[1]
- SPI1_SDO_PIN = PB15 // SDO: SERCOM4/PAD[3]
- SPI1_SDI_PIN = NoPin
-)
-```
-
-TFT SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the PyGamer.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM1_SPIM,
- SERCOM: 1,
- }
-)
-```
-
-SPI on the PyGamer.
-
-
-```go
-var (
- SPI1 = SPI{
- Bus: sam.SERCOM4_SPIM,
- SERCOM: 4,
- }
-)
-```
-
-TFT SPI on the PyGamer.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/pyportal.md b/content/microcontrollers/machine/pyportal.md
deleted file mode 100644
index b66da68f..00000000
--- a/content/microcontrollers/machine/pyportal.md
+++ /dev/null
@@ -1,1727 +0,0 @@
-
----
-title: pyportal
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PB13 // NINA_RX
- D1 = PB12 // NINA_TX
- D2 = PB22 // built-in neopixel
- D3 = PA04 // PWM available
- D4 = PA05 // PWM available
- D5 = PB16 // NINA_ACK
- D6 = PB15 // NINA_GPIO0
- D7 = PB17 // NINA_RESETN
- D8 = PB14 // NINA_CS
- D9 = PB04 // TFT_RD
- D10 = PB05 // TFT_DC
- D11 = PB06 // TFT_CS
- D12 = PB07 // TFT_TE
- D13 = PB23 // built-in LED
- D24 = PA00 // TFT_RESET
- D25 = PB31 // TFT_BACKLIGHT
- D26 = PB09 // TFT_WR
- D27 = PB02 // SDA
- D28 = PB03 // SCL
- D29 = PA12 // SDO
- D30 = PA13 // SCK
- D31 = PA14 // SDI
- D32 = PB30 // SD_CS
- D33 = PA01 // SD_CARD_DETECT
- D34 = PA16 // LCD_DATA0
- D35 = PA17 // LCD_DATA1
- D36 = PA18 // LCD_DATA2
- D37 = PA19 // LCD_DATA3
- D38 = PA20 // LCD_DATA4
- D39 = PA21 // LCD_DATA5
- D40 = PA22 // LCD_DATA6
- D41 = PA23 // LCD_DATA7
- D42 = PB10 // QSPI
- D43 = PB11 // QSPI
- D44 = PA08 // QSPI
- D45 = PA09 // QSPI
- D46 = PA10 // QSPI
- D47 = PA11 // QSPI
- D50 = PA02 // speaker amplifier shutdown
- D51 = PA15 // NINA_RTS
-
- NINA_CS = D8
- NINA_ACK = D5
- NINA_GPIO0 = D6
- NINA_RESETN = D7
-
- NINA_TX = D1
- NINA_RX = D0
- NINA_RTS = D51
-
- LCD_DATA0 = D34
-
- TFT_RD = D9
- TFT_DC = D10
- TFT_CS = D11
- TFT_TE = D12
- TFT_RESET = D24
- TFT_BACKLIGHT = D25
- TFT_WR = D26
-
- NEOPIXEL = D2
- SPK_SD = D50
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC0/AIN[0]
- A1 = D3 // ADC0/AIN[4]
- A2 = PA07 // ADC0/AIN[7]
- A3 = D4 // ADC0/AIN[5]
- A4 = PB00 // ADC0/AIN[12]
- A5 = PB01 // ADC0/AIN[13]
- A6 = PA06 // ADC0/AIN[6]
- A7 = PB08 // ADC1/AIN[0]
-
- AUDIO_OUT = A0
- LIGHT = A2
- TOUCH_YD = A4
- TOUCH_XL = A5
- TOUCH_YU = A6
- TOUCH_XR = A7
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D1
- UART_RX_PIN = D0
-)
-```
-
-UART1 aka NINA_TX/NINA_RX
-
-
-```go
-const (
- SDA_PIN = PB02 // SDA: SERCOM2/PAD[0]
- SCL_PIN = PB03 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA13 // SCK: SERCOM1/PAD[1]
- SPI0_SDO_PIN = PA12 // SDO: SERCOM1/PAD[3]
- SPI0_SDI_PIN = PA14 // SDI: SERCOM1/PAD[2]
-
- NINA_SDO = SPI0_SDO_PIN
- NINA_SDI = SPI0_SDI_PIN
- NINA_SCK = SPI0_SCK_PIN
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00040000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM4_USART_INT,
- SERCOM: 4,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM5_I2CM,
- SERCOM: 5,
- }
-)
-```
-
-I2C on the PyPortal.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM2_SPIM,
- SERCOM: 2,
- }
- NINA_SPI = SPI0
-)
-```
-
-SPI on the PyPortal.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/qtpy.md b/content/microcontrollers/machine/qtpy.md
deleted file mode 100644
index 3f0403a2..00000000
--- a/content/microcontrollers/machine/qtpy.md
+++ /dev/null
@@ -1,1609 +0,0 @@
-
----
-title: qtpy
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA02 // PWM available
- D1 = PA03
- D2 = PA04 // PWM available
- D3 = PA05 // PWM available
- D4 = PA16 // PWM available
- D5 = PA17 // PWM available
- D6 = PA06
- D7 = PA07
- D8 = PA11
- D9 = PA09
- D10 = PA10
- D11 = PA18
- D12 = PA15
- D13 = PA27
- D14 = PA23
- D15 = PA19
- D16 = PA22
- D17 = PA08
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D1
- A1 = D1
- A2 = D2
- A3 = D3
- A4 = D4
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D6
- UART_RX_PIN = D7
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D8
- SPI0_SDO_PIN = D10
- SPI0_SDI_PIN = D9
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = D4 // SDA
- SCL_PIN = D5 // SCL
-)
-```
-
-I2C pins
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on QT Py M0.
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART,
- SERCOM: 0,
- }
-)
-```
-
-UART1 on the QT Py M0.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM0_SPI,
- SERCOM: 0,
- }
-)
-```
-
-SPI on the QT Py M0.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the QT Py M0.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/reelboard-s140v7.md b/content/microcontrollers/machine/reelboard-s140v7.md
deleted file mode 100644
index a16c363b..00000000
--- a/content/microcontrollers/machine/reelboard-s140v7.md
+++ /dev/null
@@ -1,1323 +0,0 @@
-
----
-title: reelboard-s140v7
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = LED_YELLOW
- LED2 Pin = LED_RED
- LED3 Pin = LED_GREEN
- LED4 Pin = LED_BLUE
- LED_RED Pin = 11
- LED_GREEN Pin = 12
- LED_BLUE Pin = 41
- LED_YELLOW Pin = 13
- EPD_BUSY_PIN Pin = 14
- EPD_RESET_PIN Pin = 15
- EPD_DC_PIN Pin = 16
- EPD_CS_PIN Pin = 17
- EPD_SCK_PIN Pin = 19
- EPD_SDO_PIN Pin = 20
- POWER_SUPPLY_PIN Pin = 32
-)
-```
-
-Pins on the reel board
-
-
-```go
-const (
- BUTTON Pin = 7
-)
-```
-
-User "a" button on the reel board
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47
- SPI0_SDO_PIN Pin = 45
- SPI0_SDI_PIN Pin = 46
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-UART0 is the NRF UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func PowerSupplyActive
-
-```go
-func PowerSupplyActive(active bool)
-```
-
-PowerSupplyActive enables the supply voltages for nRF52840 and peripherals (true) or only for nRF52840 (false)
-This controls the TPS610981 boost converter. You must turn the power supply active in order to use the EPD and
-other onboard peripherals.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/reelboard.md b/content/microcontrollers/machine/reelboard.md
deleted file mode 100644
index 26d3f17f..00000000
--- a/content/microcontrollers/machine/reelboard.md
+++ /dev/null
@@ -1,1323 +0,0 @@
-
----
-title: reelboard
----
-
-
-## Constants
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- LED Pin = LED1
- LED1 Pin = LED_YELLOW
- LED2 Pin = LED_RED
- LED3 Pin = LED_GREEN
- LED4 Pin = LED_BLUE
- LED_RED Pin = 11
- LED_GREEN Pin = 12
- LED_BLUE Pin = 41
- LED_YELLOW Pin = 13
- EPD_BUSY_PIN Pin = 14
- EPD_RESET_PIN Pin = 15
- EPD_DC_PIN Pin = 16
- EPD_CS_PIN Pin = 17
- EPD_SCK_PIN Pin = 19
- EPD_SDO_PIN Pin = 20
- POWER_SUPPLY_PIN Pin = 32
-)
-```
-
-Pins on the reel board
-
-
-```go
-const (
- BUTTON Pin = 7
-)
-```
-
-User "a" button on the reel board
-
-
-```go
-const (
- UART_TX_PIN Pin = 6
- UART_RX_PIN Pin = 8
-)
-```
-
-UART pins
-
-
-```go
-const (
- SDA_PIN Pin = 26
- SCL_PIN Pin = 27
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN Pin = 47
- SPI0_SDO_PIN Pin = 45
- SPI0_SDI_PIN Pin = 46
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- P0_00 Pin = 0
- P0_01 Pin = 1
- P0_02 Pin = 2
- P0_03 Pin = 3
- P0_04 Pin = 4
- P0_05 Pin = 5
- P0_06 Pin = 6
- P0_07 Pin = 7
- P0_08 Pin = 8
- P0_09 Pin = 9
- P0_10 Pin = 10
- P0_11 Pin = 11
- P0_12 Pin = 12
- P0_13 Pin = 13
- P0_14 Pin = 14
- P0_15 Pin = 15
- P0_16 Pin = 16
- P0_17 Pin = 17
- P0_18 Pin = 18
- P0_19 Pin = 19
- P0_20 Pin = 20
- P0_21 Pin = 21
- P0_22 Pin = 22
- P0_23 Pin = 23
- P0_24 Pin = 24
- P0_25 Pin = 25
- P0_26 Pin = 26
- P0_27 Pin = 27
- P0_28 Pin = 28
- P0_29 Pin = 29
- P0_30 Pin = 30
- P0_31 Pin = 31
- P1_00 Pin = 32
- P1_01 Pin = 33
- P1_02 Pin = 34
- P1_03 Pin = 35
- P1_04 Pin = 36
- P1_05 Pin = 37
- P1_06 Pin = 38
- P1_07 Pin = 39
- P1_08 Pin = 40
- P1_09 Pin = 41
- P1_10 Pin = 42
- P1_11 Pin = 43
- P1_12 Pin = 44
- P1_13 Pin = 45
- P1_14 Pin = 46
- P1_15 Pin = 47
-)
-```
-
-Hardware pins
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-UART0 is the NRF UART
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- USB = USBCDC{Buffer: NewRingBuffer()}
-
- usbEndpointDescriptors [8]usbDeviceDescriptor
-
- udd_ep_in_cache_buffer [7][128]uint8
- udd_ep_out_cache_buffer [7][128]uint8
-
- sendOnEP0DATADONE struct {
- ptr *byte
- count int
- }
- isEndpointHalt = false
- isRemoteWakeUpEnabled = false
- endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
- (usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
- (usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
-
- usbConfiguration uint8
- usbSetInterface uint8
- usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
- epinen uint32
- epouten uint32
- easyDMABusy volatile.Register8
- epout0data_setlinecoding bool
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func PowerSupplyActive
-
-```go
-func PowerSupplyActive(active bool)
-```
-
-PowerSupplyActive enables the supply voltages for nRF52840 and peripherals (true) or only for nRF52840 (false)
-This controls the TPS610981 boost converter. You must turn the power supply active in order to use the EPD and
-other onboard peripherals.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure() error
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure()
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
- interrupt interrupt.Interrupt
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the nRF52840
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (*USBCDC) Configure
-
-```go
-func (usbcdc *USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/riscv-qemu.md b/content/microcontrollers/machine/riscv-qemu.md
deleted file mode 100644
index a0ed0e77..00000000
--- a/content/microcontrollers/machine/riscv-qemu.md
+++ /dev/null
@@ -1,177 +0,0 @@
-
----
-title: riscv-qemu
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
diff --git a/content/microcontrollers/machine/stm32f4disco-1.md b/content/microcontrollers/machine/stm32f4disco-1.md
deleted file mode 100644
index 7923b7bf..00000000
--- a/content/microcontrollers/machine/stm32f4disco-1.md
+++ /dev/null
@@ -1,649 +0,0 @@
-
----
-title: stm32f4disco-1
----
-
-
-## Constants
-
-```go
-const (
- LED = LED_BUILTIN
- LED1 = LED_GREEN
- LED2 = LED_ORANGE
- LED3 = LED_RED
- LED4 = LED_BLUE
- LED_BUILTIN = LED_GREEN
- LED_GREEN = PD12
- LED_ORANGE = PD13
- LED_RED = PD14
- LED_BLUE = PD15
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN = PA2
- UART_RX_PIN = PA3
-)
-```
-
-UART pins
-
-
-```go
-const (
- SPI1_SCK_PIN = PA5
- SPI1_SDI_PIN = PA6
- SPI1_SDO_PIN = PA7
- SPI0_SCK_PIN = SPI1_SCK_PIN
- SPI0_SDI_PIN = SPI1_SDI_PIN
- SPI0_SDO_PIN = SPI1_SDO_PIN
-)
-```
-
-SPI pins
-
-
-```go
-const (
- MEMS_ACCEL_CS = PE3
- MEMS_ACCEL_INT1 = PE0
- MEMS_ACCEL_INT2 = PE1
-)
-```
-
-MEMs accelerometer
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- // Mode Flag
- PinOutput PinMode = 0
- PinInput PinMode = PinInputFloating
- PinInputFloating PinMode = 1
- PinInputPulldown PinMode = 2
- PinInputPullup PinMode = 3
-
- // for UART
- PinModeUARTTX PinMode = 4
- PinModeUARTRX PinMode = 5
-
- // for I2C
- PinModeI2CSCL PinMode = 6
- PinModeI2CSDA PinMode = 7
-
- // for SPI
- PinModeSPICLK PinMode = 8
- PinModeSPISDO PinMode = 9
- PinModeSPISDI PinMode = 10
-
- // for analog/ADC
- PinInputAnalog PinMode = 11
-)
-```
-
-
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PA8 = portA + 8
- PA9 = portA + 9
- PA10 = portA + 10
- PA11 = portA + 11
- PA12 = portA + 12
- PA13 = portA + 13
- PA14 = portA + 14
- PA15 = portA + 15
-
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PB8 = portB + 8
- PB9 = portB + 9
- PB10 = portB + 10
- PB11 = portB + 11
- PB12 = portB + 12
- PB13 = portB + 13
- PB14 = portB + 14
- PB15 = portB + 15
-
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PC8 = portC + 8
- PC9 = portC + 9
- PC10 = portC + 10
- PC11 = portC + 11
- PC12 = portC + 12
- PC13 = portC + 13
- PC14 = portC + 14
- PC15 = portC + 15
-
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
- PD8 = portD + 8
- PD9 = portD + 9
- PD10 = portD + 10
- PD11 = portD + 11
- PD12 = portD + 12
- PD13 = portD + 13
- PD14 = portD + 14
- PD15 = portD + 15
-
- PE0 = portE + 0
- PE1 = portE + 1
- PE2 = portE + 2
- PE3 = portE + 3
- PE4 = portE + 4
- PE5 = portE + 5
- PE6 = portE + 6
- PE7 = portE + 7
- PE8 = portE + 8
- PE9 = portE + 9
- PE10 = portE + 10
- PE11 = portE + 11
- PE12 = portE + 12
- PE13 = portE + 13
- PE14 = portE + 14
- PE15 = portE + 15
-
- PH0 = portH + 0
- PH1 = portH + 1
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART2,
- AltFuncSelector: stm32.AF7_USART1_2_3,
- }
- UART1 = &UART0
-)
-```
-
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: stm32.SPI1,
- AltFuncSelector: stm32.AF5_SPI1_SPI2,
- }
- SPI1 = &SPI0
-)
-```
-
-Since the first interface is named SPI1, both SPI0 and SPI1 refer to SPI1.
-TODO: implement SPI2 and SPI3.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration
-
-
-### func (Pin) ConfigureAltFunc
-
-```go
-func (p Pin) ConfigureAltFunc(config PinConfig, altFunc stm32.AltFunc)
-```
-
-Configure this pin with the given configuration including alternate
- function mapping if necessary.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetAltFunc
-
-```go
-func (p Pin) SetAltFunc(af stm32.AltFunc)
-```
-
-SetAltFunc maps the given alternative function to the I/O pin
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *stm32.SPI_Type
- AltFuncSelector stm32.AltFunc
-}
-```
-
-SPI on the STM32Fxxx using MODER / alternate function pins
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the STM32 SPI1 interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *stm32.USART_Type
- Interrupt interrupt.Interrupt
- AltFuncSelector stm32.AltFunc
-}
-```
-
-UART representation
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART. Defer to chip-specific
-routines for calculation
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/stm32f4disco.md b/content/microcontrollers/machine/stm32f4disco.md
deleted file mode 100644
index ae4440a7..00000000
--- a/content/microcontrollers/machine/stm32f4disco.md
+++ /dev/null
@@ -1,649 +0,0 @@
-
----
-title: stm32f4disco
----
-
-
-## Constants
-
-```go
-const (
- LED = LED_BUILTIN
- LED1 = LED_GREEN
- LED2 = LED_ORANGE
- LED3 = LED_RED
- LED4 = LED_BLUE
- LED_BUILTIN = LED_GREEN
- LED_GREEN = PD12
- LED_ORANGE = PD13
- LED_RED = PD14
- LED_BLUE = PD15
-)
-```
-
-
-
-```go
-const (
- UART_TX_PIN = PA2
- UART_RX_PIN = PA3
-)
-```
-
-UART pins
-
-
-```go
-const (
- SPI1_SCK_PIN = PA5
- SPI1_SDI_PIN = PA6
- SPI1_SDO_PIN = PA7
- SPI0_SCK_PIN = SPI1_SCK_PIN
- SPI0_SDI_PIN = SPI1_SDI_PIN
- SPI0_SDO_PIN = SPI1_SDO_PIN
-)
-```
-
-SPI pins
-
-
-```go
-const (
- MEMS_ACCEL_CS = PE3
- MEMS_ACCEL_INT1 = PE0
- MEMS_ACCEL_INT2 = PE1
-)
-```
-
-MEMs accelerometer
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- // Mode Flag
- PinOutput PinMode = 0
- PinInput PinMode = PinInputFloating
- PinInputFloating PinMode = 1
- PinInputPulldown PinMode = 2
- PinInputPullup PinMode = 3
-
- // for UART
- PinModeUARTTX PinMode = 4
- PinModeUARTRX PinMode = 5
-
- // for I2C
- PinModeI2CSCL PinMode = 6
- PinModeI2CSDA PinMode = 7
-
- // for SPI
- PinModeSPICLK PinMode = 8
- PinModeSPISDO PinMode = 9
- PinModeSPISDI PinMode = 10
-
- // for analog/ADC
- PinInputAnalog PinMode = 11
-)
-```
-
-
-
-```go
-const (
- PA0 = portA + 0
- PA1 = portA + 1
- PA2 = portA + 2
- PA3 = portA + 3
- PA4 = portA + 4
- PA5 = portA + 5
- PA6 = portA + 6
- PA7 = portA + 7
- PA8 = portA + 8
- PA9 = portA + 9
- PA10 = portA + 10
- PA11 = portA + 11
- PA12 = portA + 12
- PA13 = portA + 13
- PA14 = portA + 14
- PA15 = portA + 15
-
- PB0 = portB + 0
- PB1 = portB + 1
- PB2 = portB + 2
- PB3 = portB + 3
- PB4 = portB + 4
- PB5 = portB + 5
- PB6 = portB + 6
- PB7 = portB + 7
- PB8 = portB + 8
- PB9 = portB + 9
- PB10 = portB + 10
- PB11 = portB + 11
- PB12 = portB + 12
- PB13 = portB + 13
- PB14 = portB + 14
- PB15 = portB + 15
-
- PC0 = portC + 0
- PC1 = portC + 1
- PC2 = portC + 2
- PC3 = portC + 3
- PC4 = portC + 4
- PC5 = portC + 5
- PC6 = portC + 6
- PC7 = portC + 7
- PC8 = portC + 8
- PC9 = portC + 9
- PC10 = portC + 10
- PC11 = portC + 11
- PC12 = portC + 12
- PC13 = portC + 13
- PC14 = portC + 14
- PC15 = portC + 15
-
- PD0 = portD + 0
- PD1 = portD + 1
- PD2 = portD + 2
- PD3 = portD + 3
- PD4 = portD + 4
- PD5 = portD + 5
- PD6 = portD + 6
- PD7 = portD + 7
- PD8 = portD + 8
- PD9 = portD + 9
- PD10 = portD + 10
- PD11 = portD + 11
- PD12 = portD + 12
- PD13 = portD + 13
- PD14 = portD + 14
- PD15 = portD + 15
-
- PE0 = portE + 0
- PE1 = portE + 1
- PE2 = portE + 2
- PE3 = portE + 3
- PE4 = portE + 4
- PE5 = portE + 5
- PE6 = portE + 6
- PE7 = portE + 7
- PE8 = portE + 8
- PE9 = portE + 9
- PE10 = portE + 10
- PE11 = portE + 11
- PE12 = portE + 12
- PE13 = portE + 13
- PE14 = portE + 14
- PE15 = portE + 15
-
- PH0 = portH + 0
- PH1 = portH + 1
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART0 = UART{
- Buffer: NewRingBuffer(),
- Bus: stm32.USART2,
- AltFuncSelector: stm32.AF7_USART1_2_3,
- }
- UART1 = &UART0
-)
-```
-
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: stm32.SPI1,
- AltFuncSelector: stm32.AF5_SPI1_SPI2,
- }
- SPI1 = &SPI0
-)
-```
-
-Since the first interface is named SPI1, both SPI0 and SPI1 refer to SPI1.
-TODO: implement SPI2 and SPI3.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration
-
-
-### func (Pin) ConfigureAltFunc
-
-```go
-func (p Pin) ConfigureAltFunc(config PinConfig, altFunc stm32.AltFunc)
-```
-
-Configure this pin with the given configuration including alternate
- function mapping if necessary.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetAltFunc
-
-```go
-func (p Pin) SetAltFunc(af stm32.AltFunc)
-```
-
-SetAltFunc maps the given alternative function to the I/O pin
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *stm32.SPI_Type
- AltFuncSelector stm32.AltFunc
-}
-```
-
-SPI on the STM32Fxxx using MODER / alternate function pins
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the STM32 SPI1 interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *stm32.USART_Type
- Interrupt interrupt.Interrupt
- AltFuncSelector stm32.AltFunc
-}
-```
-
-UART representation
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART. Defer to chip-specific
-routines for calculation
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/trinket-m0.md b/content/microcontrollers/machine/trinket-m0.md
deleted file mode 100644
index b863f9cd..00000000
--- a/content/microcontrollers/machine/trinket-m0.md
+++ /dev/null
@@ -1,1597 +0,0 @@
-
----
-title: trinket-m0
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA08 // PWM available
- D1 = PA02
- D2 = PA09 // PWM available
- D3 = PA07 // PWM available / UART0 RX
- D4 = PA06 // PWM available / UART0 TX
- D13 = PA10 // LED
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = D1
- A1 = D2
- A2 = D0
- A3 = D3
- A4 = D4
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = D13
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D4
- UART_RX_PIN = D3
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SPI0_SCK_PIN = D3
- SPI0_SDO_PIN = D4
- SPI0_SDI_PIN = D2
-)
-```
-
-SPI pins
-
-
-```go
-const (
- SDA_PIN = D0 // SDA
- SCL_PIN = D2 // SCL
-)
-```
-
-I2C pins
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on Trinket M0.
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM0_USART,
- SERCOM: 0,
- }
-)
-```
-
-UART1 on the Trinket M0.
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM0_SPI,
- SERCOM: 0,
- }
-)
-```
-
-SPI on the Trinket M0.
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the Trinket M0.
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/wasi.md b/content/microcontrollers/machine/wasi.md
deleted file mode 100644
index 4941c680..00000000
--- a/content/microcontrollers/machine/wasi.md
+++ /dev/null
@@ -1,509 +0,0 @@
-
----
-title: wasi
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinOutput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- SPI0 = SPI{0}
- I2C0 = I2C{0}
- UART0 = UART{0}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC enables support for ADC peripherals.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM enables support for PWM peripherals.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (adc ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (adc ADC) Get() uint16
-```
-
-Get reads the current analog value from this ADC peripheral.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus uint8
-}
-```
-
-I2C is a generic implementation of the Inter-IC communication protocol.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- Mode uint8
-}
-```
-
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the UART.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-WriteByte writes a single byte to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/wasm.md b/content/microcontrollers/machine/wasm.md
deleted file mode 100644
index c4bc0593..00000000
--- a/content/microcontrollers/machine/wasm.md
+++ /dev/null
@@ -1,509 +0,0 @@
-
----
-title: wasm
----
-
-
-## Constants
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = iota
- PinOutput
- PinInputPullup
- PinInputPulldown
-)
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- SPI0 = SPI{0}
- I2C0 = I2C{0}
- UART0 = UART{0}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC enables support for ADC peripherals.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM enables support for PWM peripherals.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (adc ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (adc ADC) Get() uint16
-```
-
-Get reads the current analog value from this ADC peripheral.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus uint8
-}
-```
-
-I2C is a generic implementation of the Inter-IC communication protocol.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(value bool)
-```
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- Mode uint8
-}
-```
-
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Bus uint8
-}
-```
-
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the UART.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(b byte) error
-```
-
-WriteByte writes a single byte to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/wioterminal.md b/content/microcontrollers/machine/wioterminal.md
deleted file mode 100644
index 6698c6e9..00000000
--- a/content/microcontrollers/machine/wioterminal.md
+++ /dev/null
@@ -1,1980 +0,0 @@
-
----
-title: wioterminal
----
-
-
-## Constants
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- ADC0 = A0
- ADC1 = A1
- ADC2 = A2
- ADC3 = A3
- ADC4 = A4
- ADC5 = A5
- ADC6 = A6
- ADC7 = A7
- ADC8 = A8
-
- LED = PIN_LED
- BUTTON = BUTTON_1
-)
-```
-
-
-
-```go
-const (
-
- // LEDs
- PIN_LED_13 = PA15
- PIN_LED_RXL = PA15
- PIN_LED_TXL = PA15
- PIN_LED = PIN_LED_13
- PIN_LED2 = PIN_LED_RXL
- PIN_LED3 = PIN_LED_TXL
- LED_BUILTIN = PIN_LED_13
- PIN_NEOPIXEL = PA15
-
- //Digital PINs
- D0 = PB08
- D1 = PB09
- D2 = PA07
- D3 = PB04
- D4 = PB05
- D5 = PB06
- D6 = PA04
- D7 = PB07
- D8 = PA06
-
- //Analog PINs
- A0 = PB08 // ADC/AIN[0]
- A1 = PB09 // ADC/AIN[2]
- A2 = PA07 // ADC/AIN[3]
- A3 = PB04 // ADC/AIN[4]
- A4 = PB05 // ADC/AIN[5]
- A5 = PB06 // ADC/AIN[10]
- A6 = PA04 // ADC/AIN[10]
- A7 = PB07 // ADC/AIN[10]
- A8 = PA06 // ADC/AIN[10]
-
- //PIN DEFINE FOR RPI
- BCM0 = PA13 // I2C Wire1
- BCM1 = PA12 // I2C Wire1
- BCM2 = PA17 // I2C Wire2
- BCM3 = PA16 // I2C Wire2
- BCM4 = PB14 // GCLK
- BCM5 = PB12 // GCLK
- BCM6 = PB13 // GCLK
- BCM7 = PA05 // DAC1
- BCM8 = PB01 // SPI SS
- BCM9 = PB00 // SPI SDI
- BCM10 = PB02 // SPI SDO
- BCM11 = PB03 // SPI SCK
- BCM12 = PB06
- BCM13 = PA07
- BCM14 = PB27 // UART Serial1
- BCM15 = PB26 // UART Serial1
- BCM16 = PB07
- BCM17 = PA02 // DAC0
- BCM18 = PB28 // FPC Digital & AD pins
- BCM19 = PA20 // WIO_IR
- BCM20 = PA21 // I2S SDO
- BCM21 = PA22 // I2S SDI
- BCM22 = PB09
- BCM23 = PA07
- BCM24 = PB04
- BCM25 = PB05
- BCM26 = PA06
- BCM27 = PB08
-
- // FPC NEW DEFINE
- FPC1 = PB28 // FPC Digital & AD pins
- FPC2 = PB17
- FPC3 = PB29
- FPC4 = PA14
- FPC5 = PC01
- FPC6 = PC02
- FPC7 = PC03
- FPC8 = PC04
- FPC9 = PC31
- FPC10 = PD00
-
- // RPI Analog RPIs
- RPI_A0 = PB08
- RPI_A1 = PB09
- RPI_A2 = PA07
- RPI_A3 = PB04
- RPI_A4 = PB05
- RPI_A5 = PB06
- RPI_A6 = PA04
- RPI_A7 = PB07
- RPI_A8 = PA06
-
- PIN_DAC0 = PA02
- PIN_DAC1 = PA05
-
- // USB
- PIN_USB_DM = PA24
- PIN_USB_DP = PA25
- PIN_USB_HOST_ENABLE = PA27
-
- // BUTTON
- BUTTON_1 = PC26
- BUTTON_2 = PC27
- BUTTON_3 = PC28
- WIO_KEY_A = PC26
- WIO_KEY_B = PC27
- WIO_KEY_C = PC28
-
- // SWITCH
- SWITCH_X = PD20
- SWITCH_Y = PD12
- SWITCH_Z = PD09
- SWITCH_B = PD08
- SWITCH_U = PD10
-
- WIO_5S_UP = PD20
- WIO_5S_LEFT = PD12
- WIO_5S_RIGHT = PD09
- WIO_5S_DOWN = PD08
- WIO_5S_PRESS = PD10
-
- // IRQ0 : RTL8720D
- IRQ0 = PC20
-
- // BUZZER_CTR
- BUZZER_CTR = PD11
- WIO_BUZZER = PD11
-
- // MIC_INPUT
- MIC_INPUT = PC30
- WIO_MIC = PC30
-
- // GCLK
- GCLK0 = PB14
- GCLK1 = PB12
- GCLK2 = PB13
-
- // Serial interfaces
- // Serial1
- PIN_SERIAL1_RX = PB27
- PIN_SERIAL1_TX = PB26
-
- // Serial2 : RTL8720D
- PIN_SERIAL2_RX = PC23
- PIN_SERIAL2_TX = PC22
-
- // Wire Interfaces
- // I2C Wire2
- // I2C1
- PIN_WIRE_SDA = PA17
- PIN_WIRE_SCL = PA16
- SDA = PIN_WIRE_SDA
- SCL = PIN_WIRE_SCL
-
- // I2C Wire1
- // I2C0 : LIS3DHTR and ATECC608
- PIN_WIRE1_SDA = PA13
- PIN_WIRE1_SCL = PA12
-
- SDA1 = PIN_WIRE1_SDA
- SCL1 = PIN_WIRE1_SCL
-
- PIN_GYROSCOPE_WIRE_SDA = PIN_WIRE1_SDA
- PIN_GYROSCOPE_WIRE_SCL = PIN_WIRE1_SCL
- GYROSCOPE_INT1 = PC21
-
- WIO_LIS3DH_SDA = PIN_WIRE1_SDA
- WIO_LIS3DH_SCL = PIN_WIRE1_SCL
- WIO_LIS3DH_INT = PC21
-
- // SPI
- PIN_SPI_SDI = PB00
- PIN_SPI_SDO = PB02
- PIN_SPI_SCK = PB03
- PIN_SPI_SS = PB01
-
- SS = PIN_SPI_SS
- SDO = PIN_SPI_SDO
- SDI = PIN_SPI_SDI
- SCK = PIN_SPI_SCK
-
- // SPI1 RTL8720D_SPI
- PIN_SPI1_SDI = PC24
- PIN_SPI1_SDO = PB24
- PIN_SPI1_SCK = PB25
- PIN_SPI1_SS = PC25
-
- SS1 = PIN_SPI1_SS
- SDO1 = PIN_SPI1_SDO
- SDI1 = PIN_SPI1_SDI
- SCK1 = PIN_SPI1_SCK
-
- // SPI2 SD_SPI
- PIN_SPI2_SDI = PC18
- PIN_SPI2_SDO = PC16
- PIN_SPI2_SCK = PC17
- PIN_SPI2_SS = PC19
-
- SS2 = PIN_SPI2_SS
- SDO2 = PIN_SPI2_SDO
- SDI2 = PIN_SPI2_SDI
- SCK2 = PIN_SPI2_SCK
-
- // SPI3 LCD_SPI
- PIN_SPI3_SDI = PB18
- PIN_SPI3_SDO = PB19
- PIN_SPI3_SCK = PB20
- PIN_SPI3_SS = PB21
-
- SS3 = PIN_SPI3_SS
- SDO3 = PIN_SPI3_SDO
- SDI3 = PIN_SPI3_SDI
- SCK3 = PIN_SPI3_SCK
-
- // Needed for SD library
- SDCARD_SDI_PIN = PIN_SPI2_SDI
- SDCARD_SDO_PIN = PIN_SPI2_SDO
- SDCARD_SCK_PIN = PIN_SPI2_SCK
- SDCARD_SS_PIN = PIN_SPI2_SS
- SDCARD_DET_PIN = PD21
-
- LCD_SDI_PIN = PIN_SPI3_SDI
- LCD_SDO_PIN = PIN_SPI3_SDO
- LCD_SCK_PIN = PIN_SPI3_SCK
- LCD_SS_PIN = PIN_SPI3_SS
- LCD_DC = PC06
- LCD_RESET = PC07
- LCD_BACKLIGHT = PC05
-
- // 4 WIRE LCD TOUCH
- LCD_XL = PC10
- LCD_YU = PC11
- LCD_XR = PC12
- LCD_YD = PC13
-
- // Needed for RTL8720D
- RTL8720D_SDI_PIN = PIN_SPI1_SDI
- RTL8720D_SDO_PIN = PIN_SPI1_SDO
- RTL8720D_SCK_PIN = PIN_SPI1_SCK
- RTL8720D_SS_PIN = PIN_SPI1_SS
-
- //QSPI Pins
- PIN_QSPI_IO0 = PA08
- PIN_QSPI_IO1 = PA09
- PIN_QSPI_IO2 = PA10
- PIN_QSPI_IO3 = PA11
- PIN_QSPI_SCK = PB10
- PIN_QSPI_CS = PB11
-
- // I2S Interfaces
- PIN_I2S_FS = PA20
- PIN_I2S_SCK = PB16
- PIN_I2S_SDO = PA22
- PIN_I2S_SDI = PA21
-
- I2S_LRCLK = PA20
- I2S_BLCK = PB16
- I2S_SDOUT = PA22
- I2S_SDIN = PA21
-
- // RTL8720D Interfaces
- RTL8720D_CHIP_PU = PA18
- RTL8720D_GPIO0 = PA19 // SYNC
-
- // SWD
- SWDCLK = PA30
- SWDIO = PA31
- SWO = PB30
-
- // light sensor
- WIO_LIGHT = PD01
-
- // ir sensor
- WIO_IR = PB31
-
- // OUTPUT_CTR
- OUTPUT_CTR_5V = PC14
- OUTPUT_CTR_3V3 = PC15
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PIN_USB_DM
- USBCDC_DP_PIN = PIN_USB_DP
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = PIN_SERIAL1_TX
- UART_RX_PIN = PIN_SERIAL1_RX
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- UART2_TX_PIN = PIN_SERIAL2_TX
- UART2_RX_PIN = PIN_SERIAL2_RX
-)
-```
-
-UART2 pins RTL8720D
-
-
-```go
-const (
- SDA0_PIN = PIN_WIRE_SDA // SDA: SERCOM3/PAD[0]
- SCL0_PIN = PIN_WIRE_SCL // SCL: SERCOM3/PAD[1]
-
- SDA1_PIN = PIN_WIRE1_SDA // SDA: SERCOM4/PAD[0]
- SCL1_PIN = PIN_WIRE1_SCL // SCL: SERCOM4/PAD[1]
-
- SDA_PIN = SDA0_PIN
- SCL_PIN = SCL0_PIN
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = SCK // SCK: SERCOM5/PAD[1]
- SPI0_SDO_PIN = SDO // SDO: SERCOM5/PAD[0]
- SPI0_SDI_PIN = SDI // SDI: SERCOM5/PAD[2]
-
- // RTL8720D
- SPI1_SCK_PIN = SCK1 // SCK: SERCOM0/PAD[1]
- SPI1_SDO_PIN = SDO1 // SDO: SERCOM0/PAD[0]
- SPI1_SDI_PIN = SDI1 // SDI: SERCOM0/PAD[2]
-
- // SD
- SPI2_SCK_PIN = SCK2 // SCK: SERCOM6/PAD[1]
- SPI2_SDO_PIN = SDO2 // SDO: SERCOM6/PAD[0]
- SPI2_SDI_PIN = SDI2 // SDI: SERCOM6/PAD[2]
-
- // LCD
- SPI3_SCK_PIN = SCK3 // SCK: SERCOM7/PAD[1]
- SPI3_SDO_PIN = SDO3 // SDO: SERCOM7/PAD[3]
- SPI3_SDI_PIN = SDI3 // SDI: SERCOM7/PAD[2]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinTCCPDEC PinMode = 6
- PinCom PinMode = 7
- PinSDHC PinMode = 8
- PinI2S PinMode = 9
- PinPCC PinMode = 10
- PinGMAC PinMode = 11
- PinACCLK PinMode = 12
- PinCCL PinMode = 13
- PinDigital PinMode = 14
- PinInput PinMode = 15
- PinInputPullup PinMode = 16
- PinOutput PinMode = 17
- PinPWME PinMode = PinTimer
- PinPWMF PinMode = PinTimerAlt
- PinPWMG PinMode = PinTCCPDEC
- PinInputPulldown PinMode = 18
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
- PC00 Pin = 64
- PC01 Pin = 65
- PC02 Pin = 66
- PC03 Pin = 67
- PC04 Pin = 68
- PC05 Pin = 69
- PC06 Pin = 70
- PC07 Pin = 71
- PC08 Pin = 72
- PC09 Pin = 73
- PC10 Pin = 74
- PC11 Pin = 75
- PC12 Pin = 76
- PC13 Pin = 77
- PC14 Pin = 78
- PC15 Pin = 79
- PC16 Pin = 80
- PC17 Pin = 81
- PC18 Pin = 82
- PC19 Pin = 83
- PC20 Pin = 84
- PC21 Pin = 85
- PC22 Pin = 86
- PC23 Pin = 87
- PC24 Pin = 88
- PC25 Pin = 89
- PC26 Pin = 90
- PC27 Pin = 91
- PC28 Pin = 92
- PC29 Pin = 93
- PC30 Pin = 94
- PC31 Pin = 95
- PD00 Pin = 96
- PD01 Pin = 97
- PD02 Pin = 98
- PD03 Pin = 99
- PD04 Pin = 100
- PD05 Pin = 101
- PD06 Pin = 102
- PD07 Pin = 103
- PD08 Pin = 104
- PD09 Pin = 105
- PD10 Pin = 106
- PD11 Pin = 107
- PD12 Pin = 108
- PD13 Pin = 109
- PD14 Pin = 110
- PD15 Pin = 111
- PD16 Pin = 112
- PD17 Pin = 113
- PD18 Pin = 114
- PD19 Pin = 115
- PD20 Pin = 116
- PD21 Pin = 117
- PD22 Pin = 118
- PD23 Pin = 119
- PD24 Pin = 120
- PD25 Pin = 121
- PD26 Pin = 122
- PD27 Pin = 123
- PD28 Pin = 124
- PD29 Pin = 125
- PD30 Pin = 126
- PD31 Pin = 127
-)
-```
-
-Hardware pins
-
-
-```go
-const (
- // SERCOM_FREQ_REF is always reference frequency on SAMD51 regardless of CPU speed.
- SERCOM_FREQ_REF = 48000000
-
- // Default rise time in nanoseconds, based on 4.7K ohm pull up resistors
- riseTimeNanoseconds = 125
-
- // wire bus states
- wireUnknownState = 0
- wireIdleState = 1
- wireOwnerState = 2
- wireBusyState = 3
-
- // wire commands
- wireCmdNoAction = 0
- wireCmdRepeatStart = 1
- wireCmdRead = 2
- wireCmdStop = 3
-)
-```
-
-
-
-```go
-const (
- QSPI_SCK = PB10
- QSPI_CS = PB11
- QSPI_DATA0 = PA08
- QSPI_DATA1 = PA09
- QSPI_DATA2 = PA10
- QSPI_DATA3 = PA11
-)
-```
-
-The QSPI peripheral on ATSAMD51 is only available on the following pins
-
-
-```go
-const HSRAM_SIZE = 0x00030000
-```
-
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM2_USART_INT,
- SERCOM: 2,
- }
-
- // RTL8720D
- UART2 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM1_USART_INT,
- SERCOM: 1,
- }
-)
-```
-
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM4_I2CM,
- SERCOM: 4,
- }
-
- I2C1 = I2C{
- Bus: sam.SERCOM4_I2CM,
- SERCOM: 4,
- }
-)
-```
-
-I2C on the Wio Terminal
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM5_SPIM,
- SERCOM: 5,
- }
-
- // RTL8720D
- SPI1 = SPI{
- Bus: sam.SERCOM0_SPIM,
- SERCOM: 0,
- }
-
- // SD
- SPI2 = SPI{
- Bus: sam.SERCOM6_SPIM,
- SERCOM: 6,
- }
-
- // LCD
- SPI3 = SPI{
- Bus: sam.SERCOM7_SPIM,
- SERCOM: 7,
- }
-)
-```
-
-SPI on the Wio Terminal
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preparation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD51.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD51 only has a 12-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD51.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-### func (Pin) Toggle
-
-```go
-func (p Pin) Toggle()
-```
-
-Toggle switches an output pin from low to high or from high to low.
-Warning: only use this on an output pin!
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPIM_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_INT_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt // RXC interrupt
-}
-```
-
-UART on the SAMD51.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/machine/x9pro.md b/content/microcontrollers/machine/x9pro.md
deleted file mode 100644
index f90d1ddf..00000000
--- a/content/microcontrollers/machine/x9pro.md
+++ /dev/null
@@ -1,696 +0,0 @@
-
----
-title: x9pro
----
-
-
-## Constants
-
-```go
-const (
- LED Pin = 4 // HR LED pin
- UART_TX_PIN Pin = NoPin
- UART_RX_PIN Pin = NoPin
- SCL_PIN Pin = NoPin
- SDA_PIN Pin = NoPin
- SPI0_SCK_PIN Pin = 18
- SPI0_SDI_PIN Pin = 19
- SPI0_SDO_PIN Pin = 20
-)
-```
-
-https://hackaday.io/project/144350-hacking-wearables-for-mental-health-and-more/details
-
-
-```go
-const (
- OLED_CS Pin = 15 // chip select
- OLED_RES Pin = 14 // reset pin
- OLED_DC Pin = 13 // data/command
- OLED_SCK Pin = 12 // SPI clock
- OLED_SDO Pin = 11 // SPI SDO (chip-out, peripheral-in)
- OLED_LED_POW Pin = 16
- OLED_IC_POW Pin = 17
-)
-```
-
-LCD pins.
-
-
-```go
-const HasLowFrequencyCrystal = true
-```
-
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinInput PinMode = (nrf.GPIO_PIN_CNF_DIR_Input << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Connect << nrf.GPIO_PIN_CNF_INPUT_Pos)
- PinInputPullup PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pullup << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinInputPulldown PinMode = PinInput | (nrf.GPIO_PIN_CNF_PULL_Pulldown << nrf.GPIO_PIN_CNF_PULL_Pos)
- PinOutput PinMode = (nrf.GPIO_PIN_CNF_DIR_Output << nrf.GPIO_PIN_CNF_DIR_Pos) | (nrf.GPIO_PIN_CNF_INPUT_Disconnect << nrf.GPIO_PIN_CNF_INPUT_Pos)
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = nrf.GPIOTE_CONFIG_POLARITY_LoToHi
- PinFalling PinChange = nrf.GPIOTE_CONFIG_POLARITY_HiToLo
- PinToggle PinChange = nrf.GPIOTE_CONFIG_POLARITY_Toggle
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-
-
-
-## Variables
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-```go
-var (
- // NRF_UART0 is the hardware UART on the NRF SoC.
- NRF_UART0 = UART{Buffer: NewRingBuffer()}
-)
-```
-
-UART
-
-
-```go
-var (
- I2C0 = I2C{Bus: nrf.TWI0}
- I2C1 = I2C{Bus: nrf.TWI1}
-)
-```
-
-There are 2 I2C interfaces on the NRF.
-
-
-```go
-var (
- SPI0 = SPI{Bus: nrf.SPI0}
- SPI1 = SPI{Bus: nrf.SPI1}
-)
-```
-
-There are 2 SPI interfaces on the NRF5x.
-
-
-```go
-var (
- UART0 = NRF_UART0
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the registers needed for ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the registers needed for PWM.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures an ADC pin to be able to read analog data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin in the range 0..0xffff.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *nrf.TWI_Type
-}
-```
-
-I2C on the NRF.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig)
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) (err error)
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *nrf.SPI_Type
-}
-```
-
-SPI on the NRF.
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig)
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
-}
-```
-
-UART on the NRF.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig)
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
diff --git a/content/microcontrollers/machine/xiao.md b/content/microcontrollers/machine/xiao.md
deleted file mode 100644
index b46d0ef7..00000000
--- a/content/microcontrollers/machine/xiao.md
+++ /dev/null
@@ -1,1621 +0,0 @@
-
----
-title: xiao
----
-
-
-## Constants
-
-```go
-const (
- PA00 Pin = 0
- PA01 Pin = 1
- PA02 Pin = 2
- PA03 Pin = 3
- PA04 Pin = 4
- PA05 Pin = 5
- PA06 Pin = 6
- PA07 Pin = 7
- PA08 Pin = 8
- PA09 Pin = 9
- PA10 Pin = 10
- PA11 Pin = 11
- PA12 Pin = 12
- PA13 Pin = 13
- PA14 Pin = 14
- PA15 Pin = 15
- PA16 Pin = 16
- PA17 Pin = 17
- PA18 Pin = 18
- PA19 Pin = 19
- PA20 Pin = 20
- PA21 Pin = 21
- PA22 Pin = 22
- PA23 Pin = 23
- PA24 Pin = 24
- PA25 Pin = 25
- PA26 Pin = 26
- PA27 Pin = 27
- PA28 Pin = 28
- PA29 Pin = 29
- PA30 Pin = 30
- PA31 Pin = 31
- PB00 Pin = 32
- PB01 Pin = 33
- PB02 Pin = 34
- PB03 Pin = 35
- PB04 Pin = 36
- PB05 Pin = 37
- PB06 Pin = 38
- PB07 Pin = 39
- PB08 Pin = 40
- PB09 Pin = 41
- PB10 Pin = 42
- PB11 Pin = 43
- PB12 Pin = 44
- PB13 Pin = 45
- PB14 Pin = 46
- PB15 Pin = 47
- PB16 Pin = 48
- PB17 Pin = 49
- PB18 Pin = 50
- PB19 Pin = 51
- PB20 Pin = 52
- PB21 Pin = 53
- PB22 Pin = 54
- PB23 Pin = 55
- PB24 Pin = 56
- PB25 Pin = 57
- PB26 Pin = 58
- PB27 Pin = 59
- PB28 Pin = 60
- PB29 Pin = 61
- PB30 Pin = 62
- PB31 Pin = 63
-)
-```
-
-Hardware pins
-
-
-```go
-const RESET_MAGIC_VALUE = 0xf01669ef
-```
-
-used to reset into bootloader
-
-
-```go
-const (
- D0 = PA02 // can be used for PWM or DAC
- D1 = PA04 // PWM available
- D2 = PA10 // PWM available
- D3 = PA11 // PWM available
- D4 = PA08 // can be used for PWM or I2C SDA
- D5 = PA09 // can be used for PWM or I2C SCL
- D6 = PB08 // can be used for PWM or UART1 TX
- D7 = PB09 // can be used for PWM or UART1 RX
- D8 = PA07 // can be used for PWM or SPI SCK
- D9 = PA05 // can be used for PWM or SPI SDI
- D10 = PA06 // can be used for PWM or SPI SDO
-)
-```
-
-GPIO Pins
-
-
-```go
-const (
- A0 = PA02 // ADC/AIN[0]
- A1 = PA04 // ADC/AIN[4]
- A2 = PA10 // ADC/AIN[18]
- A3 = PA11 // ADC/AIN[19]
- A4 = PA08 // ADC/AIN[16]
- A5 = PA09 // ADC/AIN[17]
- A6 = PB08 // ADC/AIN[2]
- A7 = PB09 // ADC/AIN[3]
- A8 = PA07 // ADC/AIN[7]
- A9 = PA05 // ADC/AIN[6]
- A10 = PA06 // ADC/AIN[5]
-)
-```
-
-Analog pins
-
-
-```go
-const (
- LED = PA17
- LED_RXL = PA18
- LED_TXL = PA19
- LED2 = LED_RXL
- LED3 = LED_TXL
-)
-```
-
-
-
-```go
-const (
- USBCDC_DM_PIN = PA24
- USBCDC_DP_PIN = PA25
-)
-```
-
-UART0 aka USBCDC pins
-
-
-```go
-const (
- UART_TX_PIN = D6
- UART_RX_PIN = D7
-)
-```
-
-UART1 pins
-
-
-```go
-const (
- SDA_PIN = PA08 // SDA: SERCOM2/PAD[0]
- SCL_PIN = PA09 // SCL: SERCOM2/PAD[1]
-)
-```
-
-I2C pins
-
-
-```go
-const (
- SPI0_SCK_PIN = PA07 // SCK: SERCOM0/PAD[3]
- SPI0_SDO_PIN = PA06 // SDO: SERCOM0/PAD[2]
- SPI0_SDI_PIN = PA05 // SDI: SERCOM0/PAD[1]
-)
-```
-
-SPI pins
-
-
-```go
-const (
- I2S_SCK_PIN = PA10
- I2S_SD_PIN = PA08
- I2S_WS_PIN = NoPin // TODO: figure out what this is on Xiao
-)
-```
-
-I2S pins
-
-
-```go
-const (
- TWI_FREQ_100KHZ = 100000
- TWI_FREQ_400KHZ = 400000
-)
-```
-
-TWI_FREQ is the I2C bus speed. Normally either 100 kHz, or 400 kHz for high-speed bus.
-
-
-```go
-const (
- I2SModeSource I2SMode = iota
- I2SModeReceiver
- I2SModePDM
-)
-```
-
-
-
-```go
-const (
- I2StandardPhilips I2SStandard = iota
- I2SStandardMSB
- I2SStandardLSB
-)
-```
-
-
-
-```go
-const (
- I2SClockSourceInternal I2SClockSource = iota
- I2SClockSourceExternal
-)
-```
-
-
-
-```go
-const (
- I2SDataFormatDefault I2SDataFormat = 0
- I2SDataFormat8bit = 8
- I2SDataFormat16bit = 16
- I2SDataFormat24bit = 24
- I2SDataFormat32bit = 32
-)
-```
-
-
-
-```go
-const NoPin = Pin(0xff)
-```
-
-NoPin explicitly indicates "not a pin". Use this pin if you want to leave one
-of the pins in a peripheral unconfigured (if supported by the hardware).
-
-
-```go
-const (
- PinAnalog PinMode = 1
- PinSERCOM PinMode = 2
- PinSERCOMAlt PinMode = 3
- PinTimer PinMode = 4
- PinTimerAlt PinMode = 5
- PinCom PinMode = 6
- //PinAC_CLK PinMode = 7
- PinDigital PinMode = 8
- PinInput PinMode = 9
- PinInputPullup PinMode = 10
- PinOutput PinMode = 11
- PinPWM PinMode = PinTimer
- PinPWMAlt PinMode = PinTimerAlt
- PinInputPulldown PinMode = 12
-)
-```
-
-
-
-```go
-const (
- PinRising PinChange = sam.EIC_CONFIG_SENSE0_RISE
- PinFalling PinChange = sam.EIC_CONFIG_SENSE0_FALL
- PinToggle PinChange = sam.EIC_CONFIG_SENSE0_BOTH
-)
-```
-
-Pin change interrupt constants for SetInterrupt.
-
-
-```go
-const (
- Mode0 = 0
- Mode1 = 1
- Mode2 = 2
- Mode3 = 3
-)
-```
-
-SPI phase and polarity configs CPOL and CPHA
-
-
-
-
-
-## Variables
-
-```go
-var (
- UART1 = UART{
- Buffer: NewRingBuffer(),
- Bus: sam.SERCOM4_USART,
- SERCOM: 4,
- }
-)
-```
-
-UART1 on the Xiao
-
-
-```go
-var (
- I2C0 = I2C{
- Bus: sam.SERCOM2_I2CM,
- SERCOM: 2,
- }
-)
-```
-
-I2C on the Xiao
-
-
-```go
-var (
- SPI0 = SPI{
- Bus: sam.SERCOM0_SPI,
- SERCOM: 0,
- }
-)
-```
-
-SPI on the Xiao
-
-
-```go
-var (
- I2S0 = I2S{Bus: sam.I2S}
-)
-```
-
-I2S on the Xiao
-
-
-```go
-var (
- ErrInvalidInputPin = errors.New("machine: invalid input pin")
- ErrInvalidOutputPin = errors.New("machine: invalid output pin")
- ErrInvalidClockPin = errors.New("machine: invalid clock pin")
- ErrInvalidDataPin = errors.New("machine: invalid data pin")
- ErrNoPinChangeChannel = errors.New("machine: no channel available for pin interrupt")
-)
-```
-
-
-
-```go
-var (
- // UART0 is actually a USB CDC interface.
- UART0 = USBCDC{Buffer: NewRingBuffer()}
-)
-```
-
-
-
-```go
-var (
- DAC0 = DAC{}
-)
-```
-
-
-
-```go
-var (
- ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
-)
-```
-
-
-
-
-
-
-### func CPUFrequency
-
-```go
-func CPUFrequency() uint32
-```
-
-Return the current CPU frequency in hertz.
-
-
-### func InitADC
-
-```go
-func InitADC()
-```
-
-InitADC initializes the ADC.
-
-
-### func InitPWM
-
-```go
-func InitPWM()
-```
-
-InitPWM initializes the PWM interface.
-
-
-### func NewACMFunctionalDescriptor
-
-```go
-func NewACMFunctionalDescriptor(subtype, d0 uint8) ACMFunctionalDescriptor
-```
-
-NewACMFunctionalDescriptor returns a new USB ACMFunctionalDescriptor.
-
-
-### func NewCDCCSInterfaceDescriptor
-
-```go
-func NewCDCCSInterfaceDescriptor(subtype, d0, d1 uint8) CDCCSInterfaceDescriptor
-```
-
-NewCDCCSInterfaceDescriptor returns a new USB CDCCSInterfaceDescriptor.
-
-
-### func NewCDCDescriptor
-
-```go
-func NewCDCDescriptor(i IADDescriptor, c InterfaceDescriptor,
- h CDCCSInterfaceDescriptor,
- cm ACMFunctionalDescriptor,
- fd CDCCSInterfaceDescriptor,
- callm CMFunctionalDescriptor,
- ci EndpointDescriptor,
- di InterfaceDescriptor,
- outp EndpointDescriptor,
- inp EndpointDescriptor) CDCDescriptor
-```
-
-
-
-### func NewCMFunctionalDescriptor
-
-```go
-func NewCMFunctionalDescriptor(subtype, d0, d1 uint8) CMFunctionalDescriptor
-```
-
-NewCMFunctionalDescriptor returns a new USB CMFunctionalDescriptor.
-
-
-### func NewConfigDescriptor
-
-```go
-func NewConfigDescriptor(totalLength uint16, interfaces uint8) ConfigDescriptor
-```
-
-NewConfigDescriptor returns a new USB ConfigDescriptor.
-
-
-### func NewDeviceDescriptor
-
-```go
-func NewDeviceDescriptor(class, subClass, proto, packetSize0 uint8, vid, pid, version uint16, im, ip, is, configs uint8) DeviceDescriptor
-```
-
-NewDeviceDescriptor returns a USB DeviceDescriptor.
-
-
-### func NewEndpointDescriptor
-
-```go
-func NewEndpointDescriptor(addr, attr uint8, packetSize uint16, interval uint8) EndpointDescriptor
-```
-
-NewEndpointDescriptor returns a new USB EndpointDescriptor.
-
-
-### func NewIADDescriptor
-
-```go
-func NewIADDescriptor(firstInterface, count, class, subClass, protocol uint8) IADDescriptor
-```
-
-NewIADDescriptor returns a new USB IADDescriptor.
-
-
-### func NewInterfaceDescriptor
-
-```go
-func NewInterfaceDescriptor(n, numEndpoints, class, subClass, protocol uint8) InterfaceDescriptor
-```
-
-NewInterfaceDescriptor returns a new USB InterfaceDescriptor.
-
-
-### func NewRingBuffer
-
-```go
-func NewRingBuffer() *RingBuffer
-```
-
-NewRingBuffer returns a new ring buffer.
-
-
-### func ResetProcessor
-
-```go
-func ResetProcessor()
-```
-
-ResetProcessor should perform a system reset in preperation
-to switch to the bootloader to flash new firmware.
-
-
-
-
-## type ACMFunctionalDescriptor
-
-```go
-type ACMFunctionalDescriptor struct {
- len uint8
- dtype uint8 // 0x24
- subtype uint8 // 1
- bmCapabilities uint8
-}
-```
-
-ACMFunctionalDescriptor is a Abstract Control Model (ACM) USB descriptor.
-
-
-
-### func (ACMFunctionalDescriptor) Bytes
-
-```go
-func (d ACMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the ACMFunctionalDescriptor data.
-
-
-
-
-## type ADC
-
-```go
-type ADC struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (ADC) Configure
-
-```go
-func (a ADC) Configure()
-```
-
-Configure configures a ADCPin to be able to be used to read data.
-
-
-### func (ADC) Get
-
-```go
-func (a ADC) Get() uint16
-```
-
-Get returns the current value of a ADC pin, in the range 0..0xffff.
-
-
-
-
-## type CDCCSInterfaceDescriptor
-
-```go
-type CDCCSInterfaceDescriptor struct {
- len uint8 // 5
- dtype uint8 // 0x24
- subtype uint8
- d0 uint8
- d1 uint8
-}
-```
-
-CDCCSInterfaceDescriptor is a CDC CS interface descriptor.
-
-
-
-### func (CDCCSInterfaceDescriptor) Bytes
-
-```go
-func (d CDCCSInterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCCSInterfaceDescriptor data.
-
-
-
-
-## type CDCDescriptor
-
-```go
-type CDCDescriptor struct {
- // IAD
- iad IADDescriptor // Only needed on compound device
-
- // Control
- cif InterfaceDescriptor
- header CDCCSInterfaceDescriptor
-
- // CDC control
- controlManagement ACMFunctionalDescriptor // ACM
- functionalDescriptor CDCCSInterfaceDescriptor // CDC_UNION
- callManagement CMFunctionalDescriptor // Call Management
- cifin EndpointDescriptor
-
- // CDC Data
- dif InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-CDCDescriptor is the Communication Device Class (CDC) descriptor.
-
-
-
-### func (CDCDescriptor) Bytes
-
-```go
-func (d CDCDescriptor) Bytes() []byte
-```
-
-Bytes returns CDCDescriptor data.
-
-
-
-
-## type CMFunctionalDescriptor
-
-```go
-type CMFunctionalDescriptor struct {
- bFunctionLength uint8
- bDescriptorType uint8 // 0x24
- bDescriptorSubtype uint8 // 1
- bmCapabilities uint8
- bDataInterface uint8
-}
-```
-
-CMFunctionalDescriptor is the functional descriptor general format.
-
-
-
-### func (CMFunctionalDescriptor) Bytes
-
-```go
-func (d CMFunctionalDescriptor) Bytes() []byte
-```
-
-Bytes returns the CMFunctionalDescriptor data.
-
-
-
-
-## type ConfigDescriptor
-
-```go
-type ConfigDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 2
- wTotalLength uint16 // total length
- bNumInterfaces uint8
- bConfigurationValue uint8
- iConfiguration uint8
- bmAttributes uint8
- bMaxPower uint8
-}
-```
-
-ConfigDescriptor implements the standard USB configuration descriptor.
-
-Table 9-10. Standard Configuration Descriptor
-bLength, bDescriptorType, wTotalLength, bNumInterfaces, bConfigurationValue, iConfiguration
-bmAttributes, bMaxPower
-
-
-
-### func (ConfigDescriptor) Bytes
-
-```go
-func (d ConfigDescriptor) Bytes() []byte
-```
-
-Bytes returns ConfigDescriptor data.
-
-
-
-
-## type DAC
-
-```go
-type DAC struct {
-}
-```
-
-DAC on the SAMD21.
-
-
-
-### func (DAC) Configure
-
-```go
-func (dac DAC) Configure(config DACConfig)
-```
-
-Configure the DAC.
-output pin must already be configured.
-
-
-### func (DAC) Set
-
-```go
-func (dac DAC) Set(value uint16) error
-```
-
-Set writes a single 16-bit value to the DAC.
-Since the ATSAMD21 only has a 10-bit DAC, the passed-in value will be scaled down.
-
-
-
-
-## type DACConfig
-
-```go
-type DACConfig struct {
-}
-```
-
-DACConfig placeholder for future expansion.
-
-
-
-
-
-## type DeviceDescriptor
-
-```go
-type DeviceDescriptor struct {
- bLength uint8 // 18
- bDescriptorType uint8 // 1 USB_DEVICE_DESCRIPTOR_TYPE
- bcdUSB uint16 // 0x200
- bDeviceClass uint8
- bDeviceSubClass uint8
- bDeviceProtocol uint8
- bMaxPacketSize0 uint8 // Packet 0
- idVendor uint16
- idProduct uint16
- bcdDevice uint16 // 0x100
- iManufacturer uint8
- iProduct uint8
- iSerialNumber uint8
- bNumConfigurations uint8
-}
-```
-
-DeviceDescriptor implements the USB standard device descriptor.
-
-Table 9-8. Standard Device Descriptor
-bLength, bDescriptorType, bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, bMaxPacketSize0,
- idVendor, idProduct, bcdDevice, iManufacturer, iProduct, iSerialNumber, bNumConfigurations */
-
-
-
-### func (DeviceDescriptor) Bytes
-
-```go
-func (d DeviceDescriptor) Bytes() []byte
-```
-
-Bytes returns DeviceDescriptor data
-
-
-
-
-## type EndpointDescriptor
-
-```go
-type EndpointDescriptor struct {
- bLength uint8 // 7
- bDescriptorType uint8 // 5
- bEndpointAddress uint8
- bmAttributes uint8
- wMaxPacketSize uint16
- bInterval uint8
-}
-```
-
-EndpointDescriptor implements the standard USB endpoint descriptor.
-
-Table 9-13. Standard Endpoint Descriptor
-bLength, bDescriptorType, bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval
-
-
-
-### func (EndpointDescriptor) Bytes
-
-```go
-func (d EndpointDescriptor) Bytes() []byte
-```
-
-Bytes returns EndpointDescriptor data.
-
-
-
-
-## type I2C
-
-```go
-type I2C struct {
- Bus *sam.SERCOM_I2CM_Type
- SERCOM uint8
-}
-```
-
-I2C on the SAMD21.
-
-
-
-### func (I2C) Configure
-
-```go
-func (i2c I2C) Configure(config I2CConfig) error
-```
-
-Configure is intended to setup the I2C interface.
-
-
-### func (I2C) ReadRegister
-
-```go
-func (i2c I2C) ReadRegister(address uint8, register uint8, data []byte) error
-```
-
-ReadRegister transmits the register, restarts the connection as a read
-operation, and reads the response.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily read such registers. Also, it only works for devices
-with 7-bit addresses, which is the vast majority.
-
-
-### func (I2C) SetBaudRate
-
-```go
-func (i2c I2C) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the I2C.
-
-
-### func (I2C) Tx
-
-```go
-func (i2c I2C) Tx(addr uint16, w, r []byte) error
-```
-
-Tx does a single I2C transaction at the specified address.
-It clocks out the given address, writes the bytes in w, reads back len(r)
-bytes and stores them in r, and generates a stop condition on the bus.
-
-
-### func (I2C) WriteByte
-
-```go
-func (i2c I2C) WriteByte(data byte) error
-```
-
-WriteByte writes a single byte to the I2C bus.
-
-
-### func (I2C) WriteRegister
-
-```go
-func (i2c I2C) WriteRegister(address uint8, register uint8, data []byte) error
-```
-
-WriteRegister transmits first the register and then the data to the
-peripheral device.
-
-Many I2C-compatible devices are organized in terms of registers. This method
-is a shortcut to easily write to such registers. Also, it only works for
-devices with 7-bit addresses, which is the vast majority.
-
-
-
-
-## type I2CConfig
-
-```go
-type I2CConfig struct {
- Frequency uint32
- SCL Pin
- SDA Pin
-}
-```
-
-I2CConfig is used to store config info for I2C.
-
-
-
-
-
-## type I2S
-
-```go
-type I2S struct {
- Bus *sam.I2S_Type
-}
-```
-
-I2S
-
-
-
-### func (I2S) Close
-
-```go
-func (i2s I2S) Close() error
-```
-
-Close the I2S bus.
-
-
-### func (I2S) Configure
-
-```go
-func (i2s I2S) Configure(config I2SConfig)
-```
-
-Configure is used to configure the I2S interface. You must call this
-before you can use the I2S bus.
-
-
-### func (I2S) Read
-
-```go
-func (i2s I2S) Read(p []uint32) (n int, err error)
-```
-
-Read data from the I2S bus into the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-### func (I2S) Write
-
-```go
-func (i2s I2S) Write(p []uint32) (n int, err error)
-```
-
-Write data to the I2S bus from the provided slice.
-The I2S bus must already have been configured correctly.
-
-
-
-
-## type I2SClockSource
-
-```go
-type I2SClockSource uint8
-```
-
-
-
-
-
-
-## type I2SConfig
-
-```go
-type I2SConfig struct {
- SCK Pin
- WS Pin
- SD Pin
- Mode I2SMode
- Standard I2SStandard
- ClockSource I2SClockSource
- DataFormat I2SDataFormat
- AudioFrequency uint32
- MainClockOutput bool
- Stereo bool
-}
-```
-
-All fields are optional and may not be required or used on a particular platform.
-
-
-
-
-
-## type I2SDataFormat
-
-```go
-type I2SDataFormat uint8
-```
-
-
-
-
-
-
-## type I2SMode
-
-```go
-type I2SMode uint8
-```
-
-
-
-
-
-
-## type I2SStandard
-
-```go
-type I2SStandard uint8
-```
-
-
-
-
-
-
-## type IADDescriptor
-
-```go
-type IADDescriptor struct {
- bLength uint8 // 8
- bDescriptorType uint8 // 11
- bFirstInterface uint8
- bInterfaceCount uint8
- bFunctionClass uint8
- bFunctionSubClass uint8
- bFunctionProtocol uint8
- iFunction uint8
-}
-```
-
-IADDescriptor is an Interface Association Descriptor, which is used
-to bind 2 interfaces together in CDC composite device.
-
-Standard Interface Association Descriptor:
-bLength, bDescriptorType, bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass,
-bFunctionProtocol, iFunction
-
-
-
-### func (IADDescriptor) Bytes
-
-```go
-func (d IADDescriptor) Bytes() []byte
-```
-
-Bytes returns IADDescriptor data.
-
-
-
-
-## type InterfaceDescriptor
-
-```go
-type InterfaceDescriptor struct {
- bLength uint8 // 9
- bDescriptorType uint8 // 4
- bInterfaceNumber uint8
- bAlternateSetting uint8
- bNumEndpoints uint8
- bInterfaceClass uint8
- bInterfaceSubClass uint8
- bInterfaceProtocol uint8
- iInterface uint8
-}
-```
-
-InterfaceDescriptor implements the standard USB interface descriptor.
-
-Table 9-12. Standard Interface Descriptor
-bLength, bDescriptorType, bInterfaceNumber, bAlternateSetting, bNumEndpoints, bInterfaceClass,
-bInterfaceSubClass, bInterfaceProtocol, iInterface
-
-
-
-### func (InterfaceDescriptor) Bytes
-
-```go
-func (d InterfaceDescriptor) Bytes() []byte
-```
-
-Bytes returns InterfaceDescriptor data.
-
-
-
-
-## type MSCDescriptor
-
-```go
-type MSCDescriptor struct {
- msc InterfaceDescriptor
- in EndpointDescriptor
- out EndpointDescriptor
-}
-```
-
-MSCDescriptor is not used yet.
-
-
-
-
-
-## type PWM
-
-```go
-type PWM struct {
- Pin Pin
-}
-```
-
-
-
-
-### func (PWM) Configure
-
-```go
-func (pwm PWM) Configure() error
-```
-
-Configure configures a PWM pin for output.
-
-
-### func (PWM) Set
-
-```go
-func (pwm PWM) Set(value uint16)
-```
-
-Set turns on the duty cycle for a PWM pin using the provided value.
-
-
-
-
-## type Pin
-
-```go
-type Pin uint8
-```
-
-Pin is a single pin on a chip, which may be connected to other hardware
-devices. It can either be used directly as GPIO pin or it can be used in
-other peripherals like ADC, I2C, etc.
-
-
-
-### func (Pin) Configure
-
-```go
-func (p Pin) Configure(config PinConfig)
-```
-
-Configure this pin with the given configuration.
-
-
-### func (Pin) Get
-
-```go
-func (p Pin) Get() bool
-```
-
-Get returns the current value of a GPIO pin.
-
-
-### func (Pin) High
-
-```go
-func (p Pin) High()
-```
-
-High sets this GPIO pin to high, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to high that is not configured as an output pin.
-
-
-### func (Pin) Low
-
-```go
-func (p Pin) Low()
-```
-
-Low sets this GPIO pin to low, assuming it has been configured as an output
-pin. It is hardware dependent (and often undefined) what happens if you set a
-pin to low that is not configured as an output pin.
-
-
-### func (Pin) PortMaskClear
-
-```go
-func (p Pin) PortMaskClear() (*uint32, uint32)
-```
-
-Return the register and mask to disable a given port. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) PortMaskSet
-
-```go
-func (p Pin) PortMaskSet() (*uint32, uint32)
-```
-
-Return the register and mask to enable a given GPIO pin. This can be used to
-implement bit-banged drivers.
-
-
-### func (Pin) Set
-
-```go
-func (p Pin) Set(high bool)
-```
-
-Set the pin to high or low.
-Warning: only use this on an output pin!
-
-
-### func (Pin) SetInterrupt
-
-```go
-func (p Pin) SetInterrupt(change PinChange, callback func(Pin)) error
-```
-
-SetInterrupt sets an interrupt to be executed when a particular pin changes
-state. The pin should already be configured as an input, including a pull up
-or down if no external pull is provided.
-
-This call will replace a previously set callback on this pin. You can pass a
-nil func to unset the pin change interrupt. If you do so, the change
-parameter is ignored and can be set to any value (such as 0).
-
-
-
-
-## type PinChange
-
-```go
-type PinChange uint8
-```
-
-
-
-
-
-
-## type PinConfig
-
-```go
-type PinConfig struct {
- Mode PinMode
-}
-```
-
-
-
-
-
-
-## type PinMode
-
-```go
-type PinMode uint8
-```
-
-
-
-
-
-
-## type RingBuffer
-
-```go
-type RingBuffer struct {
- rxbuffer [bufferSize]volatile.Register8
- head volatile.Register8
- tail volatile.Register8
-}
-```
-
-RingBuffer is ring buffer implementation inspired by post at
-https://www.embeddedrelated.com/showthread/comp.arch.embedded/77084-1.php
-
-
-
-### func (*RingBuffer) Clear
-
-```go
-func (rb *RingBuffer) Clear()
-```
-
-Clear resets the head and tail pointer to zero.
-
-
-### func (*RingBuffer) Get
-
-```go
-func (rb *RingBuffer) Get() (byte, bool)
-```
-
-Get returns a byte from the buffer. If the buffer is empty,
-the method will return a false as the second value.
-
-
-### func (*RingBuffer) Put
-
-```go
-func (rb *RingBuffer) Put(val byte) bool
-```
-
-Put stores a byte in the buffer. If the buffer is already
-full, the method will return false.
-
-
-### func (*RingBuffer) Used
-
-```go
-func (rb *RingBuffer) Used() uint8
-```
-
-Used returns how many bytes in buffer have been used.
-
-
-
-
-## type SPI
-
-```go
-type SPI struct {
- Bus *sam.SERCOM_SPI_Type
- SERCOM uint8
-}
-```
-
-SPI
-
-
-
-### func (SPI) Configure
-
-```go
-func (spi SPI) Configure(config SPIConfig) error
-```
-
-Configure is intended to setup the SPI interface.
-
-
-### func (SPI) Transfer
-
-```go
-func (spi SPI) Transfer(w byte) (byte, error)
-```
-
-Transfer writes/reads a single byte using the SPI interface.
-
-
-### func (SPI) Tx
-
-```go
-func (spi SPI) Tx(w, r []byte) error
-```
-
-Tx handles read/write operation for SPI interface. Since SPI is a syncronous write/read
-interface, there must always be the same number of bytes written as bytes read.
-The Tx method knows about this, and offers a few different ways of calling it.
-
-This form sends the bytes in tx buffer, putting the resulting bytes read into the rx buffer.
-Note that the tx and rx buffers must be the same size:
-
- spi.Tx(tx, rx)
-
-This form sends the tx buffer, ignoring the result. Useful for sending "commands" that return zeros
-until all the bytes in the command packet have been received:
-
- spi.Tx(tx, nil)
-
-This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
-
- spi.Tx(nil, rx)
-
-
-
-
-## type SPIConfig
-
-```go
-type SPIConfig struct {
- Frequency uint32
- SCK Pin
- SDO Pin
- SDI Pin
- LSBFirst bool
- Mode uint8
-}
-```
-
-SPIConfig is used to store config info for SPI.
-
-
-
-
-
-## type UART
-
-```go
-type UART struct {
- Buffer *RingBuffer
- Bus *sam.SERCOM_USART_Type
- SERCOM uint8
- Interrupt interrupt.Interrupt
-}
-```
-
-UART on the SAMD21.
-
-
-
-### func (UART) Buffered
-
-```go
-func (uart UART) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (UART) Configure
-
-```go
-func (uart UART) Configure(config UARTConfig) error
-```
-
-Configure the UART.
-
-
-### func (UART) Read
-
-```go
-func (uart UART) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (UART) ReadByte
-
-```go
-func (uart UART) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (UART) Receive
-
-```go
-func (uart UART) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (UART) SetBaudRate
-
-```go
-func (uart UART) SetBaudRate(br uint32)
-```
-
-SetBaudRate sets the communication speed for the UART.
-
-
-### func (UART) Write
-
-```go
-func (uart UART) Write(data []byte) (n int, err error)
-```
-
-Write data to the UART.
-
-
-### func (UART) WriteByte
-
-```go
-func (uart UART) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the UART.
-
-
-
-
-## type UARTConfig
-
-```go
-type UARTConfig struct {
- BaudRate uint32
- TX Pin
- RX Pin
-}
-```
-
-
-
-
-
-
-## type USBCDC
-
-```go
-type USBCDC struct {
- Buffer *RingBuffer
-}
-```
-
-USBCDC is the USB CDC aka serial over USB interface on the SAMD21.
-
-
-
-### func (USBCDC) Buffered
-
-```go
-func (usbcdc USBCDC) Buffered() int
-```
-
-Buffered returns the number of bytes currently stored in the RX buffer.
-
-
-### func (USBCDC) Configure
-
-```go
-func (usbcdc USBCDC) Configure(config UARTConfig)
-```
-
-Configure the USB CDC interface. The config is here for compatibility with the UART interface.
-
-
-### func (USBCDC) DTR
-
-```go
-func (usbcdc USBCDC) DTR() bool
-```
-
-
-
-### func (USBCDC) RTS
-
-```go
-func (usbcdc USBCDC) RTS() bool
-```
-
-
-
-### func (USBCDC) Read
-
-```go
-func (usbcdc USBCDC) Read(data []byte) (n int, err error)
-```
-
-Read from the RX buffer.
-
-
-### func (USBCDC) ReadByte
-
-```go
-func (usbcdc USBCDC) ReadByte() (byte, error)
-```
-
-ReadByte reads a single byte from the RX buffer.
-If there is no data in the buffer, returns an error.
-
-
-### func (USBCDC) Receive
-
-```go
-func (usbcdc USBCDC) Receive(data byte)
-```
-
-Receive handles adding data to the UART's data buffer.
-Usually called by the IRQ handler for a machine.
-
-
-### func (USBCDC) Write
-
-```go
-func (usbcdc USBCDC) Write(data []byte) (n int, err error)
-```
-
-Write data to the USBCDC.
-
-
-### func (USBCDC) WriteByte
-
-```go
-func (usbcdc USBCDC) WriteByte(c byte) error
-```
-
-WriteByte writes a byte of data to the USB CDC interface.
-
-
-
-
diff --git a/content/microcontrollers/maixbit.md b/content/microcontrollers/maixbit.md
deleted file mode 100644
index 34aa946d..00000000
--- a/content/microcontrollers/maixbit.md
+++ /dev/null
@@ -1,41 +0,0 @@
----
-title: "Sipeed MAix Bit"
-weight: 3
----
-
-The [Sipeed MAix Bit](https://www.seeedstudio.com/Sipeed-MAix-BiT-for-RISC-V-AI-IoT-p-2872.html) is a low-cost development board featuring the [Kendryte K210](https://canaan.io/product/kendryteai) [RISC-V](https://riscv.org/) (RV64GC) chip.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | NO | NO |
-| PWM | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Sipeed MAix Bit](../machine/maixbit)
-
-## Flashing
-
-### Kflash.py
-
-Programs are loaded onto the MAix Bit using the `kflash.py` command line utility program. You must install this program before you will be able to flash the MAix Bit board with your TinyGo code.
-
-The latest version of the `kflash.py` can be installed using `pip3 install kflash`.
-
-- Plug your MAix Bit into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=maixbit [PATH TO YOUR PROGRAM]`
-
-## Troubleshooting
-
-You may get the following error when flashing the MAix Bit:
-
-```shell
-error: unable to locate a serial port
-```
-To resolve this, just specify the MAix Bit's serial port when flashing using `tinygo flash -target=maixbit -port=[MAIXBIT PORT] [PATH TO YOUR PROGRAM]`.
diff --git a/content/microcontrollers/metro-m4-airlift.md b/content/microcontrollers/metro-m4-airlift.md
deleted file mode 100644
index e4de66fc..00000000
--- a/content/microcontrollers/metro-m4-airlift.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Adafruit Metro M4 Express AirLift"
-weight: 3
----
-
-The [Adafruit Metro M4 Express AirLift](https://www.adafruit.com/product/4000) is an ARM development board based on the Atmel [ATSAMD51J19](https://www.microchip.com/wwwproducts/en/ATSAMD51J19) family of SoC that has Arduino shield compatible form factor, and a built-in EspressIf ESP32 Wi-Fi Co processor.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit Metro M4 Airlift](../machine/metro-m4-airlift)
-
-## Flashing
-
-### UF2
-
-The Metro M4 Express comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Metro M4 Express into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=metro-m4-airlift [PATH TO YOUR PROGRAM]
- ```
-
-- The Metro M4 Express board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Metro M4 Express board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Metro M4 Express board ready to receive code.
-- The Metro M4 Express board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
- ```shell
- tinygo flash -target=metro-m4-airlift [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Metro M4 Express board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Metro M4 Express as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/nrf52840-mdk.md b/content/microcontrollers/nrf52840-mdk.md
deleted file mode 100644
index d01dd16b..00000000
--- a/content/microcontrollers/nrf52840-mdk.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-title: "nRF52840-MDK"
-weight: 3
----
-
-The [nRF52840-MDK](https://wiki.makerdiary.com/nrf52840-mdk/) is an open-source, micro development kit for IoT applications based on the Nordic Semiconductor [nRF52840](https://www.nordicsemi.com/eng/Products/nRF52840) SoC chip.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the nRF52840-MDK](../machine/nrf52840-mdk)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the nRF52840-MDK board using the `openocd` command line utility program. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the nRF52840-MDK board with your TinyGo code.
-
-- Plug your nRF52840-MDK into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=nrf52840-mdk`
-
-## Notes
-
-Bluetooth support is now available for nRF52840 boards. See https://github.com/tinygo-org/bluetooth for more information.
diff --git a/content/microcontrollers/particle-argon.md b/content/microcontrollers/particle-argon.md
deleted file mode 100644
index 00144cfb..00000000
--- a/content/microcontrollers/particle-argon.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "Particle Argon"
-weight: 3
----
-
-[The Particle Argon](https://docs.particle.io/datasheets/wi-fi/argon-datasheet/) is a powerful Wi-Fi enabled development board. It is based on the Nordic [nRF52840](https://www.nordicsemi.com/eng/Products/nRF52840) and ESP32 2.4 GHz Wi-Fi coprocessor.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Particle Argon](../machine/particle-argon)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the Particle Argon board using the `openocd` command line utility program. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the Particle Argon board with your TinyGo code.
-
-- Plug your [Particle Debugger](https://store.particle.io/collections/accessories/products/particle-debugger) to Argon's debugging connector
-- Build and flash your TinyGo program using `tinygo flash -target=particle-argon`
-
-## Notes
-
-You can use the USB port to the Particle Argon as a serial port. `UART0` refers to this connection.
-
-Bluetooth support is in development but not yet completed.
diff --git a/content/microcontrollers/particle-boron.md b/content/microcontrollers/particle-boron.md
deleted file mode 100644
index a5c31470..00000000
--- a/content/microcontrollers/particle-boron.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "Particle Boron"
-weight: 3
----
-
-[The Particle Boron](https://docs.particle.io/datasheets/cellular/boron-datasheet/) The Boron is a powerful LTE CAT-M1/2G/3G enabled development kit that supports cellular networks and Bluetooth LE (BLE). It is based on the Nordic [nRF52840](https://www.nordicsemi.com/eng/Products/nRF52840) and u-blox SARA coprocessor.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Particle Boron](../machine/particle-boron)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the Particle Boron board using the `openocd` command line utility program. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the Particle Boron board with your TinyGo code.
-
-- Plug your [Particle Debugger](https://store.particle.io/collections/accessories/products/particle-debugger) to Boron's debugging connector
-- Build and flash your TinyGo program using `tinygo flash -target=particle-boron`
-
-## Notes
-
-You can use the USB port to the Particle Boron as a serial port. `UART0` refers to this connection.
-
-Bluetooth support is in development but not yet completed.
diff --git a/content/microcontrollers/particle-xenon.md b/content/microcontrollers/particle-xenon.md
deleted file mode 100644
index d00a6199..00000000
--- a/content/microcontrollers/particle-xenon.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "Particle Xenon"
-weight: 3
----
-
-[The Particle Xenon](https://docs.particle.io/datasheets/discontinued/xenon-datasheet/) is a low cost mesh-enabled development board.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Particle Xenon](../machine/particle-xenon)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the Particle Xenon board using the `openocd` command line utility program. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the Particle Xenon board with your TinyGo code.
-
-- Plug your [Particle Debugger](https://store.particle.io/collections/accessories/products/particle-debugger) to Xenon's debugging connector
-- Build and flash your TinyGo program using `tinygo flash -target=particle-xenon`
-
-## Notes
-
-You can use the USB port to the Particle Xenon as a serial port. `UART0` refers to this connection.
-
-Bluetooth support is in development but not yet completed.
diff --git a/content/microcontrollers/pca10031.md b/content/microcontrollers/pca10031.md
deleted file mode 100644
index 16ed796d..00000000
--- a/content/microcontrollers/pca10031.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "PCA10031"
-weight: 3
----
-
-The [Nordic Semiconductor PCA10031](https://www.nordicsemi.com/eng/Products/nRF51-Dongle) is a low-cost, versatile USB development dongle for wireless applications based on the Nordic Semiconductor [nRF51422](https://www.nordicsemi.com/eng/Products/ANT/nRF51422) chip using the nRF51 series SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | Not yet |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the PCA10031](../machine/pca10031)
-
-## Flashing
-
-### nrfjprog/J-Link
-
-Programs are loaded onto the pca10031 board using the `nrfjprog` command line utility program.
-
-First install the J-Link Software and Documentation Pack from Segger: [https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
-
-Then install the nRF5x Command-Line Tools: [https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation](https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation)
-
-Once you have installed both of these correctly, you will be able to flash the pca10031 board with your TinyGo code.
-
-- Plug your pca10031 into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=pca10031`
diff --git a/content/microcontrollers/pca10040.md b/content/microcontrollers/pca10040.md
deleted file mode 100644
index 1ea7141a..00000000
--- a/content/microcontrollers/pca10040.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "PCA10040"
-weight: 3
----
-
-The [Nordic Semiconductor PCA10040](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK) is a single-board development kit for wireless applications based on the Nordic Semiconductor [nRF52832](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52832) SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the PCA10040](../machine/pca10040)
-
-## Flashing
-
-### nrfjprog/J-Link
-
-Programs are loaded onto the pca10040 board using the `nrfjprog` command line utility program.
-
-First install the J-Link Software and Documentation Pack from Segger: [https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
-
-Then install the nRF5x Command-Line Tools: [https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation](https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation)
-
-Once you have installed both of these correctly, you will be able to flash the pca10040 board with your TinyGo code.
-
-- Plug your pca10040 into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=pca10040`
diff --git a/content/microcontrollers/pca10056.md b/content/microcontrollers/pca10056.md
deleted file mode 100644
index 195cb00f..00000000
--- a/content/microcontrollers/pca10056.md
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: "PCA10056"
-weight: 3
----
-
-The [Nordic Semiconductor PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) is a single-board development kit for wireless applications based on the Nordic Semiconductor [nRF52840](https://www.nordicsemi.com/eng/Products/nRF52840) SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-| Bluetooth | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the PCA10056](../machine/pca10056)
-
-## Flashing
-
-### nrfjprog/J-Link
-
-Programs are loaded onto the pca10056 board using the `nrfjprog` command line utility program.
-
-First install the J-Link Software and Documentation Pack from Segger: [https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack](https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack)
-
-Then install the nRF5x Command-Line Tools: [https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation](https://docs.zephyrproject.org/latest/guides/tools/nordic_segger.html#nrf5x-command-line-tools-installation)
-
-Once you have installed both of these correctly, you will be able to flash the pca10056 board with your TinyGo code.
-
-- Plug your pca10056 into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=pca10056`
diff --git a/content/microcontrollers/pybadge.md b/content/microcontrollers/pybadge.md
deleted file mode 100644
index 19a6d774..00000000
--- a/content/microcontrollers/pybadge.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-title: "Adafruit PyBadge"
-weight: 3
----
-
-The [Adafruit PyBadge](https://www.adafruit.com/product/4200) is a ARM development board based on the Atmel [ATSAMD51J19A](https://www.microchip.com/wwwproducts/en/ATSAMD51J19A) family of SoC.
-
-It has many built-in devices, such as a 1.8" 160x128 Color TFT Display, 8 x buttons, 5 x NeoPixels, a triple-axis accelerometer, a light sensor, and a speaker. The PyBadge uses the ST7735 display, so you may use the tinygo-org st7735 driver. The accelerometer is the LIS3DH so you may use the tinygo lis3dh driver
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit PyBadge](../machine/pybadge)
-
-## Flashing
-
-### UF2
-
-The PyBadge comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your PyBadge into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=pybadge [PATH TO YOUR PROGRAM]
- ```
-
-- The PyBadge board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your PyBadge board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the PyBadge board ready to receive code.
-- The PyBadge board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=pybadge [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your PyBadge board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the PyBadge as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/pygamer.md b/content/microcontrollers/pygamer.md
deleted file mode 100644
index 8352d485..00000000
--- a/content/microcontrollers/pygamer.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-title: "Adafruit PyGamer"
-weight: 3
----
-
-The [Adafruit PyGamer](https://www.adafruit.com/product/4242) is a ARM development board based on the Atmel [ATSAMD51J19A](https://www.microchip.com/wwwproducts/en/ATSAMD51J19A) family of SoC.
-
-It has many built-in devices, such as a 1.8" 160x128 Color TFT Display, a dual-potentiometer analog stick, 4 x square-top buttons, 5 x NeoPixel LED, a triple-axis accelerometer, a light sensor, and a speaker. The PyGamer uses the ST7735 display, so you may use the tinygo-org st7735 driver. The accelerometer is the LIS3DH so you may use the tinygo lis3dh driver.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit PyGamer](../machine/pygamer)
-
-## Flashing
-
-### UF2
-
-The PyGamer comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your PyGamer into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=pygamer [PATH TO YOUR PROGRAM]
- ```
-
-- The PyGamer board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your PyGamer board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the PyGamer board ready to receive code.
-- The PyGamer board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=pygamer [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your PyGamer board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the PyGamer as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/pyportal.md b/content/microcontrollers/pyportal.md
deleted file mode 100644
index c2838d95..00000000
--- a/content/microcontrollers/pyportal.md
+++ /dev/null
@@ -1,59 +0,0 @@
----
-title: "Adafruit PyPortal"
-weight: 3
----
-
-The [Adafruit PyPortal](https://www.adafruit.com/product/4116) is a ARM board based on the Microchip [ATSAMD51J20A](https://www.microchip.com/wwwproducts/en/ATSAMD51J20A) family of SoC.
-
-The PyPortal also has an Espressif ESP32 Wi-Fi coprocessor with TLS/SSL support built-in. PyPortal has a 3.2″ 320 x 240 color TFT with resistive touch screen. PyPortal includes: speaker, light sensor, temperature sensor, NeoPixel, microSD card slot, 8MB flash, plug-in ports for I2C and 2 analog/digital pins,
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit PyPortal](../machine/pyportal)
-
-## Flashing
-
-### UF2
-
-The PyPortal comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your PyPortal into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=pyportal [PATH TO YOUR PROGRAM]
- ```
-
-- The PyPortal board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your PyPortal board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the PyPortal board ready to receive code.
-- The PyPortal board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=pyportal [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your PyPortal board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the PyPortal as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/qtpy.md b/content/microcontrollers/qtpy.md
deleted file mode 100644
index 5a83aeba..00000000
--- a/content/microcontrollers/qtpy.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Adafruit QtPy"
-weight: 3
----
-
-The [Adafruit QtPy](https://www.adafruit.com/product/4600) is a tiny ARM development board based on the Atmel [ATSAMD21E18](https://www.microchip.com/wwwproducts/en/ATSAMD21E18) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Adafruit QtPy](../machine/qtpy)
-
-## Flashing
-
-### UF2
-
-The QtPy comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your QtPy into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=qtpy [PATH TO YOUR PROGRAM]
- ```
-
-- The QtPy board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your QtPy board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the QtPy board ready to receive code.
-- The QtPy board will appear to your computer like a USB drive.
-- Now try running the `tinygo flash` command as above:
-
- ```shell
- tinygo flash -target=qtpy [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your QtPy board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the QtPy as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/stm32f4discovery.md b/content/microcontrollers/stm32f4discovery.md
deleted file mode 100644
index d6f4223b..00000000
--- a/content/microcontrollers/stm32f4discovery.md
+++ /dev/null
@@ -1,33 +0,0 @@
----
-title: "STM32F4 Discovery"
-weight: 3
----
-
-The [STM32F4 Discovery](https://www.st.com/en/evaluation-tools/stm32f4discovery.html) is an ARM development board based on the ST Micro [STM32F407](https://www.st.com/resource/en/datasheet/stm32f407vg.pdf) SoC.
-
-It has an onboard LIS302DL or LIS3DSH accelerometer, MP45DT02 MEMS digital microphone, an
-CS43L22 audio DAC, 2 user buttons, and 4 user LEDs.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | Not yet |
-| ADC | YES | Not yet |
-| PWM | YES | Not yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the STM32F4 Discovery](../machine/stm32f4disco)
-
-## Flashing
-
-### OpenOCD
-
-Programs are loaded onto the STM32F4 Discovery with the onboard [STLink v2](https://www.st.com/en/development-tools/st-link-v2.html) hardware programmer, using the `openocd` command line utility program to perform the board flashing. You must install [OpenOCD](http://openocd.org/) before you will be able to flash the STM32F4 Discovery board with your TinyGo code.
-
-- Plug your STM32F4 Discovery into your computer's USB port.
-- Build and flash your TinyGo program using `tinygo flash -target=stm32f4disco`
diff --git a/content/microcontrollers/teensy36.md b/content/microcontrollers/teensy36.md
deleted file mode 100644
index 77853882..00000000
--- a/content/microcontrollers/teensy36.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Teensy 3.6"
-weight: 3
----
-
-The [PJRC Teensy 3.6](https://www.pjrc.com/store/teensy36.html) is a small ARM development board based on the NXP [MK66FX1M0VMD18](https://www.nxp.com/docs/en/data-sheet/K66P144M180SF5V2.pdf) 32-bit 180 MHz ARM Cortex-M4.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | Not yet |
-| ADC | YES | Not yet |
-| PWM | YES | Not Yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Teensy 3.6](../machine/teensy36)
-
-## Flashing
-
-### teensy_loader_cli
-
-In order to flash your TinyGo programs onto the Teensy 3.6 board, you will need to install the `teensy_loader_cli` (https://github.com/PaulStoffregen/teensy_loader_cli) on your machine.
-
-### CLI Flashing
-
-- Plug your Teensy 3.6 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=teensy36 [PATH TO YOUR PROGRAM]
- ```
-
-- The Teensy 3.6 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Teensy 3.6 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Teensy 3.6 board ready to receive code.
-- The Teensy 3.6 board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
- ```shell
- tinygo flash -target=teensy36 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Teensy 3.6 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You cannot yet use the USB port to the Teensy 3.6 as a USB CDC serial port.
diff --git a/content/microcontrollers/teensy40.md b/content/microcontrollers/teensy40.md
deleted file mode 100644
index 434cd42b..00000000
--- a/content/microcontrollers/teensy40.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: "Teensy 4.0"
-weight: 3
----
-
-The [PJRC Teensy 4.0](https://www.pjrc.com/store/teensy40.html) is a small ARM development board based on the NXP [iMXRT1062](https://www.nxp.com/docs/en/nxp/data-sheets/IMXRT1060CEC.pdf) 32-bit 600 MHz ARM Cortex-M7.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | Not yet |
-| I2C | YES | Not yet |
-| ADC | YES | Not yet |
-| PWM | YES | Not Yet |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Teensy 4.0](../machine/teensy40)
-
-## Flashing
-
-### teensy_loader_cli
-
-In order to flash your TinyGo programs onto the Teensy 4.0 board, you will need to install the `teensy_loader_cli` (https://github.com/PaulStoffregen/teensy_loader_cli) on your machine.
-
-### CLI Flashing
-
-- Plug your Teensy 4.0 into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=teensy36 [PATH TO YOUR PROGRAM]
- ```
-
-- The Teensy 4.0 board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Teensy 4.0 board to receive code, try this:
-
-- Press the "RESET" button on the board two times to get the Teensy 4.0 board ready to receive code.
-- The Teensy 4.0 board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
- ```shell
- tinygo flash -target=teensy40 [PATH TO YOUR PROGRAM]
- ```
-
-Once you have updated your Teensy 4.0 board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You cannot yet use the USB port to the Teensy 4.0 as a USB CDC serial port.
diff --git a/content/microcontrollers/wioterminal.md b/content/microcontrollers/wioterminal.md
deleted file mode 100644
index 02099b82..00000000
--- a/content/microcontrollers/wioterminal.md
+++ /dev/null
@@ -1,57 +0,0 @@
----
-title: "Seeed Wio Terminal"
-weight: 3
----
-
-The [Seeed Wio Terminal](https://www.seeedstudio.com/Wio-Terminal-p-4509.html) is a tiny ARM development board based on the Atmel [ATSAMD51P20](https://www.microchip.com/wwwproducts/en/ATSAMD51P20A) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Seeed Wio Terminal](../machine/wioterminal)
-
-## Flashing
-
-### UF2
-
-The Wio Terminal comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your Wio Terminal into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=wioterminal [PATH TO YOUR PROGRAM]
- ```
-
-- The Wio Terminal board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your Wio Terminal board to receive code, try this:
-
-- [Slide the "RESET" switch on the board two times](https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/#faq) to get the Wio Terminal board ready to receive code.
-- The Wio Terminal board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=wioterminal [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your Wio Terminal board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the Wio Terminal as a serial port. `UART0` refers to this connection.
diff --git a/content/microcontrollers/x9-pro.md b/content/microcontrollers/x9-pro.md
deleted file mode 100644
index 9ede1c22..00000000
--- a/content/microcontrollers/x9-pro.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-title: "X9 Pro Smartwatch"
-weight: 3
----
-
-Info here
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | ? | ? |
-| UART | ? | ? |
-| SPI | ? | ? |
-| I2C | ? | ? |
-| ADC | ? | ? |
-| PWM | ? | ? |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the X9 Pro](../machine/x9pro)
-
-## Flashing
-
-How to do it...
diff --git a/content/microcontrollers/xiao.md b/content/microcontrollers/xiao.md
deleted file mode 100644
index beadfb04..00000000
--- a/content/microcontrollers/xiao.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: "Seeed Seeeduino XIAO"
-weight: 3
----
-
-The [Seeed Seeeduino XIAO](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html) is a tiny ARM development board based on the Atmel [ATSAMD21G18](https://www.microchip.com/wwwproducts/en/ATSAMD21G18) family of SoC.
-
-## Interfaces
-
-| Interface | Hardware Supported | TinyGo Support |
-| --------- | ------------- | ----- |
-| GPIO | YES | YES |
-| UART | YES | YES |
-| SPI | YES | YES |
-| I2C | YES | YES |
-| ADC | YES | YES |
-| PWM | YES | YES |
-
-## Machine Package Docs
-
-[Documentation for the machine package for the Seeed Seeeduino XIAO](../machine/xiao)
-
-## Flashing
-
-### UF2
-
-The XIAO comes with the [UF2 bootloader](https://github.com/Microsoft/uf2) already installed.
-
-### CLI Flashing
-
-- Plug your XIAO into your computer's USB port.
-- Flash your TinyGo program to the board using this command:
-
- ```shell
- tinygo flash -target=xiao [PATH TO YOUR PROGRAM]
- ```
-
-- The XIAO board should restart and then begin running your program.
-
-### Troubleshooting
-
-If you have troubles getting your XIAO board to receive code, try this:
-
-- [Short the "RST pins" two times](https://wiki.seeedstudio.com/Seeeduino-XIAO/#reset) to get the XIAO board ready to receive code.
-- The XIAO board will appear to your computer like a USB drive.
-- Now try running the command as above:
-
-
-```shell
-tinygo flash -target=xiao [PATH TO YOUR PROGRAM]
-```
-
-Once you have updated your XIAO board the first time, after that you should be able to flash it entirely from the command line.
-
-## Notes
-
-You can use the USB port to the XIAO as a serial port. `UART0` refers to this connection.
-
diff --git a/content/play/_index.md b/content/play/_index.md
new file mode 100644
index 00000000..c055ab16
--- /dev/null
+++ b/content/play/_index.md
@@ -0,0 +1,156 @@
+---
+title: Playground
+description: "TinyGo playground. Run Go code directly in the browser and simulate some popular development boards."
+---
+
+
+
+
+
+
+
+
+
+
{{< readfile "/simulator/simulator.md" >}}
+
+
+
+
+
+
+
+ The TinyGo Playground is a service provided by the TinyGo project
+ to compile and run small code samples directly in the browser. It
+ has been heavily inspired by the Go Playground but differs in
+ some significant ways:
+
+
+
+ We use the TinyGo compiler in addition to the main Go compiler.
+
+
+ Instead of running code on the server, code is compiled to WebAssembly and runs
+ directly in the browser.
+
+
+ It can simulate a few popular boards directly in the browser.
+ However, please note that this is a simulation which can differ
+ in behavior from how the program will run on an actual device.
+
+
+ Boards that support drag-and-drop programming can be flashed
+ directly using the Flash button.
+
+
+
+ Like the Go Playground, it's possible to share code
+ snippets. These code snippets are stored on Google's
+ servers in the US and can be viewed by some TinyGo
+ members. While we'll try to make sure the shared data
+ can only be accessed by those who have the URL, we
+ cannot guarantee security. If you accidentally shared
+ something that should not be shared (for example, a
+ password or personally identifying information), you can
+ contact us at
+ privacy@tinygo.org
+ with the URL so we can remove it.
+
+
+ Source code of the playground: github.com/tinygo-org/playground .
+
+
+
+
+
+
+
+
diff --git a/content/search.md b/content/search.md
new file mode 100644
index 00000000..394feea5
--- /dev/null
+++ b/content/search.md
@@ -0,0 +1,4 @@
+---
+title: Search Results
+layout: search
+---
diff --git a/content/simulator/simulator.md b/content/simulator/simulator.md
new file mode 100644
index 00000000..d75e3bf8
--- /dev/null
+++ b/content/simulator/simulator.md
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Note: these numbers are estimates, based on datasheets and measurements. They don't include everything and may be wrong.
+
+
+
+
+
+
+ Add
+
+
diff --git a/content/tour/_index.md b/content/tour/_index.md
new file mode 100644
index 00000000..3469d3da
--- /dev/null
+++ b/content/tour/_index.md
@@ -0,0 +1,16 @@
+---
+title: "Tour of TinyGo"
+type: "docs"
+
+cascade:
+ github_repo: https://github.com/tinygo-org/tinygo-site
+ github_subdir: content/tour
+ path_base_for_github_subdir: content/tour
+ github_branch: dev
+---
+
+Welcome to the tour of TinyGo!
+
+This tour assumes you're already familiar with Go. If not, you can go through the [tour of Go](https://go.dev/tour/) to get started.
+
+Every example in this tour is runnable directly in the browser, and most can be downloaded directly to your own electronics board (like the [Adafruit Circuit Playground Express](https://www.adafruit.com/product/3333)).
diff --git a/content/tour/blink/_index.md b/content/tour/blink/_index.md
new file mode 100644
index 00000000..1347d96a
--- /dev/null
+++ b/content/tour/blink/_index.md
@@ -0,0 +1,10 @@
+---
+title: "Blinking LED"
+type: "docs"
+description: "Write the \"hello world\" of electronics by making an LED blink!"
+weight: 1
+---
+
+This short tour will get you up to speed with blinking a simple LED. This is a great way to start, especially if you've never done electronics before: if the LED blinks you know that everything works to continue in the tour. If you can't get it to work, you might need to do some troubleshooting before you can continue.
+
+This tour also teaches the basics of the TinyGo-specific machine package.
diff --git a/content/tour/blink/external.md b/content/tour/blink/external.md
new file mode 100644
index 00000000..518dde5a
--- /dev/null
+++ b/content/tour/blink/external.md
@@ -0,0 +1,131 @@
+---
+title: "External LED"
+description: "Same blinking LED as in the previous example, but now with an external LED."
+weight: 2
+---
+
+Instead of using an on-board LED, you can also connect a LED to an external pin. Just like you see in the example on the right. It connects an external LED (a red one in this case) to the pin A1 on the board.
+
+The code is almost identical to the previous example. The only difference is this line:
+
+```go
+ led := machine.A1
+```
+
+We've replaced the `led` variable: instead of the on-board LED we're now using the external pin A1.
+
+If you want to try this on a development board, make sure you use the correct wiring:
+
+ * Connect the LED cathode (short lead with flat side) to a resistor of around 220Ω-330Ω. Use at least 150Ω to protect the LED, and use at most 1000Ω to still be able to see the LED (higher values will make the LED very dim).
+ * Connect the other end of the resistor to ground.
+ * Connect the LED anode to pin A1 on the board. See the silkscreen on the board or the graphic in the simulator to know which pin this is.
+
+**Warning**: the resistor is not optional, not using the resistor can destroy the LED and/or your board. The LED might even explode!
+
+The simulation doesn't need this resistor because the virtual LED can't burn out. This simplifies the demo, but remember that the real world is messy and LEDs need a resistor. (There are technical reasons for this, read [this answer](https://electronics.stackexchange.com/questions/28393/why-do-we-need-resistors-in-led) for more details).
+
+
diff --git a/content/tour/blink/onboard.md b/content/tour/blink/onboard.md
new file mode 100644
index 00000000..cfdb6494
--- /dev/null
+++ b/content/tour/blink/onboard.md
@@ -0,0 +1,85 @@
+---
+title: "Blinking LED"
+description: "Hello world of hardware. Blink an on-board LED using your own development board."
+weight: 1
+---
+
+This is the classic "blinking LED" demo you will find in many places. You can find it for the [Arduino IDE](https://docs.arduino.cc/built-in-examples/basics/Blink/) for example. Here is the equivalent in Go.
+
+If you have one of the supported boards (see the dropdown below the code), you can run this code on your own hardware! If you don't, you can just use the simulator that's already running.
+
+Going through the code we can see the following:
+
+```go
+package main
+```
+
+This is just standard Go, so we begin with package main.
+
+```go
+import (
+ "machine"
+ "time"
+)
+```
+
+We import two packages. The time package is the well-known time package which we need to sleep while blinking. However the machine package is new: it is a special standard library package used by TinyGo.
+
+You can think of the machine package like the os or syscall package: it provides an abstraction layer over the underlying hardware and makes code more portable across boards.
+
+```go
+ led := machine.LED
+ led.Configure(machine.PinConfig{Mode: machine.PinOutput})
+```
+
+This configures the LED pin. The constant `LED` is defined in the machine package and represents the pin that is connected to the on-board LED. It is of type `machine.Pin`.
+
+We configure the pin here as an output pin, that is, it outputs either a high or low signal. _High_ or _low_ in this case mean that the output voltage is either somewhere close to the supply voltage (usually 5V or 3.3V) or close to ground (0V).
+
+```go
+ for {
+ led.High()
+ time.Sleep(time.Second/2)
+
+ led.Low()
+ time.Sleep(time.Second/2)
+ }
+```
+
+Here we just blink the LED: we set the output to high for ½ second and then set it to low for ½ second.
+
+Try changing these values and see what happens! For example you can set both to 1 second, or only one of them.
+
+When you play around with the sleep duration, you might discover that "high" and "low" don't actually match the "on" and "off" state of the LED. "high" usually means that the LED is off, while "low" means that it is on. This is because of the way the LED is wired: the anode is connected to the power source (probably via a resistor), and the cathode is connected to the microcontroller pin. This means that when the pin is high (close to the power source) both sides are positive and no current will flow. And when the pin is negative, current will flow from the power source through the LED into the microcontroller. Some boards are wired differently however, and "high" will mean the LED is on while "low" is off.
+
+
diff --git a/content/tour/button/_index.md b/content/tour/button/_index.md
new file mode 100644
index 00000000..5252a85c
--- /dev/null
+++ b/content/tour/button/_index.md
@@ -0,0 +1,8 @@
+---
+title: "Reading button inputs"
+description: "Make interactive hardware by responding to button presses."
+type: "docs"
+weight: 2
+---
+
+We've seen a blinking LED which provides output, now we're ready for reading from an input.
diff --git a/content/tour/button/external.md b/content/tour/button/external.md
new file mode 100644
index 00000000..1ce3e205
--- /dev/null
+++ b/content/tour/button/external.md
@@ -0,0 +1,162 @@
+---
+title: "External button"
+description: Use an external push button
+weight: 2
+---
+
+This time we'll be blinking an LED, but only when the button is pressed.
+
+If you try it out, you'll see that the LED is initially off (or on), but when you press the button it'll quickly blink. When you release the button, the blinking will stop and it will keep the last state (either on or off).
+
+If you have one of these boards but do not have a pushbutton, you can also use a small wire to connect the given pin (D2/A2/GP2 depending on the board) and then touch a ground point, such as the outside of the USB connector.
+
+
+```go
+ led := machine.LED
+ led.Configure(machine.PinConfig{Mode: machine.PinOutput})
+```
+
+This configures the on-board LED, same as in the [blink example]({{< ref "../blink/onboard.md" >}}).
+
+```go
+ button := machine.D2 // Arduino Uno
+ button.Configure(machine.PinConfig{Mode: machine.PinInputPullup})
+```
+
+This configures the button input. The button pin varies by board, but this time it's always a pullup.
+
+```go
+ // if the button is low (pressed)
+ if !button.Get() {
+ // ...
+ }
+```
+
+Here we check whether the button input is _low_, in other words, whether it is pressed. This is a bit counter intuitive, but that's how it is.
+
+```go
+ // toggle the LED
+ led.Set(!led.Get())
+```
+
+Here we use a trick to toggle the LED: we can actually read the current output value using `led.Get()` and then we can change the value to the opposite value using `led.Set`. This is equivalent to the following:
+
+```go
+ if led.Get() {
+ led.Low()
+ } else {
+ led.High()
+ }
+```
+
+
diff --git a/content/tour/button/onboard.md b/content/tour/button/onboard.md
new file mode 100644
index 00000000..9c02c783
--- /dev/null
+++ b/content/tour/button/onboard.md
@@ -0,0 +1,96 @@
+---
+title: "Reading button input"
+description: Learn how to respond to button presses
+weight: 1
+---
+
+Having some output using a LED is nice, but what's even better is if the electronics respond to you!
+
+In this example, we'll use one of the supported boards that have a button on them. If you don't have one of these boards, you can just read the code here and try the next step in the tour where you can connect an external button (or just use a wire).
+
+A lot of code will be familiar from the blinking LED in the previous step, but there are some important differences:
+
+```go
+ button := machine.BUTTONA
+ button.Configure(machine.PinConfig{Mode: machine.PinInputPulldown})
+```
+
+Instead of configuring a LED, we'll configure the pin that's connected to the button labeled 'A' (usually the leftmost button). The mode is `PinInputPullup` or `PinInputPulldown`, the specific mode depends on the board (we'll come back to this later).
+
+```go
+ if button.Get() {
+ println("button input is high")
+ } else {
+ println("button input is low")
+ }
+```
+
+Here we read out the current button state and print whether it was high (`true`) or low (`false`).
+
+You may find that the button pin is normally high but changes to low when pressed, and other boards are the reverse. This depends on how the button is wired, and will be explained later.
+
+## Serial connection
+
+To see the output of the program, you can use a serial monitor. There is a [tutorial for that]({{< ref "serialmonitor.md" >}}). But in short:
+
+ * If you have TinyGo installed, you can open a serial monitor using `tinygo monitor` command. You may need to specify the board, like `tinygo monitor -target=circuitplay-express`.
+ * If you have the Arduino IDE installed, you can use the built-in serial monitor. Make sure to select the right port and to set the baud rate to 115200.
+ * On Linux and MacOS you can use a command-line tool like picocom (which you probably need to install manually).
+ * If you use Windows, Adafruit has a [list of tools you can use](https://learn.adafruit.com/windows-tools-for-the-electrical-engineer/serial-terminal).
+
+## Button wiring
+
+There are many different types of buttons for loads of different applications. The one we're using here is a plain old pushbutton, or a _mometary_, _normally open_ _SPST_ button:
+
+ * _Momentary_ means that you can press it to change state, but when you release it it will revert to its previous state. This is like a keyboard key, and unlike a light switch (which keeps its state).
+ * _Normally open_ means that the connection between the two poles is open (unconnected) when it is not being pressed.
+ * _SPST_ is short for _single-pole, single-throw_ which basically means it's a simple switch with two terminals and two states.
+
+For more information about buttons, please [read this SparkFun article](https://learn.sparkfun.com/tutorials/button-and-switch-basics/all).
+
+For the boards in this tour, one terminal of the button is connected to the pin of the microcontroller and another is connected to either VCC (the power source) or GND (ground, or 0V). This depends on the board.
+
+With this, you can understand that as long as you're pressing the button, the input will be what the button is connected to. For example, if it is connected to GND, you will read `false` as long as you're pressing the button.
+
+But what if you're not pressing the button? It's not connected to ground, but also not to VCC, so what is it? The answer is that it is in an intermediary state called _floating_. Sometimes it reads one way, sometimes another, and it's kind of random which it will do. Even moving your hand around the pin might change the state! Electronic designers will try to avoid this state, by gently pulling the voltage either to ground or to VCC, using a resistor. See the next section.
+
+## Pull mode
+
+To avoid the floating state, microcontrollers have a way to gently pull the voltage one way or another using a built-in resistor. This is why we need either `PinInputPullup` or `PinInputPulldown`. This tells the pin to connect a weak resistor, either between the pin and VCC or between the pin and ground. You can think of it as pulling the voltage either way so it avoids wandering off. Once you press the button, the voltage will be pulled very hard in the other direction so will override the weak pull from the pullup or pulldown resistor.
+
+Sometimes, electronic designers will also put these resistors as physical resistors on the board. This is the case for the Gopher Badge for example. In that case, it is not necessary to specify a pull mode: the hardware already does that. But it won't harm either.
+
+
+
diff --git a/content/tour/imu/_index.md b/content/tour/imu/_index.md
new file mode 100644
index 00000000..eeb3ed9a
--- /dev/null
+++ b/content/tour/imu/_index.md
@@ -0,0 +1,10 @@
+---
+title: "I2C: Accelerometer"
+type: "docs"
+description: "Learn the I2C protocol by reading the physical orientation using an accelerometer."
+weight: 5
+---
+
+This tour will give an introduction into using I2C devices, using the LIS3DH accelerometer. This is a cheap and low-power accelerometer that is used on a lot of prototyping boards. It explains how to connect to an accelerometer and how to read its values.
+
+Officially these are called I²C devices, but for simplicitly we're using I2C for readability and searchability instead.
diff --git a/content/tour/imu/configure.md b/content/tour/imu/configure.md
new file mode 100644
index 00000000..70f21577
--- /dev/null
+++ b/content/tour/imu/configure.md
@@ -0,0 +1,78 @@
+---
+title: "Configuring the accelerometer"
+description: "Turn on the accelerometer and start reading values"
+weight: 2
+---
+
+The accelerometer that we are using, LIS3DH, starts in a low power mode. That's not the case for all such sensors, many start up in an already enabled state that uses more power. Starting up to a low power mode means that we can ignore the accelerometer when we don't use it and it won't use more power than necessary, but it does mean we need to configure it before we can use it.
+
+The beginning of the code on the right is the same as before, but now we do some magic:
+
+```go
+ err = i2c.Tx(0x18, []byte{0x20, 0b0100_0111}, nil)
+ if err != nil {
+ println("got error while configuring the LIS3DH:", err.Error())
+ return
+ }
+````
+
+That's a lot of magic numbers! Let's go through them:
+
+ * 0x18 is the I2C address, like before. It varies a bit depending on the electronics, but it will always be 0x18 or 0x19 for this particular sensor.
+ * 0x20 is the register address.
+ * 0b0100_0111 (8 bits of binary data) is the value that we're going to write to register 0x20.
+
+Internally, most I2C devices are organized as a number of registers. You can think of it as a slice of bytes, one that's typically just 128 or so bytes long. This slice contains both configuration data (which can typically be read and written), and sensor output data (which is typically read-only). In one transaction, you can either read or write data to the I2C device:
+
+ * For reading, you send a single byte (the register address) to the device and then read the response values into the `r` byte slice. This is what we did in the previous step of this tour, to read the `WHO_AM_I` register.
+ * For writing, you send a slice of bytes to the device and read nothing back. The first byte in the slice is the address, the subsequent bytes are the values to write to the registers starting at the given address. This is what we do above.
+
+To know what register 0x20 is, and what the value 0b0100_0111 means, we need to take another look at the [datasheet](https://cdn-shop.adafruit.com/datasheets/LIS3DH.pdf#page=29):
+
+
+
+This section describes register CTRL_REG1 at address 20h. "20h" means "hexadecimal 20", which is the same as 0x20 in Go.
+
+The register itself contains 8 bits: 4 bits for "ODR", one for "LPen", and 3 bits for the three axes (Z, Y, X).
+
+Decoding our value 0b0100_0111 (starting from the lowest bits on the right), we see the following:
+
+ * The lowest 3 bits are the three axes: X, Y, and Z. Of course we want to enable all of them but it is possible to disable some of them if you need. Who knows, it might reduce power usage a little (even though this chip already uses very little power).
+ * The next bit is LPen, or "low power mode enable". This bit is zero, so that means low power mode is disabled (if we enable it, we get less precision from the sensor).
+ * The upper bits, 0100, are the four ODR bits. These four bits are described in table 26 above. Looking at the table, "0 1 0 0" means that we will enable the accelerometer to run at 50Hz (measuring acceleration 50 times per second). This seems like a reasonable speed for our purposes.
+
+Now if you look at the "Properties" tab on the right, you can see that the LIS3DH is indeed configured as "Normal mode 50Hz, enabled axes X, Y, Z", exactly what we wanted! If you go back one step (where we read the `WHO_AM_I` register) you can see it is set to "Power down mode" instead since that is the power-on default. Also, if you go to the "Power" tab, you can see that the LIS3DH now uses 11µA instead of 0.5µA as it did in power down mode.
+
+Try changing the value 0b0100_0111 to something else, and see what happens in the simulator!
+
+
diff --git a/content/tour/imu/connected.md b/content/tour/imu/connected.md
new file mode 100644
index 00000000..2bb68178
--- /dev/null
+++ b/content/tour/imu/connected.md
@@ -0,0 +1,90 @@
+---
+title: "Get started with I2C"
+description: "Get started with the LIS3DH by verifying the connection."
+weight: 1
+---
+
+The LIS3DH sensor can measure acceleration and changes in temperature. But to get this data from the sensor, we need a way to establish communication. We'll be using the I2C protocol, which is the most common way to communicate with low-speed external devices.
+
+```go
+ i2c := machine.I2C0
+ err := i2c.Configure(machine.I2CConfig{
+ SCL: machine.GP17,
+ SDA: machine.GP16,
+ })
+```
+
+To start using I2C, we need to configure I2C on the microcontroller. This code (for the Raspberry Pi Pico) configures GP17 and GP16 as the pins to be used. Note that you can't use all pins! Many microcontrollers only allow using specific pins for I2C. We'll get to that later.
+
+```go
+ w := []byte{0x0f}
+ r := make([]byte, 1)
+ err := i2c.Tx(0x18, w, r)
+```
+
+This does an actual transaction. This code will first write the I2C peripheral address (0x18 or 0x19 depending on the electronic design), then write the byte 0x0f in the `w` byte slice, and then read a single byte back to store in the `r` byte slice. The peripheral address is the one for the LIS3DH, and 0x0f is a register called `WHO_AM_I` which when read returns a fixed value to identify the chip.
+
+
+
+Here is the description from the [datasheet](https://cdn-shop.adafruit.com/datasheets/LIS3DH.pdf#page=29). It says the returned bits are "0 0 1 1 0 0 1 1". Decoding this to decimal, we get the number 51. And that's exactly what we get back from the chip, which shows that we managed to communicate with the chip!
+
+
+## Connecting I2C devices
+
+I2C uses two wires to communicate: a clock wire (SCL) and a data wire (SDA). Connect the SCL pin on the microcontroller to the SCL pin on the sensor, and the SDA pin on the microcontroller to the SDA pin on the sensor. Also, make sure there is a ground connection between the two, otherwise communication won't work!
+
+Apart from SCL and SDA (and a shared ground), the sensor also needs some power. This is often 3.3V, but check the datasheet to be sure. If the sensor needs 3.3V and you provide it 5V, it will likely burn out! In the simulator we skip this requirement to avoid clutter.
+
+I2C may also need some external pullup registers, that make sure the wires stay high unless they are set to a low voltage by the controlling device. In practice, many sensors already include pullup resistors and microcontrollers often configure I2C wires with a pullup, so this may not be required in practice. It's something to be aware of when you design your own board though.
+
+## I2C basics
+
+I2C allows using multiple devices with just one pair of wires! This pair of wires (SCL and SDA) is called a bus, and can be connected to multiple sensors and actuators. It typically only allows one controlling device (the main microcontroller), but on this bus up to 127 or so devices can be used. These are usually sensors or other low-speed devices, but you can also configure another microcontroller as a peripheral device to allow communication with the controlling device.
+
+To support multiple devices on a single bus, every I2C peripheral device has an address. In the case of the LIS3DH, that is 0x18 or 0x19 in hexadecimal. You can change the address by connecting the SA0/SDO pin to VCC or GND.
+
+Communication is always initiated from the controller device (typically the microcontroller), and happens in a single transaction with a peripheral device. The controller sends the address, then sends a few bytes (which can be zero-length), and then receives a number of bytes. That all happens in a single operation called a "transaction".
+
+In other documentation you may see the term "master" and "slave", but we chose to use the [less problematic](https://oshwa.org/resources/a-resolution-to-redefine-spi-signal-names/) "controller" and "peripheral" instead.
+
+As usual, [SparkFun has an excellent article explaining all the ins and outs of I2C](https://learn.sparkfun.com/tutorials/i2c/all) if you want to learn more.
+
+
+
diff --git a/content/tour/imu/reading.md b/content/tour/imu/reading.md
new file mode 100644
index 00000000..67b76076
--- /dev/null
+++ b/content/tour/imu/reading.md
@@ -0,0 +1,93 @@
+---
+title: "Reading acceleration values"
+description: "Read the X, Y, and Z values from the accelerometer."
+weight: 3
+---
+
+Now that we have the accelerometer configured, we can start reading the values it reads.
+
+Most of the code is the same as before, but the reading part is new:
+
+```go
+ // Read the acceleration data.
+ w := []byte{0x28|0x80}
+ r := make([]byte, 6)
+ err := i2c.Tx(0x18, w, r)
+```
+
+Here we read 6 bytes starting with register 0x28. We'll get back to why we need to set the highest bit later (through `|0x80`). First let's take a look at the [datasheet](https://cdn-shop.adafruit.com/datasheets/LIS3DH.pdf#page=33) again:
+
+
+
+So here we have 6 registers that contain the acceleration data in the 3 directions (X, Y, Z) where each direction takes up two registers. Since each register is 8 bits, and the data itself is 10 bits, two registers are needed for each direction.
+
+Decoding it is a little bit tricky though, if you're not used to bitwise operations:
+
+```go
+ x := int16(r[0]) | int16(r[1])<<8
+ y := int16(r[2]) | int16(r[3])<<8
+ z := int16(r[4]) | int16(r[5])<<8
+ println("x, y, z:", x, y, z)
+````
+
+This combines the two 8 bit values into a single 16-bit signed integer. If we take the X axis for example, the datasheet implies the first register (`OUT_X_L`) is low, since it has "L" in the name. (Yes, it's not the most helpful datasheet in this regard). The next register (`OUT_X_H`) contains the upper bits. So the way to convert them to a single 16-bit value is to convert them both individually to a 16-bit value (which keeps the lower bits but fills the missing bits with zero), then _shift_ the bits of `OUT_X_H` to the high position, and OR them together. This gives us a single 16-bit value, which is the signed X axis.
+
+On the right you can see the values we read from the accelerometer. On a desktop computer you will see simulated values, as if the board is lying flat on a surface. However, if you are on a supported mobile device (phone, table), you will actually be able to see the real acceleration values of your device!
+
+Some things to note:
+
+ * **Gravity** is also measured. This is just how physics works: when the sensor is lying still, it shows values as if it was accelerating at *g* speed away from earth. (Unless you're doing this in a zero-gravity environment, of course). There are various algorithms to filter out the gravity component, which will usually be needed for practical applications.
+ * There is **noise** in the output. Every sensor has noise, this one included. The simulator includes the noise to be more realistic, and if you use such a sensor in a project you need to be aware that such noise exists.
+ * The sensor can be put on a board in various ways, for example it can either be on top or at the bottom. This will of course impact the measurements.
+
+## What's up with that upper bit?
+
+While for I2C devices you can read multiple sequential registers by writing the register address and then reading multiple values back, the LIS3DH is a bit different. By default it will return the same register on every read. To get the behavior we want, we need to set the highest bit of the register address to one, which gets the sensor to return values incrementally.
+
+
diff --git a/content/tour/pwm/_index.md b/content/tour/pwm/_index.md
new file mode 100644
index 00000000..48cf8fcf
--- /dev/null
+++ b/content/tour/pwm/_index.md
@@ -0,0 +1,8 @@
+---
+title: "PWM"
+description: "Using the PWM peripheral of common microcontrollers."
+type: "docs"
+weight: 4
+---
+
+PWM, or Pulse Width Modulation, is a deceptively simple but very powerful technique for controlling various things in the real world. Perhaps the most well known application is dimming LEDs, but PWM can also be used to control servo motors and producing crude (square wave) tones on speakers.
diff --git a/content/tour/pwm/blink.md b/content/tour/pwm/blink.md
new file mode 100644
index 00000000..2fc86d5c
--- /dev/null
+++ b/content/tour/pwm/blink.md
@@ -0,0 +1,112 @@
+---
+title: "LED: blink"
+description: "Get a LED to blink using the PWM peripheral."
+weight: 1
+---
+
+PWM, or pulse-width modulation, is a method of turning a GPIO pin high and low at a fixed frequency but changing the percent of time it is turned on. This has numerous applications, such as dimming LEDs. We'll see various applications of PWM throughout this tour.
+
+To start off with, we're going to do something slightly unusual with PWM: we're going to blink an LED. Remember that PWM is a way of quickly turning an output high and low, if we do that slow enough we can see the LED blink. This should make it easier to see how PWM works.
+
+At first we'll just define some variables. These may vary by board, so it's useful to define them in a single place.
+
+```go
+ // Board specific configuration.
+ led := machine.LED
+ pwm := machine.TCC0
+```
+
+Next we're going to configure the PWM peripheral itself:
+
+```go
+ // Configure the timer/PWM.
+ err := pwm.Configure(machine.PWMConfig{
+ Period: 2e9, // two seconds for a single cycle
+ })
+ if err != nil {
+ println("could not configure:", err.Error())
+ return
+ }
+```
+
+This configures the PWM peripheral for a cycle time of two seconds. That's much longer than PWM is commonly used for, but it allows to see us what happens.
+
+Next up, we connect the PWM peripheral to the given output pin:
+
+```go
+ // Get the channel for this PWM peripheral.
+ ch, err := pwm.Channel(led)
+ if err != nil {
+ println("could not obtain channel:", err.Error())
+ return
+ }
+```
+
+We get a channel number back. One PWM peripheral typically has 2-4 channels, which can be connected to certain pins. Which pins can be used depends a lot on the hardware, which we'll [get to later](../multiple/#finding-the-correct-pwm-peripheral-and-pins). For now, all you need to know is that the PWM channel is now connected to a single GPIO pin.
+
+To actually make the LED blink, we will need to set the duty cycle. The duty cycle refers to the part of the time when the PWM is turned on. In this case, we will set the duty cycle to half the "top" value of the LED:
+
+```go
+ // Blink the LED, setting it to "on" half the time.
+ pwm.Set(ch, pwm.Top()/2)
+```
+
+The top value is equivalent to a duty cycle of 100% - or 100% of the time on. So using the top divided by 2 results in a duty cycle of 50%, or "high" for half the time. Dividing by 3 results in a duty cycle of 33%, etc. By varying the formula you can either use a particular percentage (like we do here) or if you know the period size you can calculate a specific "on" time within the cycle (such as "500ms on, 2000ms off").
+
+To get a feel for how it works, you can try a few things:
+
+ * You can change the period to something other than `2e9` (two seconds) and see what happens to the "top" value.
+ * You can change the duty cycle by changing the `pwm.Set` call.
+ * You can connect a different LED to the virtual board, and blink it.
+ * You can try using a different PWM peripheral. These boards also have `TCC1` and `TCC2`.
+
+## More information
+
+SparkFun has written an [excellent tutorial on PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation) that is well worth a read!
+
+
+
+
diff --git a/content/tour/pwm/fade.md b/content/tour/pwm/fade.md
new file mode 100644
index 00000000..b20d8fd2
--- /dev/null
+++ b/content/tour/pwm/fade.md
@@ -0,0 +1,93 @@
+---
+title: "LED: fade"
+description: "Fade a LED using the PWM peripheral."
+weight: 2
+---
+
+Next up, we're going to do what PWM was actually designed for! Namely, quickly controlling an output so that the average output can be controlled precisely.
+
+Most of it is similar to blinking an LED using the PWM peripheral, but fading needs a little bit more work:
+
+```go
+ // Fade the LED in.
+ for percentOn := 0; percentOn <= 100; percentOn++ {
+ pwm.Set(ch, pwm.Top()*uint32(percentOn)/100)
+ time.Sleep(time.Second / 100)
+ }
+```
+
+Here we fade the LED in. This loop loops 101 times (from 0 to 100 inclusive), setting the output to a percentage of the input. The code `pwm.Top()*uint32(percentOn)/100` is essentially the integer variant of the following formula:
+
+```math
+\frac{T}{100} * P
+```
+
+Where \\(T\\) is the top value (`pwm.Top()`) and \\(P\\) is the percentage (`percentOn`).
+
+Fading out is very similar. It's almost identical, except it loops from 100 to 0 (inclusive):
+
+```go
+ // Fade the LED out.
+ for percentOn := 100; percentOn >= 0; percentOn-- {
+ pwm.Set(ch, pwm.Top()*uint32(percentOn)/100)
+ time.Sleep(time.Second / 100)
+ }
+```
+
+
+
diff --git a/content/tour/pwm/multiple.md b/content/tour/pwm/multiple.md
new file mode 100644
index 00000000..8ead7dc0
--- /dev/null
+++ b/content/tour/pwm/multiple.md
@@ -0,0 +1,192 @@
+---
+title: "LED: fade multiple"
+description: "Control multiple channels from a single PWM peripheral by making use of channels."
+weight: 3
+---
+
+One PWM peripheral can be used to control multiple LEDs as well, by using different channels. In that case, the frequency (or period) will be the same for all LEDs, but the duty cycle (percent on) will vary per channel and therefore per LED.
+
+On the right, we have a single PWM instance but we use two goroutines to fade both LEDs in and out. Both LEDs are using a different PWM channel.
+
+## Finding the correct PWM peripheral and pins
+
+You may be wondering how we picked the right PWM peripheral and pins? It's actually all in the documentation if you know where to look:
+
+ * [Arduino Nano 33 IoT](/docs/reference/microcontrollers/arduino-nano33/#pins)
+ * [Adafruit Circuit Playground Bluefruit](/docs/reference/microcontrollers/circuitplay-bluefruit/#pins) (special case, see below)
+ * [Adafruit Circuit Playground Express](/docs/reference/microcontrollers/circuitplay-express/#pins)
+ * [Raspberry Pi Pico](/docs/reference/microcontrollers/pico/#pins)
+
+Let's look at the first, the Arduino Nano 33 IoT. In the Pins table, there are these two rows:
+
+> | Pin | Hardware pin | Alternative names | PWM |
+> | ----------------- | ------------ | ----------------- | -------------------- |
+> | `A2` | `PA11` | | `TCC1` (channel 1), `TCC0` (channel 3) |
+> | `A3` | `PA10` | `I2S_SCK_PIN` | `TCC1` (channel 0), `TCC0` (channel 2) |
+
+In this table you can see that we actually could have used two different PWM peripherals! Either TCC1 or TCC0. Both are supported for both pins, and importantly both use different channels for each pin. For TCC1 (as used on the right) channel 1 and 0 are used, while for TCC0 channel 2 and 3 would have been used.
+
+Question: can you verify that the peripheral used for the other 3 boards corresponds to the PWM peripheral and channel used in the simulator on the right?
+
+You might have noticed that three out of the four boards list PWMs, but one does not: the Circuit Playground Bluefruit. This is because the PWM peripherals on this chip can be connected to any pin. So what happens instead is that the `machine.PWM` type will not look up the pin in a table or something, but will instead use the first available unused channel. This brings a lot of flexibility, especially when you are working with special device types like servos (which will be addressed later in this tour).
+
+
+
diff --git a/content/tour/pwm/servo-driver.md b/content/tour/pwm/servo-driver.md
new file mode 100644
index 00000000..1c3fdf9f
--- /dev/null
+++ b/content/tour/pwm/servo-driver.md
@@ -0,0 +1,159 @@
+---
+title: "Servo: using a driver"
+description: "Control a servo motor using the servo driver to simplify things."
+weight: 11
+---
+
+In many cases, it would be nice to avoid having to care about all these specific calculations. Luckily we have the [servo driver](https://pkg.go.dev/tinygo.org/x/drivers/servo) as part of the TinyGo drivers module. It still requires looking up the right PWM and pin combinations, but it does simplify controlling the servos a bit.
+
+To use the driver, we need to configure it first:
+
+```go
+ // Configure the servo array.
+ array, err := servo.NewArray(pwm)
+ if err != nil {
+ println("could not configure:", err.Error())
+ return
+ }
+```
+
+We just pass in the PWM peripheral, and it will configure the PWM to the right period size. Note it is called an "array" since we can actually control multiple servos! More on that later.
+
+Next, we can configure the servo array to use this servo:
+
+```go
+ // Add a servo to the servo array.
+ servo, err := array.Add(servoPin)
+ if err != nil {
+ println("could not add servo pin:", err.Error())
+ return
+ }
+```
+
+This will configure the pin to be used as a servo pin, and returns a `servo.Servo` instance. This instance can then be used to set the servo angle:
+
+```go
+ // Left position at 2000µs (2ms) "on" time.
+ println("left: -90°")
+ servo.SetMicroseconds(2000)
+ time.Sleep(time.Second * 3)
+```
+
+
+
diff --git a/content/tour/pwm/servo-multiple.md b/content/tour/pwm/servo-multiple.md
new file mode 100644
index 00000000..f9f96c0d
--- /dev/null
+++ b/content/tour/pwm/servo-multiple.md
@@ -0,0 +1,163 @@
+---
+title: "Servo: multiple servos"
+description: "Control multiple servos at once"
+weight: 12
+---
+
+Since many PWM peripherals have multiple channels (usually 2 or 4) we can in fact control multiple servos using a single PWM peripheral (freeing up other PWM peripherals for other tasks). This is why it's called `servo.NewArray`!
+
+The code is very similar to using a single servo, but this time we control more than one from different goroutines. If you need more servos, you can of course use more than one servo array with different PWM peripherals.
+
+
+
diff --git a/content/tour/pwm/servo.md b/content/tour/pwm/servo.md
new file mode 100644
index 00000000..a8a6da36
--- /dev/null
+++ b/content/tour/pwm/servo.md
@@ -0,0 +1,183 @@
+---
+title: "Servo: intro"
+description: "Control a servo motor directly using PWM"
+weight: 10
+---
+
+Servos are rotary motors that allow for precise control of their angular position. The position is set using a form of pulse-width modification (PWM). Every 20ms or so (the precise interval doesn't matter too much) a pulse of 1ms to 2ms is sent that indicates the target position for the motor. The pulse width is what matters here: 1.5ms indicates the center position, 1ms all the way to the right, and 2ms all the way to the left.
+
+There is a decent amount of variation among servo motors:
+
+ * Servos generally accept a wider range of pulse intervals, 20ms is standard but it doesn't matter too much.
+ * The usual range is 1ms to 2ms, but many servos accept a somewhat larger range from about 0.8ms to 2.2ms. Be careful with this: putting a servo out of range will let it keep trying to reach that position (which it can't) which will quickly wear out the motor!
+ * Different servos have different ranges. Typical ranges are 90° and 180°, the simulator has a 180° servo.
+
+So we need to send very precisely timed pulses every 20ms. That's exactly the sort of thing the built-in PWM is made for! Here is how we can do that:
+
+ * Configure the PWM peripheral to use a period of 20ms.
+ * Configure a channel/pin to be used for the servo.
+ * Set the channel to a duty cycle that matches the 1-2ms range.
+
+This is exactly what the code on the right is doing. Let's look at setting the servo in a specific position:
+
+```go
+ // Left position at 2000µs (2ms) "on" time.
+ println("left: -90°")
+ pwm.Set(ch, pwm.Top()*20/200)
+ time.Sleep(time.Second * 3)
+```
+
+We see it uses the following formula for calculating the duty cycle:
+
+```math
+\frac{T*20}{200}
+```
+
+Simplifying, we get:
+
+```math
+\frac{T}{10}
+```
+
+In other words, the 20ms period is divided by 10 to get an "on" time of 2ms: exactly what we wanted! The fractions for 1ms (all the way to the right) and 1.5ms (center position) are the same.
+
+Because servos aren't instantaneous, we do need to wait a bit for the change to take effect:
+
+```go
+ time.Sleep(time.Second * 3)
+```
+
+3 seconds is much longer than it needs (it will arrive much faster in the target position) but it lets us see what is happening. If we'd set the PWM channel to 2ms (to the left), and then immediately to 1ms (to the right), the servo wouldn't have time to go to the left and immediately go to the right!
+
+## Connecting a servo
+
+Servos only need three wires to work:
+
+ * Black or brown goes to ground.
+ * Red goes to the power supply (usually 5V but check your servo datasheet).
+ * Yellow/white/orange is the control wire, and is the one you will connect to the microcontroller.
+
+Be careful about the power supply! Servos need a lot of current when they are rotating, and the 5V output of a board may not be enough. So an external power supply might be a better idea. If you use a separate power supply, do make sure to connect the ground wires together otherwise the signal won't be received properly.
+
+## More information
+
+SparkFun has made an [excellent guide](https://www.sparkfun.com/servos) on servos which is well worth a read!
+
+
diff --git a/content/tour/ws2812/_index.md b/content/tour/ws2812/_index.md
new file mode 100644
index 00000000..172e7ecc
--- /dev/null
+++ b/content/tour/ws2812/_index.md
@@ -0,0 +1,6 @@
+---
+title: "WS2812/NeoPixel LEDs"
+description: "Control common addressable LEDs"
+type: "docs"
+weight: 3
+---
diff --git a/content/tour/ws2812/animating.md b/content/tour/ws2812/animating.md
new file mode 100644
index 00000000..9df5db9a
--- /dev/null
+++ b/content/tour/ws2812/animating.md
@@ -0,0 +1,176 @@
+---
+title: "Animating LEDs"
+description: How to animate LEDs using a main loop.
+weight: 2
+---
+
+Manually setting the color of each LED is nice, but of course it's much more interesting to animate them! Of course that's possible with a bit more code, see the code and demo on the right.
+
+There are many ways to code an animation, but one that works well in many cases is by using a main loop that updates the in-memory color values, sends them out to the LED strip, and sleeps for a bit. Let's go through the code:
+
+```go
+ // Configure LEDs.
+ ledPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
+ ws := ws2812.New(ledPin)
+ leds := make([]color.RGBA, 10)
+```
+
+This configures the LEDs as before. One difference is that we create a slice of color values in advance, without setting their initial values. But since all color components get initialized to zero, this effectively creates an all-black color slice.
+
+```go
+ red := false
+ for {
+ // ...
+ }
+```
+
+This is the main loop of the program. It's an infinite loop (much like the `loop` function on the Arduino platform) that controls the LEDs infinitely - or, more likely, until you pull the power.
+
+Note also that it initializes the `red` variable to false, which is later used to toggle the color each cycle.
+
+```go
+ // Update the in-memory LED array.
+ red = !red
+ for i := range leds {
+ red = !red
+ if red {
+ leds[i] = color.RGBA{R: 0xff}
+ } else {
+ leds[i] = color.RGBA{G: 0xff}
+ }
+ }
+```
+
+This is the first step of the loop. All values in the LED array get set to a specific color (red or green), toggling the color for each LED.
+
+```go
+ // Send the new colors to the LED strip.
+ ws.WriteColors(leds)
+```
+
+Like before, this is where the LED strip gets updated.
+
+```go
+ // Wait a bit until the next update.
+ time.Sleep(time.Second / 2)
+```
+
+This sleeps for a bit, so that the LED animation looks correct. In fact, this sleep is necessary for the correct functioning of the LED strip! Because the WS2812 protocol only knows when it has received all data when there's a short delay (up to 50µs) in the received data, we need to sleep for at least a short while.
+
+
+
diff --git a/content/tour/ws2812/intro.md b/content/tour/ws2812/intro.md
new file mode 100644
index 00000000..6dc34971
--- /dev/null
+++ b/content/tour/ws2812/intro.md
@@ -0,0 +1,180 @@
+---
+title: "Introduction"
+description: How to use the extremely common WS2812/NeoPixel addressable LEDs.
+weight: 1
+---
+
+You've probably seen or used these LEDs before. They're extremely common in the maker scene, for a good reason! They're cheap, widely available, and easy to use. You can control them from basically any microcontroller with just a single pin and a good power supply.
+
+On the right you can see how to control them. Some boards include WS2812 boards, so you can use those without fiddling with wires.
+
+```go
+ledPin.Configure(machine.PinConfig{Mode: machine.PinOutput})
+```
+
+Before being able to send any data, the pin needs to be set as an output. This is similar to how you'd control a single LED.
+
+```go
+ws := ws2812.New(ledPin)
+```
+
+The `ws` object is the driver for these LEDs and is later used to update the LEDs.
+
+
+```go
+leds := []color.RGBA{
+ {R: 255, G: 0, B: 0},
+ {R: 0, G: 255, B: 0},
+ {R: 0, G: 0, B: 255},
+}
+```
+
+This initializes a slice of RGB values to be sent to the LED strip. The first is red, the second green, and the third blue.
+
+```go
+ws.WriteColors(leds)
+```
+
+And here we send the LED colors to the LED strip. Easy, right?
+
+Though if you look at the output of the simulator, you can see that it is actually reversed: the first LED is blue, the second green, and the third red. What happened here?
+
+## WS2812 daisy chaining
+
+To understand why the LEDs are reversed, we need to understand a bit of how the protocol works.
+
+For the first LED, the microcontroller sends the first color in the array to the first LED. This means the first LED receives the red color. It doesn't apply the color immediately, instead it keeps the color in a buffer and waits to see whether more will be coming.
+
+But the microcontroller doesn't wait, it sends the next color (green) to the first LED. The first LED already has the color red in the buffer, so it sends the color red to the next (second) LED while receiving the green color.
+
+Now, the third color (blue) is sent. Like before, the first LED receives blue and sends the green it has in the buffer. The second LED receives green, and sends the red color to the third LED.
+
+Now the microcontroller is finished, it doesn't send anything else. In fact, the main function returns so it locks up. After a while (50µs according to the datasheet, [around 9µs in practice](https://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/)) all the LEDs in the string realize no more data is coming so they apply the color they have in their buffer.
+
+Knowing this we can do interesting things with these LEDs:
+
+ * It's possible to daisy chain many of these LED strips! They pass color data from one to the other, and so connecting multiple in a chain means you get one big LED strip. Though watch out for power consumption, this'll quickly add up!
+ * You can, if you want, control multiple LED strips in parallel. They will look the same, but it does save a pin on the microcontroller.
+ * You can update multiple chained LED strips independently! Just send them all together without any delay in between (from last to first). This can be useful for controlling chained RGB and RGBW LED strips, if you happen to have such a setup. We'll get to RGBW LED strips later.
+
+## Connecting WS2812 LEDs
+
+The simulator simplifies a lot of things. Sadly, the real world is a bit more complicated.
+
+There are extensive guides on the internet on how to connect these LEDs. [Here is one by Adafruit](https://learn.adafruit.com/adafruit-neopixel-uberguide/the-magic-of-neopixels), and [here is one by SparkFun](https://learn.sparkfun.com/tutorials/ws2812-breakout-hookup-guide/all). But in short, here are a few things you need to be aware of:
+
+ * The power wire (usually red) needs to be connected to a decent power supply. For just a few LEDs you can usually use a pin on the microcontroller board itself, this one is usually labeled "5V", "VBUS", or "VOUT". Check the pinout to be sure! For longer LED strips you will need a separate 5V power supply.
+ * The ground wire (usually white or black) needs to be connected to the microcontroller ground. If you use a separate power supply, it also needs to be connected to the ground of that power supply.
+ * The data pin (usually green) needs to be connected to the GPIO pin you are using on the board.
+ * Make sure the wires are not too long! One meter will usually work fine, but for longer wires you may need special handling.
+ * These LEDs can be very bright, especially in the dark! Many people don't run them at full brightness for this reason.
+
+
+## WS2812 vs NeoPixel vs SK6812 vs ...
+
+These are all the same type of LEDs! There are multiple companies that make these, but apart from some details these LEDs are all interchangeable. In this tour, we'll just use the name "WS2812" for the whole family.
+
+WS2812 was the original by WorldSemi (hence WS), followed by the WS2812B which made it slightly more robust. SK6812 is a very similar chip from a different company (known for making a RGBW version of the WS2812). There are many others that are usually just sold as "WS2812" even though they aren't from WorldSemi.
+
+NeoPixel is the Adafruit brand for this type of LED. They're still the same LEDs (from WorldSemi and others), just with a different name.
+
+
+
diff --git a/content/usage/important-options.md b/content/usage/important-options.md
deleted file mode 100644
index a76d679e..00000000
--- a/content/usage/important-options.md
+++ /dev/null
@@ -1,69 +0,0 @@
----
-title: "Important Build Options"
-weight: 3
----
-
-There are a few flags to control how binaries are built:
-
-- `-o`
-Output filename, see the ``build`` command.
-
-- `-target`
-Select the target you want to use. Leave it empty to compile for the host. This switch also configures the emulator, flash tool and debugger to use so you don't have to fiddle with those options. Read [supported targets](../../microcontrollers/) for a list of supported targets. Example targets:
-
- - wasm
-WebAssembly target. Creates .wasm files that can be run in a web browser.
-
- - arduino
-Compile using the experimental AVR backend to run Go programs on an Arduino Uno.
-
- - microbit
-Compile programs for the `BBC micro:bit `_.
-
- - qemu
-Run on a Stellaris LM3S as emulated by QEMU.
-
-- `-port`
-Specify the serial port used for flashing. This is used for the Arduino Uno, which is flashed over a serial port. It defaults to ``/dev/ttyACM0`` as that is the default port on Linux.
-
-- `-opt`
-Which optimization level to use. Optimization levels roughly follow standard `-O` level options like ``-O2``, ``-Os``, etc. Available optimization levels:
-
- - `-opt=0`
-Disable as much optimizations as possible. There are still a few optimization passes that run to make sure the program executes correctly, but all LLVM passes that can be disabled are disabled.
-
- - `-opt=1`
-Enable only a few optimization passes. In particular, this keeps the inliner disabled. It can be useful when you want to look at the generated IR but want to avoid the noise that is common in non-optimized code.
-
- - `-opt=2`
-A good optimization level for use cases not strongly limited by code size. Provided here for completeness. It enables most optimizations and will likely result in the fastest code.
-
- - `-opt=s`
-Like `-opt=2`, but while being more careful about code size. It provides a balance between performance and code size.
-
- - `-opt=z` (default)
-Like ``-opt=s``, but more aggressive about code size. This pass also reduces the inliner threshold by a large margin. Use this pass if you care a lot about code size.
-
-- `-ocd-output`
-Print output of the on-chip debugger tool (like OpenOCD) while in a `tinygo gdb` session. This can be useful to diagnose connection problems.
-
-- `-gc`
-Use the specified memory manager:
-
- - `-gc=none`
-Do not use a memory manager at all. This will cause a link error at every place in the program that tries to allocate memory. The primary use case for this is finding such locations.
-
- - `-gc=dumb`
-Only allocate memory, never free it. This is the simplest allocator possible and uses very few resources while being very portable. Also, allocation is very fast. Larger programs will likely need a real garbage collector.
-
- - `-gc=marksweep`
-Simple conservative mark/sweep garbage collector. This collector does not yet work on all platforms. Also, the performance of the collector is highly unpredictable as any allocation may trigger a garbage collection cycle.
-
-- `-panic`
-Use the specified panic strategy. That is, what the compiled program should do when a panic occurs.
-
- - `-panic=abort`
- Print the panic message and abort the program. This is the default. On a desktop system this results in a call to [`abort`](https://manpages.debian.org/stretch/manpages-dev/abort.3.en.html). On WebAssembly this is implemented as the [`unreachable`](https://webassembly.github.io/spec/core/syntax/instructions.html#syntax-instr-control) instruction. On microcontrollers, it results in a hang (endless loop).
-
- - `-panic=trap`
- Do not print the panic message but instead of printing anything, it directly hits a trap instruction. This instruction varies by platform but it will result in the immediate termination of the program. It could either exit with `SIGILL` or cause a call to the `HardFault_Handler`. It can be used to reduce the size of the compiled program while keeping standard Go safety rules intact at the cost of debuggability.
diff --git a/content/usage/misc-options.md b/content/usage/misc-options.md
deleted file mode 100644
index 878c209c..00000000
--- a/content/usage/misc-options.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-title: "Misc. Build Options"
-weight: 4
----
-
-- `-no-debug`
-Disable outputting debug symbols. This can be useful for WebAssembly, as there is no debugger for .wasm files yet and .wasm files are generally served directly. Avoiding debug symbols can have a big impact on generated binary size, reducing them by more than half.
-This is not necessary on microcontrollers because debugging symbols are not flashed to the microcontroller. Additionally, you will need it when you use `tinygo gdb`. In general, it is recommended to include debug symbols unless you have a good reason not to.
-Note: while there is some support for debug symbols, only line numbers have been implemented so far. That means single-stepping and stacktraces work just fine, but no variables can be inspected.
-
-- `-size`
-Print size (``none``, ``short``, or ``full``) of the output (linked) binary. Note that the calculated size includes RAM reserved for the stack.
-
-- `none` (default)
-Print nothing.
-
-- `short`
-Print size statistics, roughly like what the ``size`` binutils program would print but with useful flash and RAM columns:
-```
-code data bss | flash ram
-5780 144 2132 | 5924 2276
-```
-
-- `full`
-Try to determine per package how much space is used. Note that these calculations are merely guesses and can somethimes be way off due to various reasons like inlining:
-```
-code rodata data bss | flash ram | package
-876 0 4 0 | 880 4 | (bootstrap)
-38 0 0 0 | 38 0 | device/arm
-0 0 0 66 | 0 66 | machine
-2994 440 124 0 | 3558 124 | main
-948 127 4 1 | 1079 5 | runtime
-4856 567 132 67 | 5555 199 | (sum)
-5780 - 144 2132 | 5924 2276 | (all)
-```
diff --git a/content/usage/subcommands.md b/content/usage/subcommands.md
deleted file mode 100644
index ac9c442b..00000000
--- a/content/usage/subcommands.md
+++ /dev/null
@@ -1,52 +0,0 @@
----
-title: "Subcommands"
-weight: 2
----
-
-TinyGo tries to be similar to the main `go` command in usage. It consists of the following main subcommands:
-
-### build
-Compile the given program. The output binary is specified using the ``-o``
-parameter. The generated file type depends on the extension:
-
-`.o`
-Create a relocatable object file. You can use this option if you don't want to use the TinyGo build system or want to do other custom things.
-
-`.ll`
-Create textual LLVM IR, after optimization. This is mainly useful for debugging.
-
-`.bc`
-Create LLVM bitcode, after optimization. This may be useful for debugging or for linking into other programs using LTO.
-
-`.hex`
-Create an [Intel HEX](https://en.wikipedia.org/wiki/Intel_HEX) file to flash it to a microcontroller.
-
-`.bin`
-Similar, but create a binary file.
-
-`.wasm`
-Compile and link a WebAssembly file.
-
-(all other)
-Compile and link the program into a regular executable. For microcontrollers, it is common to use the .elf file extension to indicate a linked ELF file is generated. For Linux, it is common to build binaries with no extension at all.
-
-### run
-Run the program, either directly on the host or in an emulated environment (depending on `-target`).
-
-### flash
-Flash the program to a microcontroller.
-
-### gdb
-Compile the program, optionally flash it to a microcontroller if it is a remote target, and drop into a GDB shell. From there you can set breakpoints, start the program with `run` or `continue` (`run` for a local program, `continue` for on-chip debugging), single-step, show a backtrace, break and resume the program with Ctrl-C/`continue`, etc. You may need to install extra tools (like `openocd` and `arm-none-eabi-gdb`) to be able to do this. Also, you may need a dedicated debugger to be able to debug certain boards if no debugger is integrated. Some boards (like the BBC micro:bit and most professional evaluation boards) have an integrated debugger.
-
-### clean
-Clean the cache directory, normally stored in `$HOME/.cache/tinygo`. This is not normally needed.
-
-### help
-Print a short summary of the available commands, plus a list of command flags.
-
-### version
-Print the version of the command and the version of the used `$GOROOT`.
-
-### env
-Print a list of environment variables that affect TinyGo (as a shell script). If one or more variable names are given as arguments, env prints the value of each on a new line.
diff --git a/content/webassembly/_index.md b/content/webassembly/_index.md
deleted file mode 100644
index 8b72768b..00000000
--- a/content/webassembly/_index.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-title: "WebAssembly (WASM)"
-chapter: true
-weight: 4
----
-
-# TinyGo and WebAssembly
-
-TinyGo can compile to WebAssembly (WASM) so you can use it to create new browser-based applications.
diff --git a/doc-gen/go.mod b/doc-gen/go.mod
index c8dc4f21..2a20ea6a 100644
--- a/doc-gen/go.mod
+++ b/doc-gen/go.mod
@@ -1,5 +1,12 @@
module github.com/tinygo-org/tinygo-site/doc-gen
-go 1.11
+go 1.23.0
-require golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb
+toolchain go1.24.1
+
+require golang.org/x/tools v0.31.0
+
+require (
+ golang.org/x/mod v0.24.0 // indirect
+ golang.org/x/sync v0.12.0 // indirect
+)
diff --git a/doc-gen/go.sum b/doc-gen/go.sum
index c5564f97..09ebfb8a 100644
--- a/doc-gen/go.sum
+++ b/doc-gen/go.sum
@@ -1,24 +1,8 @@
-github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
-golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb h1:z5+u0pkAUPUWd3taoTialQ2JAMo4Wo1Z3L25U4ZV9r0=
-golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
+golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
+golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
+golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
+golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
+golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
diff --git a/doc-gen/main.go b/doc-gen/main.go
index 6629d89e..592f2211 100644
--- a/doc-gen/main.go
+++ b/doc-gen/main.go
@@ -4,14 +4,16 @@ import (
"bytes"
"fmt"
"go/ast"
- "go/parser"
+ "go/constant"
"go/printer"
"go/token"
- "io"
+ "go/types"
+ "io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
+ "regexp"
"strings"
"text/template"
@@ -35,6 +37,20 @@ type Type struct {
Funcs map[string]*ast.FuncDecl
}
+type Pin struct {
+ HardwareName string
+ OtherNames []string
+ Peripherals map[string][]string
+}
+
+// Match formats:
+// - PA0 (AVR)
+// - PA00 (Microchip SAM series)
+// - P0_00 (nrf series),
+// - GPIO0 (esp series, rp2040)
+// - P00 (sifive)
+var pinIsHardwareName = regexp.MustCompile("^(P[A-Z][0-9]+|P[0-1]_[0-9]{2}|GPIO[0-9]+|P[0-9]{2})$")
+
var markdownTemplateText = `
---
title: {{.Target}}
@@ -82,13 +98,18 @@ title: {{.Target}}
func main() {
// Get the target from the list of command line options.
for _, target := range os.Args[1:] {
+ path := filepath.Join("..", "content", "docs", "reference", "microcontrollers", "machine", target+".md")
+ docPath := filepath.Join("..", "content", "docs", "reference", "microcontrollers", target+".md")
+ if _, err := os.Stat(docPath); err != nil {
+ fmt.Println("Skipping: ", target)
+ continue
+ }
fmt.Println("Generating documentation for:", target)
- path := filepath.Join("..", "content", "microcontrollers", "machine", target+".md")
- writeTargetDoc(target, path)
+ updateDocumentation(target, path, docPath)
}
}
-func writeTargetDoc(target, path string) {
+func updateDocumentation(target, path, docPath string) {
// Get the important information from the compiler.
cmd := exec.Command("tinygo", "info", target)
outBytes, err := cmd.Output()
@@ -97,7 +118,7 @@ func writeTargetDoc(target, path string) {
os.Exit(1)
}
var buildTags []string
- var goos, goarch string
+ var goos, goarch, goroot string
for _, line := range strings.Split(string(outBytes), "\n") {
idx := strings.IndexByte(line, ':')
if idx < 0 {
@@ -112,56 +133,55 @@ func writeTargetDoc(target, path string) {
goos = value
case "GOARCH":
goarch = value
+ case "cached GOROOT":
+ goroot = value
}
}
- if len(buildTags) == 0 || goos == "" || goarch == "" {
- fmt.Fprintln(os.Stderr, "could not find all needed properties (build tags, GOOS, GOARCH)")
- os.Exit(1)
- }
-
- f, err := os.Create(path)
- if err != nil {
- fmt.Fprintln(os.Stderr, "could not open file:", err)
+ if len(buildTags) == 0 || goos == "" || goarch == "" || goroot == "" {
+ fmt.Fprintln(os.Stderr, "could not find all needed properties (build tags, GOOS, GOARCH, GOROOT)")
os.Exit(1)
}
- defer f.Close()
- writeDoc(f, target, buildTags, goos, goarch)
-}
-func writeDoc(out io.Writer, target string, buildTags []string, goos, goarch string) {
// Get the list of files that would be compiled for this package.
pkgs, err := packages.Load(&packages.Config{
- Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles,
+ Mode: packages.NeedName | packages.NeedSyntax | packages.NeedTypes | packages.NeedDeps,
BuildFlags: []string{"-tags=" + strings.Join(buildTags, " ")},
- Env: append(os.Environ(), "GOOS="+goos, "GOARCH="+goarch, "GO111MODULE=off"),
- }, "github.com/tinygo-org/tinygo/src/machine")
+ Env: append(os.Environ(), "GOOS="+goos, "GOARCH="+goarch, "GOROOT="+goroot, "GO111MODULE=off"),
+ }, "machine")
if err != nil {
log.Fatal(err)
}
// Do some sanity checking.
- if len(pkgs[0].Errors) != 0 {
- for _, err := range pkgs[0].Errors {
- fmt.Fprintln(os.Stderr, err)
+ hasError := false
+ for _, err := range pkgs[0].Errors {
+ if err.Kind == packages.TypeError {
+ // Ignore type errors, they happen sometimes because TinyGo CGo is
+ // missing.
+ continue
}
+ hasError = true
+ fmt.Fprintln(os.Stderr, err)
+ }
+ if hasError {
os.Exit(1)
}
- if len(pkgs[0].CompiledGoFiles) == 0 {
- fmt.Fprintln(os.Stderr, "no compiled Go files found for target:", target)
+ pkg := pkgs[0]
+
+ err = writeMachinePackageDoc(path, target, pkg)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(1)
}
- // Parse all to-be-compiled files.
- syntax := make([]*ast.File, len(pkgs[0].CompiledGoFiles))
- fset := token.NewFileSet()
- for i, fileName := range pkgs[0].CompiledGoFiles {
- file, err := parser.ParseFile(fset, fileName, nil, parser.ParseComments)
- if err != nil {
- log.Fatal("failed to parse Go source file:", err)
- }
- syntax[i] = file
+ err = updateBoardDocumentation(docPath, pkg, buildTags)
+ if err != nil {
+ fmt.Fprintln(os.Stderr, "error:", err)
+ os.Exit(1)
}
+}
+func writeMachinePackageDoc(path, target string, pkg *packages.Package) error {
doc := PackageDoc{
Target: target,
Types: make(map[string]*Type),
@@ -169,7 +189,7 @@ func writeDoc(out io.Writer, target string, buildTags []string, goos, goarch str
}
// Read everything except for functions.
- for _, file := range syntax {
+ for _, file := range pkg.Syntax {
for _, decl := range file.Decls {
switch decl := decl.(type) {
case *ast.GenDecl:
@@ -211,7 +231,7 @@ func writeDoc(out io.Writer, target string, buildTags []string, goos, goarch str
// Read functions after types have been read, to attach functions to type
// documentation.
- for _, file := range syntax {
+ for _, file := range pkg.Syntax {
for _, decl := range file.Decls {
switch decl := decl.(type) {
case *ast.FuncDecl:
@@ -230,9 +250,11 @@ func writeDoc(out io.Writer, target string, buildTags []string, goos, goarch str
case *ast.StarExpr:
receiverName = receiver.X.(*ast.Ident).Name
default:
- log.Fatal("unknown receiver for:", decl.Name.Name)
+ return fmt.Errorf("unknown receiver for %s", decl.Name.Name)
+ }
+ if ast.IsExported(receiverName) {
+ doc.Types[receiverName].Funcs[decl.Name.Name] = decl
}
- doc.Types[receiverName].Funcs[decl.Name.Name] = decl
}
}
}
@@ -263,19 +285,398 @@ func writeDoc(out io.Writer, target string, buildTags []string, goos, goarch str
Rparen: n.Rparen,
}
}
- printer.Fprint(w, fset, node)
+ printer.Fprint(w, pkg.Fset, node)
text := string(w.Bytes())
return "```go\n" + text + "\n```\n"
},
"formatReceiver": func(receiver *ast.FieldList) string {
// Special case for formatting the receiver of a method.
w := &bytes.Buffer{}
- printer.Fprint(w, fset, receiver.List[0].Type)
+ printer.Fprint(w, pkg.Fset, receiver.List[0].Type)
return string(w.Bytes())
},
}).Parse(markdownTemplateText))
- err = tpl.Execute(out, doc)
+
+ f, err := os.Create(path)
if err != nil {
- fmt.Fprintln(os.Stderr, "error:", err)
+ return fmt.Errorf("could not open file: %w", err)
+ }
+ defer f.Close()
+
+ return tpl.Execute(f, doc)
+}
+
+func findSection(name, doc string) (start, end int, err error) {
+ start = strings.Index(doc, fmt.Sprintf("## %s\n", name))
+ if start < 0 {
+ return 0, 0, fmt.Errorf("could not find '%s' header", name)
+ }
+ endOffset := strings.Index(doc[start:], "\n## ")
+ if endOffset < 0 {
+ return 0, 0, fmt.Errorf("could not find end of '%s' header", name)
+ }
+ end = start + endOffset
+ return
+}
+
+func updateBoardDocumentation(path string, pkg *packages.Package, buildTags []string) error {
+ features := detectSupportedFeatures(pkg, buildTags)
+
+ // Read the entire Markdown file in memory.
+ docBuf, err := ioutil.ReadFile(path)
+ if err != nil {
+ return fmt.Errorf("could not read Markdown file: %w", err)
+ }
+ doc := string(docBuf)
+
+ // Find "Interfaces" section.
+ start, end, err := findSection("Interfaces", doc)
+ if err != nil {
+ return err
+ }
+
+ // Create new "Interfaces" section based on the previous section.
+ interfacesText := "## Interfaces\n\n| Interface | Hardware Supported | TinyGo Support |\n| --------- | ------------- | ----- |\n"
+ for _, line := range strings.Split(doc[start:end], "\n") {
+ if !strings.HasPrefix(line, "| ") {
+ continue
+ }
+ parts := strings.Split(line, "|")
+ if len(parts) != 5 {
+ return fmt.Errorf("expected 5 parts, got %d", len(parts))
+ }
+ feature := strings.TrimSpace(parts[1])
+ if feature == "Interface" || feature[0] == '-' {
+ // Part of the hearder.
+ continue
+ }
+ hardwareSupport := strings.TrimSpace(parts[2])
+ softwareSupport := strings.TrimSpace(parts[3])
+ if hardwareSupport != "NO" && hardwareSupport != "?" {
+ if supported, ok := features[feature]; ok {
+ if supported {
+ softwareSupport = "YES"
+ } else {
+ softwareSupport = "Not yet"
+ }
+ }
+ }
+ interfacesText += fmt.Sprintf("| %-9s | %-3s | %-3s |\n", feature, hardwareSupport, softwareSupport)
+ }
+
+ // Replace the "Interfaces" section.
+ doc = doc[:start] + interfacesText + doc[end:]
+
+ start, end, err = findSection("Pins", doc)
+ if err == nil {
+ // There is a pins section. Update it from the machine package.
+ pinsText, err := getPinsSection(pkg)
+ if err != nil {
+ return err
+ }
+
+ // Replace the "Pins" section.
+ doc = doc[:start] + pinsText + doc[end:]
+ }
+
+ // Write out the updated documentation.
+ err = ioutil.WriteFile(path+".tmp", []byte(doc), 0o666)
+ if err != nil {
+ return fmt.Errorf("could not write updated Markdown file: %w", err)
+ }
+ err = os.Rename(path+".tmp", path)
+ if err != nil {
+ return fmt.Errorf("could not rename updated Markdown file: %w", err)
+ }
+
+ return nil
+}
+
+// detectSupportedFeatures check whether a given feature is supported by the
+// chip/board based on the available types in the machine package and the build
+// tags used for the compilation.
+func detectSupportedFeatures(pkg *packages.Package, buildTags []string) map[string]bool {
+ features := map[string]bool{
+ "GPIO": false,
+ "UART": false,
+ "SPI": false,
+ "I2C": false,
+ "ADC": false,
+ "PWM": false,
+ "Bluetooth": false,
+ "USBDevice": false,
+ }
+
+ pinType := pkg.Types.Scope().Lookup("Pin").Type()
+ if types.NewMethodSet(pinType).Lookup(pkg.Types, "Get") != nil {
+ // Note: checking the 'Get' method because the 'Set' method is always
+ // implemented (even if it's a no-op).
+ features["GPIO"] = true
+ }
+ if pkg.Types.Scope().Lookup("UART") != nil {
+ features["UART"] = true
+ }
+ if pkg.Types.Scope().Lookup("SPI") != nil {
+ features["SPI"] = true
+ }
+ if pkg.Types.Scope().Lookup("I2C") != nil {
+ features["I2C"] = true
+ }
+ if pkg.Types.Scope().Lookup("ADC") != nil {
+ features["ADC"] = true
+ }
+ for _, tag := range buildTags {
+ if tag == "nrf51" || tag == "nrf52" || tag == "nrf52840" || tag == "nrf52833" {
+ features["Bluetooth"] = true
+ }
+ }
+ if pkg.Types.Scope().Lookup("USBDevice") != nil {
+ features["USBDevice"] = true
+ }
+
+ // Detecting PWM support is a bit more tricky.
+ // We basically iterate over all global variables and check whether they
+ // have Configure method that takes a single PWMConfig struct.
+ for _, file := range pkg.Syntax {
+ for _, decl := range file.Decls {
+ switch decl := decl.(type) {
+ case *ast.GenDecl:
+ if decl.Tok != token.VAR {
+ continue
+ }
+ for _, spec := range decl.Specs {
+ // Found a global variable.
+ spec := spec.(*ast.ValueSpec)
+ name := spec.Names[0].Name
+ if !ast.IsExported(name) {
+ continue
+ }
+ if classifyPeripheral(pkg, name) == "PWM" {
+ features["PWM"] = true
+ }
+ }
+ }
+ }
+ }
+
+ return features
+}
+
+func getPinsSection(pkg *packages.Package) (string, error) {
+ // Find board pin names
+ pinNames := make(map[string]uint64)
+ hardwarePins := make(map[string]struct{})
+ pinPeripherals := make(map[string][]string)
+ variableAssigns := make(map[string][]string)
+ var pinNamesSlice []string
+ for _, file := range pkg.Syntax {
+ for _, decl := range file.Decls {
+ switch decl := decl.(type) {
+ case *ast.GenDecl:
+ if decl.Tok == token.VAR {
+ for _, spec := range decl.Specs {
+ spec := spec.(*ast.ValueSpec)
+ if len(spec.Names) != 1 || len(spec.Values) != 1 {
+ continue
+ }
+ name := spec.Names[0]
+ value := spec.Values[0]
+ if !token.IsExported(name.Name) {
+ continue
+ }
+ if value, ok := value.(*ast.Ident); ok {
+ variableAssigns[value.Name] = append(variableAssigns[value.Name], name.Name)
+ }
+ }
+ }
+ if decl.Tok != token.CONST {
+ continue
+ }
+ for _, spec := range decl.Specs {
+ // Found a constant.
+ spec := spec.(*ast.ValueSpec)
+ name := spec.Names[0].Name
+ if !ast.IsExported(name) {
+ continue
+ }
+ obj := pkg.Types.Scope().Lookup(name)
+ if obj.Type().String() != "machine.Pin" {
+ continue
+ }
+ val, ok := constant.Uint64Val(obj.(*types.Const).Val())
+ if !ok {
+ return "", fmt.Errorf("expected pin %s with value %s to be representable by uint64", name, obj.(*types.Const).Val())
+ }
+ pinNamesSlice = append(pinNamesSlice, name)
+ pinNames[name] = val
+ if isHardwarePin(name, spec.Values) {
+ hardwarePins[name] = struct{}{}
+ comment := strings.TrimSpace(spec.Comment.Text())
+ if strings.HasPrefix(comment, "peripherals: ") {
+ pinPeripherals[name] = strings.Split(strings.TrimPrefix(comment, "peripherals: "), ", ")
+ }
+ }
+ }
+ }
+ }
+ }
+ if _, ok := pinNames["NoPin"]; !ok {
+ return "", fmt.Errorf("could not find NoPin constant")
+ }
+ var exposedPins []*Pin
+ pins := make(map[uint64]*Pin)
+ hasPeripheral := make(map[string]bool)
+ for _, name := range pinNamesSlice {
+ if name == "NoPin" || pinNames[name] == pinNames["NoPin"] {
+ continue
+ }
+ num := pinNames[name]
+ pin, ok := pins[num]
+ if !ok {
+ pin = &Pin{Peripherals: map[string][]string{}}
+ pins[num] = pin
+ }
+ if _, ok := hardwarePins[name]; ok {
+ // Hardware name
+ if pin.HardwareName != "" {
+ return "", fmt.Errorf("duplicate hardware pin name: %s and %s", pin.HardwareName, name)
+ }
+ pin.HardwareName = name
+ for _, peripheral := range pinPeripherals[name] {
+ parts := strings.SplitN(peripheral, " ", 2)
+ peripheralName := parts[0]
+ peripheralSuffix := parts[1]
+ var peripheralType string
+ peripherals := []string{peripheral}
+ if strings.HasPrefix(peripheralName, "I2C") {
+ peripheralType = "I2C"
+ } else if strings.HasPrefix(peripheralName, "sercomI2CM") {
+ peripheralType = "I2C"
+ peripherals = nil
+ for _, name := range variableAssigns[peripheralName] {
+ peripherals = append(peripherals, name+" "+peripheralSuffix)
+ }
+ } else {
+ peripheralType = classifyPeripheral(pkg, peripheralName)
+ }
+ if peripheralType == "I2C" || peripheralType == "PWM" {
+ for _, name := range peripherals {
+ pin.Peripherals[peripheralType] = append(pin.Peripherals[peripheralType], name)
+ hasPeripheral[peripheralType] = true
+ }
+ }
+ }
+ } else {
+ // Other name
+ if len(pin.OtherNames) == 0 {
+ exposedPins = append(exposedPins, pin)
+ }
+ pin.OtherNames = append(pin.OtherNames, name)
+ }
+ }
+
+ pinsText := "## Pins\n\n| Pin | Hardware pin | Alternative names |"
+ if hasPeripheral["I2C"] {
+ pinsText += " I2C |"
+ }
+ if hasPeripheral["PWM"] {
+ pinsText += " PWM |"
+ }
+ pinsText += "\n| ----------------- | ------------ | ----------------- |"
+ for range hasPeripheral {
+ pinsText += " -------------------- |"
+ }
+ pinsText += "\n"
+ for _, pin := range exposedPins {
+ if pin.HardwareName == "" {
+ return "", fmt.Errorf("could not find hardware pin name for %s", pin.OtherNames[0])
+ }
+ alternativeNames := make([]string, 0, len(pin.OtherNames)-1)
+ for _, name := range pin.OtherNames[1:] {
+ alternativeNames = append(alternativeNames, "`"+name+"`")
+ }
+ pinsText += fmt.Sprintf("| %-17s | %-12s | %-17s |", "`"+pin.OtherNames[0]+"`", "`"+pin.HardwareName+"`", strings.Join(alternativeNames, ", "))
+ for _, peripheralType := range []string{"I2C", "PWM"} {
+ if !hasPeripheral[peripheralType] {
+ continue
+ }
+ var peripherals []string
+ for _, peripheral := range pin.Peripherals[peripheralType] {
+ parts := strings.SplitN(peripheral, " ", 2)
+ s := "`" + parts[0] + "` (" + parts[1] + ")"
+ s = strings.ReplaceAll(s, " ", "\u00a0") // use non-breaking space
+ peripherals = append(peripherals, s)
+ }
+ pinsText += fmt.Sprintf(" %-20s |", strings.Join(peripherals, ", "))
+ }
+ pinsText += "\n"
+ }
+
+ return pinsText, nil
+}
+
+// Return whether this pin looks like a hardware pin name. A hardware pin
+// constant is a constant like PB02 on the Arduino: a constant defined by the
+// chip, and not the board (which would be pin 13, D13, or the LED pin).
+func isHardwarePin(name string, values []ast.Expr) bool {
+ if !pinIsHardwareName.MatchString(name) {
+ return false
+ }
+ if len(values) == 0 {
+ // Pin constant is probably part of a constant like this:
+ // const (
+ // GPIO0 Pin = iota
+ // GPIO1
+ // GPIO2
+ // // etc
+ // )
+ return true
+ }
+ switch value := values[0].(type) {
+ case *ast.BasicLit:
+ // For example:
+ // const GPIO5 Pin = 5
+ return true
+ case *ast.BinaryExpr:
+ // For example:
+ // const PB02 = portB + 2
+ return true
+ case *ast.Ident:
+ if value.Name == "iota" {
+ // Pins are initialized using the special identifier "iota".
+ return true
+ }
+ // Doesn't look like a hardware pin, could be something like:
+ // const D13 = PB5
+ return false
+ default:
+ return false
+ }
+}
+
+// Return the peripheral type for a given peripheral name, by looking at the
+// type of the global.
+func classifyPeripheral(pkg *packages.Package, name string) string {
+ global := pkg.Types.Scope().Lookup(name)
+ if global == nil {
+ // The peripheral is not available.
+ // This sometimes happen when the pins are defined for a chip family but
+ // some chips don't have all the peripherals.
+ return ""
+ }
+
+ // Check for Configure method. Most peripherals have one.
+ configureMethod := types.NewMethodSet(global.Type()).Lookup(pkg.Types, "Configure")
+ if configureMethod == nil {
+ return ""
+ }
+
+ // Check whether it has just one parameter and this parameter is of type
+ // PWMConfig.
+ params := configureMethod.Type().(*types.Signature).Params()
+ if params.Len() == 1 && params.At(0).Type() == pkg.Types.Scope().Lookup("PWMConfig").Type() {
+ return "PWM"
}
+ // Some other kind of peripheral.
+ return ""
}
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..06e2e431
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module github.com/tinygo-org/tinygo-site
+
+go 1.22
+
+require github.com/google/docsy v0.11.0 // indirect
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..558b7c83
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,4 @@
+github.com/FortAwesome/Font-Awesome v0.0.0-20240716171331-37eff7fa00de/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
+github.com/google/docsy v0.11.0 h1:QnV40cc28QwS++kP9qINtrIv4hlASruhC/K3FqkHAmM=
+github.com/google/docsy v0.11.0/go.mod h1:hGGW0OjNuG5ZbH5JRtALY3yvN8ybbEP/v2iaK4bwOUI=
+github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
diff --git a/hugo.toml b/hugo.toml
new file mode 100644
index 00000000..c39a0bab
--- /dev/null
+++ b/hugo.toml
@@ -0,0 +1,105 @@
+baseURL = "https://tinygo.org/"
+title = "TinyGo"
+languageCode = "en"
+
+theme = "github.com/google/docsy"
+
+enableGitInfo = true
+
+## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
+[blackfriday]
+plainIDAnchors = true
+hrefTargetBlank = true
+angledQuotes = false
+latexDashes = true
+
+# Image processing configuration.
+[imaging]
+resampleFilter = "CatmullRom"
+quality = 75
+anchor = "smart"
+
+[markup.highlight]
+noClasses = false
+
+[markup.goldmark.renderer]
+unsafe = true
+
+# Everything below this are Site Params
+[params]
+copyright = "The TinyGo Authors"
+description = "A Go compiler for small places"
+
+# Google Custom Search Engine ID. Remove or comment out to disable search.
+gcs_engine_id = "feba5f0a3db52897d"
+
+# Enable Algolia DocSearch
+# algolia_docsearch = true
+
+# Repository configuration (URLs for in-page links to opening issues and suggesting changes)
+github_repo = "https://github.com/tinygo-org/tinygo-site"
+# An optional link to a related project repo. For example, the sibling repository where your product code lives.
+github_project_repo = "https://github.com/tinygo-org/tinygo"
+github_branch= "release"
+
+
+# User interface configuration
+[params.ui]
+# Enable to show the side bar menu in its compact state.
+sidebar_menu_compact = true
+# Set to true to disable breadcrumb navigation.
+breadcrumb_disable = false
+# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
+sidebar_search_disable = true
+# Set to false if you don't want to display a logo (/assets/icons/logo.svg) in the top nav bar
+navbar_logo = true
+# Set the maximum number of menus to be displayed in the sidebar
+sidebar_menu_truncate = 1000
+# Show a menu to the left of the search menu to toggle light/dark mode (or set it to auto).
+showLightDarkModeMenu = true
+
+[params.links]
+# End user relevant links. These will show up on left side of footer and in the community page if you have one.
+[[params.links.user]]
+ name ="Mastodon"
+ url = "https://mastodon.social/@TinyGo"
+ icon = "fab fa-mastodon"
+ desc = "Follow us on Mastodon to get the latest news!"
+[[params.links.user]]
+ name ="Bluesky"
+ url = "https://bsky.app/profile/tinygo.org"
+ icon = "fab fa-bluesky"
+ desc = "You can also follow us on Bluesky"
+[[params.links.user]]
+ name ="Go Pkg Docs"
+ url = "https://pkg.go.dev/github.com/tinygo-org/tinygo?tab=doc"
+ icon = "fa fa-book"
+ desc = "Package Documentation"
+# Developer relevant links. These will show up on right side of footer and in the community page if you have one.
+[[params.links.developer]]
+ name = "GitHub"
+ url = "https://github.com/tinygo-org/tinygo"
+ icon = "fab fa-github"
+ desc = "Development takes place here!"
+[[params.links.developer]]
+ name = "Slack"
+ url = "https://gophers.slack.com/messages/CDJD3SUP6/"
+ icon = "fab fa-slack"
+ desc = "Chat with other project developers"
+
+[params.mermaid]
+enable = true
+
+[params.path_base_for_github_subdir]
+# change content//... to content/...
+from = "content/(.*?)/(.*?)"
+to = "content/$2"
+
+# Add some extra headers to the development server.
+# This is only relevant with `hugo serve`.
+[server]
+[[server.headers]]
+ for = '/**'
+ [server.headers.values]
+ Cross-Origin-Opener-Policy = "same-origin"
+ Cross-Origin-Embedder-Policy = "require-corp"
diff --git a/imports/Makefile b/imports/Makefile
index 4f6b5103..6131e405 100644
--- a/imports/Makefile
+++ b/imports/Makefile
@@ -1,3 +1,3 @@
all:
- go run . > ../content/lang-support/stdlib.md
+ go run . > ../content/docs/reference/lang-support/stdlib.md
diff --git a/imports/go.mod b/imports/go.mod
new file mode 100644
index 00000000..5e336938
--- /dev/null
+++ b/imports/go.mod
@@ -0,0 +1,3 @@
+module github.com/tinygo-org/tinygo-site/imports
+
+go 1.16
diff --git a/imports/main.go b/imports/main.go
index 4f0eb0d6..455d9117 100644
--- a/imports/main.go
+++ b/imports/main.go
@@ -2,18 +2,23 @@ package main
import (
"bytes"
- "errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
+ "path/filepath"
"runtime"
"strings"
"text/template"
)
+const (
+ testGOOS = "linux"
+ testGOARCH = "amd64"
+)
+
// The environment to pass to `go` commands when they are invoked.
-var commandEnv = []string{"GOPATH=/does-not-exist", "GOOS=js", "GOARCH=wasm"}
+var commandEnv = []string{"GOPATH=/does-not-exist", "GO111MODULE=off", "GOOS=" + testGOOS, "GOARCH=" + testGOARCH}
var markdownTemplate = template.Must(template.New("markdown").Parse(`
---
@@ -24,18 +29,24 @@ The following table shows all Go standard library packages and whether they can
Note that the fact they can be imported, does not mean that all functions and types in the program can be used. For example, sometimes using some functions or types of the package will still trigger compiler errors.
-Package | Importable
---- | --- |{{ range .}}
-{{.Path}} | {{if .CanBeCompiled}} ✔ yes {{else}} [✗ no](#{{.Link}}) {{end}} | {{ end }}
+Test results are for {{.goos}}/{{.goarch}}.
+
+Package | Importable | Passes tests
+--- | --- | --- |{{ range .pkgs}}
+{{.Path}} | {{if .CanBeCompiled}} ✔ yes {{else}} [✗ no](#{{.Link}}) {{end}} | {{if .PassesTests}} ✔ yes {{else if .CanBeCompiled}} [✗ no](#{{.Link}}) {{else}} ✗ no {{end}} | {{ end }}
-{{range .}}
-{{if not .CanBeCompiled}}
+{{range .pkgs}}
+{{if not .PassesTests }}
## {{.Path}}
{{if .Output}}
+{{if .CanBeCompiled}}
+The compiler gave the following error when running the tests for this package:
+{{else}}
The compiler gave the following error when this package was imported:
+{{end}}
-{{.Output}}
+{{.IndentedOutput}}
{{else if .Imports}}
This package cannot be imported because the following dependencies cannot be compiled:
{{range .Imports}}{{if not .CanBeCompiled}}
@@ -52,6 +63,8 @@ type Package struct {
Imports []*Package
Output string
CanBeCompiled bool
+ PassesTests bool
+ Compiling bool
}
func (p *Package) AllImportsCanCompile() bool {
@@ -63,19 +76,45 @@ func (p *Package) AllImportsCanCompile() bool {
return true
}
-// Link returns the link name to a header with the path as title. Hugo replaces
-// slashes with dashes so we emulate that behavior.
+// Link returns the link name to a header with the path as title. Hugo/Docsy removes
+// slashes so we emulate that behavior.
func (p *Package) Link() string {
- return strings.Replace(p.Path, "/", "-", -1)
+ return strings.Replace(p.Path, "/", "", -1)
+}
+
+// IndentedOutput returns the Output variable but indented by 4 characters, so
+// that it is valid Markdown raw output.
+func (p *Package) IndentedOutput() string {
+ // Remove last newline.
+ output := strings.TrimSpace(p.Output)
+ // Add indentation for all lines (except the last of course).
+ output = " " + strings.ReplaceAll(output, "\n", "\n ")
+ // Add last newline again.
+ output += "\n"
+
+ return output
+}
+
+// testResult is returned by runTest. It's necessary to communicate the test
+// result back over a channel from a separate test runner goroutine.
+type testResult struct {
+ pkg *Package
+ compiles bool
+ compilerOutput string
+ passesTest bool
+ testOutput string
}
func checkPackages(goroot string) error {
fmt.Fprintln(os.Stderr, "gathering a list of packages...")
+ baseDir := filepath.Join(goroot, "src")
+
// Get a list of all standard library packages.
pkgsList := new(bytes.Buffer)
- cmd := exec.Command("go", "list", "all")
+ cmd := exec.Command("go", "list", "std")
cmd.Env = append(os.Environ(), commandEnv...)
+ cmd.Dir = baseDir
cmd.Stdout = pkgsList
if err := cmd.Run(); err != nil {
return err
@@ -104,6 +143,7 @@ func checkPackages(goroot string) error {
for _, pkg := range pkgs {
cmd := exec.Command("go", "list", "-f", `{{ join .Imports "\n" }}`, pkg.Path)
buf := new(bytes.Buffer)
+ cmd.Dir = baseDir
cmd.Env = append(os.Environ(), commandEnv...)
cmd.Stdout = buf
err := cmd.Run()
@@ -121,50 +161,142 @@ func checkPackages(goroot string) error {
}
}
+ testInput := make(chan *Package, 1)
+ testOutput := make(chan testResult)
+ for i := runtime.NumCPU(); i != 0; i-- {
+ go func() {
+ for pkg := range testInput {
+ testOutput <- pkg.runTest()
+ }
+ }()
+ }
+
+ // Keep track how many tests are in flight, reaching zero means all tests
+ // have been run.
+ var testsInFlights int
+
// Try to compile each package of which all imports can be compiled.
- hasProgress := true
- for hasProgress {
- // Continue looping until no progress can be made. At that point, all
- // packages have been checked.
- hasProgress = false
- for _, pkg := range pkgs {
- if pkg.CanBeCompiled || pkg.Output != "" || !pkg.AllImportsCanCompile() {
- // Already tested or one of the dependencies failed.
- continue
+ for {
+ // Fill pipeline of packages, as far as possible (possibly zero at the
+ // end).
+ for {
+ inputPkg := nextPackageToTest(pkgs)
+ if inputPkg == nil {
+ // All packages have been tested.
+ break
}
- hasProgress = true
-
- fmt.Fprintf(os.Stderr, "%-30s", pkg.Path)
- temporaryGoFile := "/tmp/tinygo-test.go"
- ioutil.WriteFile(temporaryGoFile, []byte(fmt.Sprintf("package main\nimport _ \"%s\"\nfunc main(){}\n", pkg.Path)), 0600)
-
- cmd := exec.Command("tinygo", "build", "-o", "/tmp/tinygo-test-build.wasm", temporaryGoFile)
- buf := new(bytes.Buffer)
- cmd.Stdout = buf
- cmd.Stderr = buf
- if cmd.Run() != nil {
- // There was an error importing this package.
- fmt.Fprintf(os.Stderr, "fail\n")
- msg := string(buf.Bytes())
- if len(msg) == 0 {
- return errors.New("tinygo exited with error but without any output!")
- }
- lines := strings.Split(msg, "\n")
- if len(lines) > 15 {
- msg = strings.Join(lines[:15], "\n") + "\n[...more lines following...]"
- }
- pkg.Output = msg
- } else {
- // This package could be compiled!
- fmt.Fprintf(os.Stderr, "ok\n")
- pkg.CanBeCompiled = true
+ success := false
+ select {
+ case testInput <- inputPkg:
+ inputPkg.Compiling = true
+ success = true
+ testsInFlights++
+ default:
+ }
+ if !success {
+ break
+ }
+ }
+
+ if testsInFlights == 0 {
+ break
+ }
+
+ // Receive one result and process it.
+ result := <-testOutput
+ result.pkg.Compiling = false
+ testsInFlights--
+ if !result.compiles {
+ // There was an error importing this package.
+ fmt.Fprintf(os.Stderr, "%-30s does not compile\n", result.pkg.Path)
+ msg := result.compilerOutput
+ if len(msg) == 0 {
+ msg = "[...no output...]" // should not happen
+ }
+ lines := strings.Split(msg, "\n")
+ if len(lines) > 15 {
+ msg = strings.Join(lines[:15], "\n") + "\n[...more lines following...]"
}
+ result.pkg.Output = msg
+ } else if !result.passesTest {
+ // There was an error running the tests for this package.
+ fmt.Fprintf(os.Stderr, "%-30s fails tests\n", result.pkg.Path)
+ msg := result.testOutput
+ if len(msg) == 0 {
+ msg = "[...no test output...]" // should definitely not happen
+ }
+ lines := strings.Split(msg, "\n")
+ if len(lines) > 15 {
+ msg = strings.Join(lines[:15], "\n") + "\n[...more lines following...]"
+ }
+ result.pkg.Output = msg
+ result.pkg.CanBeCompiled = true
+ } else {
+ // This package passes all tests!
+ fmt.Fprintf(os.Stderr, "%-30s ok\n", result.pkg.Path)
+ result.pkg.CanBeCompiled = true
+ result.pkg.PassesTests = true
}
}
// Print the output to stdout.
- return markdownTemplate.Execute(os.Stdout, pkgMap)
+ return markdownTemplate.Execute(os.Stdout, map[string]interface{}{
+ "pkgs": pkgMap,
+ "goos": testGOOS,
+ "goarch": testGOARCH,
+ })
+}
+
+func (pkg *Package) runTest() (result testResult) {
+ result.pkg = pkg
+
+ // Prepare test files.
+ dir, err := ioutil.TempDir("", "tinygo-test-*")
+ if err != nil {
+ panic("could not create temporary directory: " + err.Error())
+ }
+ defer os.RemoveAll(dir)
+ temporaryGoFile := filepath.Join(dir, "main.go")
+ ioutil.WriteFile(temporaryGoFile, []byte(fmt.Sprintf("package main\nimport _ \"%s\"\nfunc main(){}\n", pkg.Path)), 0600)
+ temporaryExecutableFile := filepath.Join(dir, "main")
+
+ // Run the compile test.
+ cmd := exec.Command("tinygo", "build", "-o", temporaryExecutableFile, temporaryGoFile)
+ cmd.Env = append(cmd.Environ(), "GOOS="+testGOOS, "GOARCH="+testGOARCH)
+ buf := new(bytes.Buffer)
+ cmd.Stdout = buf
+ cmd.Stderr = buf
+ result.compiles = cmd.Run() == nil
+ result.compilerOutput = string(buf.Bytes())
+
+ // Run the actual test.
+ if result.compiles {
+ cmd := exec.Command("tinygo", "test", pkg.Path)
+ cmd.Env = append(cmd.Environ(), "GOOS="+testGOOS, "GOARCH="+testGOARCH)
+ buf := new(bytes.Buffer)
+ cmd.Stdout = buf
+ cmd.Stderr = buf
+ result.passesTest = cmd.Run() == nil
+ result.testOutput = string(buf.Bytes())
+ }
+
+ return
+}
+
+// nextPackageToTest returns the next package to test, or nil if there is no
+// available package to test.
+// While there are tests in flight, this function might return nil even though
+// there are packages available for testing.
+func nextPackageToTest(pkgs []*Package) *Package {
+ for _, pkg := range pkgs {
+ if pkg.CanBeCompiled || pkg.Compiling || pkg.Output != "" || !pkg.AllImportsCanCompile() {
+ // Already tested or one of the dependencies failed.
+ continue
+ }
+ return pkg
+ }
+ return nil
}
func shouldTestPackage(path string) bool {
@@ -172,6 +304,11 @@ func shouldTestPackage(path string) bool {
return false
}
+ if path == "C" {
+ // Skip CGo pseudo-package.
+ return false
+ }
+
if path == "runtime" || strings.HasPrefix(path, "runtime/") {
// Compiler-specific package.
return false
diff --git a/layouts/partials/hooks/body-end.html b/layouts/partials/hooks/body-end.html
new file mode 100644
index 00000000..3b4a7ec8
--- /dev/null
+++ b/layouts/partials/hooks/body-end.html
@@ -0,0 +1,8 @@
+
+
diff --git a/layouts/partials/hooks/head-end.html b/layouts/partials/hooks/head-end.html
new file mode 100644
index 00000000..bc6a1cdb
--- /dev/null
+++ b/layouts/partials/hooks/head-end.html
@@ -0,0 +1 @@
+
diff --git a/layouts/partials/logo.html b/layouts/partials/logo.html
deleted file mode 100644
index cb2e150d..00000000
--- a/layouts/partials/logo.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-TinyGo Go Compiler For Small Places
-
diff --git a/layouts/partials/menu-footer.html b/layouts/partials/menu-footer.html
deleted file mode 100644
index ff631eb1..00000000
--- a/layouts/partials/menu-footer.html
+++ /dev/null
@@ -1,9 +0,0 @@
-Please give TinyGo a star!
-
- Star
- Fork
-
- Site built with Hugo
-
-
-
\ No newline at end of file
diff --git a/layouts/tour/baseof.html b/layouts/tour/baseof.html
new file mode 100644
index 00000000..d6e3398a
--- /dev/null
+++ b/layouts/tour/baseof.html
@@ -0,0 +1,56 @@
+
+
+
+ {{ partial "head.html" . }}
+
+
+
+
+
+
+ {{ partial "navbar.html" . }}
+
+
+
+
+
+
+
+
+ {{ partial "version-banner.html" . }}
+ {{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
+ {{ block "main" . }}{{ end }}
+
+
+
+
+
+
+ ...
+
+
+
Reset
+
Flash
+
+
+
+ {{ readFile "/simulator/simulator.md" | safeHTML }}
+
+
+
+
+
+
+ {{ partial "footer.html" . }}
+
+ {{ partial "scripts.html" . }}
+
+
diff --git a/layouts/tour/single.html b/layouts/tour/single.html
new file mode 100644
index 00000000..49bb662a
--- /dev/null
+++ b/layouts/tour/single.html
@@ -0,0 +1,3 @@
+{{ define "main" }}
+{{ .Render "content" }}
+{{ end }}
diff --git a/netlify.toml b/netlify.toml
index d650a0f1..52e3dd6d 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,5 +1,33 @@
# netlify.toml
+# Default build settings
+[build]
+ command = "hugo"
+
+# "production" environment specific build settings
+[build.environment]
+ NODE_VERSION = "20.16.0" # LTS version
+ HUGO_VERSION = "0.133.1"
+ GO_VERSION = "1.22.x" # any reasonably recent version
+
+# "production" environment specific build settings
+[context.release.environment]
+ HUGO_ENV = "production"
+
+# Required for the playground (it needs SharedArrayBuffer).
+[[headers]]
+ for = "/*"
+ [headers.values]
+ Cross-Origin-Opener-Policy = "same-origin"
+ Cross-Origin-Embedder-Policy = "require-corp"
+
+# Internal redirect for playground share URLs.
+[[redirects]]
+ force = false
+ from = "/play/s/*"
+ to = "/play/"
+ status = 200
+
[[redirects]]
from = "/bluetooth"
to = "https://github.com/tinygo-org/bluetooth#go-bluetooth"
@@ -9,3 +37,98 @@
from = "https://bluetooth.tinygo.org"
to = "https://github.com/tinygo-org/bluetooth#go-bluetooth"
status = 301
+
+[[redirects]]
+ from = "/compiler-internals/*"
+ to = "/docs/concepts/compiler-internals/:splat"
+ status = 301
+
+[[redirects]]
+ from = "/faq/*"
+ to = "/docs/concepts/faq/:splat"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers"
+ to = "/docs/reference/microcontrollers"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/arduino-nano33-iot"
+ to = "/docs/reference/microcontrollers/arduino-nano33"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/arduino-uno"
+ to = "/docs/reference/microcontrollers/arduino"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/circuit-playground-bluefruit"
+ to = "/docs/reference/microcontrollers/circuitplay-bluefruit"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/circuit-playground-express"
+ to = "/docs/reference/microcontrollers/circuitplay-express"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/esp8266-d1mini"
+ to = "/docs/reference/microcontrollers/d1mini"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/dragino-lgt92"
+ to = "/docs/reference/microcontrollers/lgt-92"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/bbc-microbit"
+ to = "/docs/reference/microcontrollers/microbit"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/nintendo-switch"
+ to = "/docs/reference/microcontrollers/nintendoswitch"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/esp8266-nodemcu"
+ to = "/docs/reference/microcontrollers/nodemcu"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/stm32-nucleo-f722ze"
+ to = "/docs/reference/microcontrollers/nucleo-f722ze"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/pinetime"
+ to = "/docs/reference/microcontrollers/pinetime-devkit0"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/stm32f4discovery"
+ to = "/docs/reference/microcontrollers/stm32f4disco"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/stm32-nucleo-l552ze"
+ to = "/docs/reference/microcontrollers/stm32nucleol552ze"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/x9-pro"
+ to = "/docs/reference/microcontrollers/x9pro"
+ status = 301
+
+[[redirects]]
+ from = "/microcontrollers/*"
+ to = "/docs/reference/microcontrollers/:splat"
+ status = 301
+
+[[redirects]]
+ from = "/lang-support/*"
+ to = "/docs/reference/lang-support/:splat"
+ status = 301
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000..0b1f1a63
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1048 @@
+{
+ "name": "tinygo-site",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "tinygo-site",
+ "version": "1.0.0",
+ "license": "ISC",
+ "devDependencies": {
+ "autoprefixer": "^10.4.19",
+ "postcss": "^8.4.40",
+ "postcss-cli": "^11.0.0"
+ }
+ },
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dev": true,
+ "dependencies": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "dev": true,
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "dev": true,
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@sindresorhus/merge-streams": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz",
+ "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
+ "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
+ "dev": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/autoprefixer": {
+ "version": "10.4.19",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz",
+ "integrity": "sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/autoprefixer"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "browserslist": "^4.23.0",
+ "caniuse-lite": "^1.0.30001599",
+ "fraction.js": "^4.3.7",
+ "normalize-range": "^0.1.2",
+ "picocolors": "^1.0.0",
+ "postcss-value-parser": "^4.2.0"
+ },
+ "bin": {
+ "autoprefixer": "bin/autoprefixer"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ },
+ "peerDependencies": {
+ "postcss": "^8.1.0"
+ }
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
+ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.23.2",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.2.tgz",
+ "integrity": "sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "caniuse-lite": "^1.0.30001640",
+ "electron-to-chromium": "^1.4.820",
+ "node-releases": "^2.0.14",
+ "update-browserslist-db": "^1.1.0"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001643",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz",
+ "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ]
+ },
+ "node_modules/chokidar": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
+ "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
+ "dev": true,
+ "dependencies": {
+ "anymatch": "~3.1.1",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.0",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.5.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.1"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "node_modules/colorette": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz",
+ "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==",
+ "dev": true
+ },
+ "node_modules/dependency-graph": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.11.0.tgz",
+ "integrity": "sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6.0"
+ }
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.1.tgz",
+ "integrity": "sha512-FKbOCOQ5QRB3VlIbl1LZQefWIYwszlBloaXcY2rbfpu9ioJnNh3TK03YtIDKDo3WKBi8u+YV4+Fn2CkEozgf4w==",
+ "dev": true
+ },
+ "node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
+ "node_modules/escalade": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
+ "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/fast-glob": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
+ "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
+ "dev": true,
+ "dependencies": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=8.6.0"
+ }
+ },
+ "node_modules/fastq": {
+ "version": "1.17.1",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz",
+ "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==",
+ "dev": true,
+ "dependencies": {
+ "reusify": "^1.0.4"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/fraction.js": {
+ "version": "4.3.7",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
+ "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "type": "patreon",
+ "url": "https://github.com/sponsors/rawify"
+ }
+ },
+ "node_modules/fs-extra": {
+ "version": "11.2.0",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
+ "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.14"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/get-stdin": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz",
+ "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/globby": {
+ "version": "14.0.2",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz",
+ "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==",
+ "dev": true,
+ "dependencies": {
+ "@sindresorhus/merge-streams": "^2.1.0",
+ "fast-glob": "^3.3.2",
+ "ignore": "^5.2.4",
+ "path-type": "^5.0.0",
+ "slash": "^5.1.0",
+ "unicorn-magic": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.2.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+ "dev": true
+ },
+ "node_modules/ignore": {
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz",
+ "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
+ "dev": true,
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/jsonfile": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+ "dev": true,
+ "dependencies": {
+ "universalify": "^2.0.0"
+ },
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/lilconfig": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz",
+ "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==",
+ "dev": true,
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antonk52"
+ }
+ },
+ "node_modules/lodash.difference": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz",
+ "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=",
+ "dev": true
+ },
+ "node_modules/lodash.forown": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/lodash.forown/-/lodash.forown-4.4.0.tgz",
+ "integrity": "sha1-hRFc8E9z75ZuztUlEdOJPMRmg68=",
+ "dev": true
+ },
+ "node_modules/lodash.get": {
+ "version": "4.4.2",
+ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
+ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",
+ "dev": true
+ },
+ "node_modules/lodash.groupby": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/lodash.groupby/-/lodash.groupby-4.6.0.tgz",
+ "integrity": "sha1-Cwih3PaDl8OXhVwyOXg4Mt90A9E=",
+ "dev": true
+ },
+ "node_modules/lodash.sortby": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
+ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
+ "dev": true
+ },
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "dev": true,
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz",
+ "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
+ "dev": true,
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.7",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
+ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.18",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
+ "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==",
+ "dev": true
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/normalize-range": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
+ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/path-type": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz",
+ "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
+ "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
+ "dev": true
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.4.40",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz",
+ "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "nanoid": "^3.3.7",
+ "picocolors": "^1.0.1",
+ "source-map-js": "^1.2.0"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/postcss-cli": {
+ "version": "11.0.0",
+ "resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-11.0.0.tgz",
+ "integrity": "sha512-xMITAI7M0u1yolVcXJ9XTZiO9aO49mcoKQy6pCDFdMh9kGqhzLVpWxeD/32M/QBmkhcGypZFFOLNLmIW4Pg4RA==",
+ "dev": true,
+ "dependencies": {
+ "chokidar": "^3.3.0",
+ "dependency-graph": "^0.11.0",
+ "fs-extra": "^11.0.0",
+ "get-stdin": "^9.0.0",
+ "globby": "^14.0.0",
+ "picocolors": "^1.0.0",
+ "postcss-load-config": "^5.0.0",
+ "postcss-reporter": "^7.0.0",
+ "pretty-hrtime": "^1.0.3",
+ "read-cache": "^1.0.0",
+ "slash": "^5.0.0",
+ "yargs": "^17.0.0"
+ },
+ "bin": {
+ "postcss": "index.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "postcss": "^8.0.0"
+ }
+ },
+ "node_modules/postcss-load-config": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-5.1.0.tgz",
+ "integrity": "sha512-G5AJ+IX0aD0dygOE0yFZQ/huFFMSNneyfp0e3/bT05a8OfPC5FUoZRPfGijUdGOJNMewJiwzcHJXFafFzeKFVA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "lilconfig": "^3.1.1",
+ "yaml": "^2.4.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "jiti": ">=1.21.0",
+ "postcss": ">=8.0.9",
+ "tsx": "^4.8.1"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/postcss-reporter": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/postcss-reporter/-/postcss-reporter-7.0.2.tgz",
+ "integrity": "sha512-JyQ96NTQQsso42y6L1H1RqHfWH1C3Jr0pt91mVv5IdYddZAE9DUZxuferNgk6q0o6vBVOrfVJb10X1FgDzjmDw==",
+ "dev": true,
+ "dependencies": {
+ "colorette": "^1.2.1",
+ "lodash.difference": "^4.5.0",
+ "lodash.forown": "^4.4.0",
+ "lodash.get": "^4.4.2",
+ "lodash.groupby": "^4.6.0",
+ "lodash.sortby": "^4.7.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ "peerDependencies": {
+ "postcss": "^8.1.0"
+ }
+ },
+ "node_modules/postcss-value-parser": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
+ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
+ "dev": true
+ },
+ "node_modules/pretty-hrtime": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
+ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "node_modules/read-cache": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
+ "integrity": "sha1-5mTvMRYRZsl1HNvo28+GtftY93Q=",
+ "dev": true,
+ "dependencies": {
+ "pify": "^2.3.0"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
+ "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
+ "dev": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/reusify": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
+ "dev": true,
+ "engines": {
+ "iojs": ">=1.0.0",
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "dependencies": {
+ "queue-microtask": "^1.2.2"
+ }
+ },
+ "node_modules/slash": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz",
+ "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==",
+ "dev": true,
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
+ "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/unicorn-magic": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz",
+ "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/universalify": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
+ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 10.0.0"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz",
+ "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "escalade": "^3.1.2",
+ "picocolors": "^1.0.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yaml": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
+ "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==",
+ "dev": true,
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "dev": true,
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..35ba87e9
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "tinygo-site",
+ "version": "1.0.0",
+ "description": "TinyGo website",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "autoprefixer": "^10.4.19",
+ "postcss": "^8.4.40",
+ "postcss-cli": "^11.0.0"
+ },
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/tinygo-org/tinygo-site.git"
+ },
+ "author": "",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/tinygo-org/tinygo-site/issues"
+ },
+ "homepage": "https://github.com/tinygo-org/tinygo-site#readme"
+}
diff --git a/static/favicons/_head.html b/static/favicons/_head.html
new file mode 100644
index 00000000..08692eec
--- /dev/null
+++ b/static/favicons/_head.html
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/static/favicons/apple-touch-icon-180x180.png b/static/favicons/apple-touch-icon-180x180.png
new file mode 100644
index 00000000..d44aa030
Binary files /dev/null and b/static/favicons/apple-touch-icon-180x180.png differ
diff --git a/static/favicons/browserconfig.xml b/static/favicons/browserconfig.xml
new file mode 100644
index 00000000..85cb4cc4
--- /dev/null
+++ b/static/favicons/browserconfig.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+ transparent
+
+
+
\ No newline at end of file
diff --git a/static/favicons/favicon-16x16.png b/static/favicons/favicon-16x16.png
new file mode 100644
index 00000000..dd90713f
Binary files /dev/null and b/static/favicons/favicon-16x16.png differ
diff --git a/static/favicons/favicon-32x32.png b/static/favicons/favicon-32x32.png
new file mode 100644
index 00000000..7af273c7
Binary files /dev/null and b/static/favicons/favicon-32x32.png differ
diff --git a/static/favicons/favicon.ico b/static/favicons/favicon.ico
new file mode 100644
index 00000000..067d2a60
Binary files /dev/null and b/static/favicons/favicon.ico differ
diff --git a/static/favicons/pwa-192x192.png b/static/favicons/pwa-192x192.png
new file mode 100644
index 00000000..51536ee5
Binary files /dev/null and b/static/favicons/pwa-192x192.png differ
diff --git a/static/favicons/pwa-512x512.png b/static/favicons/pwa-512x512.png
new file mode 100644
index 00000000..54d668db
Binary files /dev/null and b/static/favicons/pwa-512x512.png differ
diff --git a/static/favicons/tile150x150.png b/static/favicons/tile150x150.png
new file mode 100644
index 00000000..3a49d0d5
Binary files /dev/null and b/static/favicons/tile150x150.png differ
diff --git a/static/favicons/tile310x150.png b/static/favicons/tile310x150.png
new file mode 100644
index 00000000..c4992826
Binary files /dev/null and b/static/favicons/tile310x150.png differ
diff --git a/static/favicons/tile310x310.png b/static/favicons/tile310x310.png
new file mode 100644
index 00000000..ff0f7260
Binary files /dev/null and b/static/favicons/tile310x310.png differ
diff --git a/static/favicons/tile70x70.png b/static/favicons/tile70x70.png
new file mode 100644
index 00000000..02704979
Binary files /dev/null and b/static/favicons/tile70x70.png differ
diff --git a/static/images/i2c-lis3dh-acceldata.png b/static/images/i2c-lis3dh-acceldata.png
new file mode 100644
index 00000000..ce92b0fd
Binary files /dev/null and b/static/images/i2c-lis3dh-acceldata.png differ
diff --git a/static/images/i2c-lis3dh-config.png b/static/images/i2c-lis3dh-config.png
new file mode 100644
index 00000000..590ee923
Binary files /dev/null and b/static/images/i2c-lis3dh-config.png differ
diff --git a/static/images/i2c-lis3dh-who-am-i.png b/static/images/i2c-lis3dh-who-am-i.png
new file mode 100644
index 00000000..d3ed8010
Binary files /dev/null and b/static/images/i2c-lis3dh-who-am-i.png differ
diff --git a/static/images/i2c-mpu6050-whoami.png b/static/images/i2c-mpu6050-whoami.png
new file mode 100644
index 00000000..99b7e344
Binary files /dev/null and b/static/images/i2c-mpu6050-whoami.png differ
diff --git a/static/images/i2c-target-flow.png b/static/images/i2c-target-flow.png
new file mode 100644
index 00000000..bf816395
Binary files /dev/null and b/static/images/i2c-target-flow.png differ
diff --git a/static/images/tinygo-logo-10.svg b/static/images/tinygo-logo-10.svg
new file mode 100644
index 00000000..8f932403
--- /dev/null
+++ b/static/images/tinygo-logo-10.svg
@@ -0,0 +1,44 @@
+
+
+
+
diff --git a/static/images/tinygo-logo-20.svg b/static/images/tinygo-logo-20.svg
new file mode 100644
index 00000000..87d192e7
--- /dev/null
+++ b/static/images/tinygo-logo-20.svg
@@ -0,0 +1,110 @@
+
+
+
+
diff --git a/static/images/tinygo-logo-border.png b/static/images/tinygo-logo-border.png
new file mode 100644
index 00000000..7df0b107
Binary files /dev/null and b/static/images/tinygo-logo-border.png differ
diff --git a/static/images/tinygo-logo-small.png b/static/images/tinygo-logo-small.png
index f6b51f29..eb30137b 100644
Binary files a/static/images/tinygo-logo-small.png and b/static/images/tinygo-logo-small.png differ
diff --git a/static/images/tinygo-logo.svg b/static/images/tinygo-logo.svg
new file mode 100644
index 00000000..f3045dc8
--- /dev/null
+++ b/static/images/tinygo-logo.svg
@@ -0,0 +1,563 @@
+
+
+
+
diff --git a/static/playground b/static/playground
new file mode 160000
index 00000000..8750ccf5
--- /dev/null
+++ b/static/playground
@@ -0,0 +1 @@
+Subproject commit 8750ccf5283f5f4c42ff4a0457a8537b9884602d
diff --git a/static/playground-home.js b/static/playground-home.js
new file mode 100644
index 00000000..c52a0dc1
--- /dev/null
+++ b/static/playground-home.js
@@ -0,0 +1,224 @@
+import { Simulator } from './playground/simulator.js';
+import { Editor } from './playground/resources/editor.bundle.min.js';
+
+// This file is for the playground on the home page.
+
+// Note: to test this locally, run the playground server!
+// Run the following in a terminal:
+//
+// cd static/playground
+// go run .
+//
+const PLAYGROUND_API = location.hostname == 'localhost' ? 'http://localhost:8080/api' : 'https://playground-bttoqog3vq-uc.a.run.app/api';
+
+// Initialize the playground embedded in the homepage.
+addEventListener('DOMContentLoaded', async () => {
+ let playground = document.querySelector('#playground');
+ let exampleSelect = playground.querySelector('.example_select');
+ let root = playground.querySelector('.simulator');
+ let firmwareButton = playground.querySelector('.playground-btn-flash');
+
+ // Load editor.
+ let editor = new Editor(playground.querySelector('.playground-editor'));
+
+ // Load simulator.
+ let state = structuredClone(examples[exampleSelect.value]);
+ editor.setText(state.code);
+ let simulator = new Simulator({
+ root: root,
+ editor: editor,
+ firmwareButton: firmwareButton,
+ baseURL: new URL('/playground/', document.baseURI),
+ apiURL: PLAYGROUND_API,
+ features: [],
+ });
+ await simulator.setState(state, state.target);
+
+ // Respond to changes in the example select box.
+ exampleSelect.disabled = false;
+ exampleSelect.addEventListener('change', async () => {
+ exampleSelect.disabled = true;
+ state = structuredClone(examples[exampleSelect.value]);
+ editor.setText(state.code);
+ await simulator.setState(state, state.target);
+ exampleSelect.disabled = false;
+ })
+});
+
+
+const exampleHello = `// You can edit this code!
+package main
+
+func main() {
+ println("hello world!")
+}`;
+
+const exampleBlink = `// You can edit this code!
+package main
+
+import (
+ "machine"
+ "time"
+)
+
+func main() {
+ led := machine.LED
+ led.Configure(machine.PinConfig{Mode: machine.PinOutput})
+ for {
+ led.High()
+ time.Sleep(time.Second/2)
+
+ led.Low()
+ time.Sleep(time.Second/2)
+ }
+}`;
+
+const exampleST7789 = `package main
+
+import (
+ "machine"
+ "image/color"
+ "tinygo.org/x/drivers/st7789"
+)
+
+func main() {
+ // configure the display
+ machine.SPI0.Configure(machine.SPIConfig{
+ Frequency: 62_500_000, // 62.5MHz
+ Mode: 3,
+ SCK: machine.SPI0_SCK_PIN,
+ SDI: machine.SPI0_SDI_PIN,
+ SDO: machine.SPI0_SDO_PIN,
+ })
+ display := st7789.New(machine.SPI0,
+ machine.TFT_RST, // reset
+ machine.TFT_WRX, // data/command
+ machine.TFT_CS, // chip select
+ machine.TFT_BACKLIGHT) // backlight
+ display.Configure(st7789.Config{
+ Rotation: st7789.ROTATION_270,
+ Height: 320,
+ })
+
+ width, height := display.Size()
+
+ white := color.RGBA{255, 255, 255, 255}
+ red := color.RGBA{255, 0, 0, 255}
+ blue := color.RGBA{0, 0, 255, 255}
+ green := color.RGBA{0, 255, 0, 255}
+ black := color.RGBA{0, 0, 0, 255}
+
+ display.FillRectangle(0, 0, width/2, height/2, white)
+ display.FillRectangle(width/2, 0, width/2, height/2, red)
+ display.FillRectangle(0, height/2, width/2, height/2, green)
+ display.FillRectangle(width/2, height/2, width/2, height/2, blue)
+ display.FillRectangle(width/4, height/4, width/2, height/2, black)
+}`;
+
+const exampleLEDs = `package main
+
+import (
+ "image/color"
+ "machine"
+ "time"
+
+ "tinygo.org/x/drivers/ws2812"
+)
+
+func main() {
+ // Set up the ring of RGB LEDs.
+ pin := machine.WS2812
+ pin.Configure(machine.PinConfig{Mode: machine.PinOutput})
+ ws := ws2812.New(pin)
+ leds := make([]color.RGBA, 10)
+
+ for cycle := uint8(0); ; cycle++ {
+ // Calculate a new color for each LED.
+ for i := range leds {
+ leds[i] = colorWheel(cycle*2 + uint8(i*8))
+ }
+
+ // Write colors to the LED ring.
+ ws.WriteColors(leds)
+
+ // Wait a bit each loop (running at around 30fps).
+ time.Sleep(time.Second / 30)
+ }
+}
+
+// Pick a color from the color wheel (red, then, green, then blue, and back to
+// red).
+func colorWheel(index uint8) color.RGBA {
+ index = 255-index
+ if index < 85 {
+ return color.RGBA{R: 255 - index*3, B: index * 3}
+ } else if index < 170 {
+ return color.RGBA{G: (index - 85) * 3, B: 255 - (index-85)*3}
+ } else {
+ return color.RGBA{R: (index - 170) * 3, G: 255 - (index-170)*3}
+ }
+}`;
+
+var examples = {
+ // Simple "hello world" example.
+ hello: {
+ target: 'console',
+ code: exampleHello,
+ parts: [
+ {
+ id: 'main',
+ location: 'parts/console.json',
+ x: 0,
+ y: 0,
+ }
+ ],
+ wires: [],
+ },
+
+ // Simple "blinky light" example.
+ // The Arduino Uno, despite its limitations, is very well known and many
+ // people have one. So it seems like a good testcase.
+ arduino: {
+ target: 'arduino',
+ code: exampleBlink,
+ parts: [
+ {
+ id: 'main',
+ location: 'parts/arduino.json',
+ x: 0,
+ y: 0,
+ }
+ ],
+ wires: [],
+ },
+
+ // Commonly used board, and a nice demo with LEDs.
+ circuitplay_express: {
+ target: 'circuitplay_express',
+ code: exampleLEDs,
+ parts: [
+ {
+ id: 'main',
+ location: 'parts/circuitplay-express.json',
+ x: 0,
+ y: 0,
+ },
+ ],
+ wires: [],
+ },
+
+ // Our own Gopher Badge, which importantly has a display!
+ gopher_badge: {
+ target: 'gopher_badge',
+ code: exampleST7789,
+ parts: [
+ {
+ id: 'main',
+ location: 'parts/gopher-badge.json',
+ x: 0,
+ y: 0,
+ },
+ ],
+ wires: [],
+ },
+};
diff --git a/static/playground-play.js b/static/playground-play.js
new file mode 100644
index 00000000..b762334b
--- /dev/null
+++ b/static/playground-play.js
@@ -0,0 +1,223 @@
+import { Simulator, upgradeOldState } from './playground/simulator.js';
+import { Editor } from './playground/resources/editor.bundle.min.js';
+import { boards } from './playground/boards.js';
+
+// This file is for the playground at the /play URL.
+
+const PLAYGROUND_API = location.hostname == 'localhost' ? 'http://localhost:8080/api' : 'https://playground-bttoqog3vq-uc.a.run.app/api';
+
+const defaultBoardName = 'console';
+
+let simulator = null;
+let editor = null;
+
+// Regexp for a URL like /s/abcdef
+let shareURLRegexp = RegExp('/s/([a-zA-Z0-9]*)$');
+
+// updateBoards updates the dropdown menu. This must be done on load or after
+// selecting a different board.
+function updateBoards(state) {
+ // Try to figure out the board name based on the saved state.
+ let activeName = '';
+ if (state) {
+ let matches = RegExp('parts/([a-z0-9-]+).json$').exec(state.parts[0].location);
+ if (matches) {
+ activeName = matches[1];
+ if (activeName === 'console' && state.compiler === 'go') {
+ activeName = 'console-go';
+ }
+ }
+ let button = document.querySelector('#target > button');
+ if (activeName in boards) {
+ button.textContent = boards[activeName].humanName;
+ } else {
+ // For some reason we couldn't find the board (should only happen with a
+ // malformed editor state).
+ button.textContent = '...';
+ }
+ }
+
+ // Replace the dropdown with a new dropdown.
+ let dropdown = document.querySelector('#target > .dropdown-menu');
+ dropdown.innerHTML = '';
+ for (let name in boards) {
+ let item = document.createElement('a');
+ item.textContent = boards[name].humanName;
+ item.classList.add('dropdown-item');
+ if (name === activeName) {
+ item.classList.add('active');
+ }
+ item.setAttribute('href', '');
+ item.dataset.name = name;
+ dropdown.appendChild(item);
+ item.addEventListener('click', (e) => {
+ e.preventDefault();
+ clearShareURL();
+ setBoard(item.dataset.name);
+ });
+ }
+}
+
+// setBoard reloads the editor and simulator to use the given board.
+async function setBoard(name) {
+ // Create a new clean state object for this board.
+ let board = boards[name];
+ let state = {
+ code: board.code,
+ compiler: board.compiler,
+ parts: [
+ {
+ id: 'main',
+ location: board.location,
+ x: 0,
+ y: 0,
+ },
+ ],
+ wires: [],
+ };
+
+ // Update the editor/simulator.
+ await setState(state);
+
+ // Load the same board after a reload.
+ localStorage.tinygo_playground_boardName = name;
+ delete localStorage.tinygo_playground_state;
+}
+
+// Reset the editor and simulator to use the given state.
+async function setState(state) {
+ upgradeOldState(state);
+ updateBoards(state);
+ editor.setText(state.code);
+
+ // Change to the new project state.
+ await simulator.setState(state);
+}
+
+// Load the editor state on page load.
+async function loadSavedState() {
+ // Check whether this is a share URL, and if so load the editor state from the
+ // API.
+ let matches = shareURLRegexp.exec(document.location.pathname);
+ if (matches) {
+ let id = matches[1];
+ let response = await fetch(`${PLAYGROUND_API}/share?id=${id}`);
+ if (response.status != 200) {
+ // Can't load the shared code.
+ // Users can still select a different sample from the dropdown. This is
+ // not very obvious, so might need a more explicit message.
+ simulator.terminal.appendError(`failed to fetch shared code: ${response.status} ${response.statusText}`);
+ return;
+ }
+ let state = await response.json();
+ setState(state.data);
+ return;
+ }
+
+ // Check whether the editor saved a previous state.
+ if (localStorage.tinygo_playground_state) {
+ setState(JSON.parse(localStorage.tinygo_playground_state));
+ return;
+ }
+
+ // Load the default board.
+ let board = localStorage.tinygo_playground_boardName;
+ if (!(board in boards)) {
+ board = defaultBoardName;
+ }
+ setBoard(board);
+}
+
+// Remove the /s/foobar suffix of the URL, and replace it with a bare /play/ URL
+// instead.
+function clearShareURL() {
+ let parts = shareURLRegexp.exec(document.location.pathname);
+ if (parts) {
+ let pathname = document.location.pathname;
+ pathname = pathname.substring(0, pathname.length-parts[0].length+1);
+ history.replaceState({}, '', pathname);
+ }
+}
+
+function setupShareButton() {
+ let modalElement = document.querySelector('#shareModal');
+ let input = modalElement.querySelector('input');
+ let button = modalElement.querySelector('button.copy-to-clipboard');
+
+ let copiedTooltip = new bootstrap.Tooltip(input, {
+ title: 'Copied to clipboard!',
+ trigger: 'manual',
+ placement: 'bottom',
+ });
+
+ let buttonTooltip = bootstrap.Tooltip.getOrCreateInstance(button);
+
+ document.querySelector('#btn-share').addEventListener('click', async e => {
+ e.preventDefault();
+
+ // Share modal with 'loading...' input.
+ input.value = '';
+ button.disabled = true;
+ let modal = new bootstrap.Modal(modalElement, {});
+ modal.show();
+
+ // Save the current code snippet.
+ let id = await simulator.share();
+
+ // Update the modal and URL.
+ let url;
+ if (shareURLRegexp.test(document.location.pathname)) {
+ url = new URL(id, document.location.href);
+ } else {
+ url = new URL('s/' + id, document.location.href);
+ }
+ history.replaceState({}, '', url);
+ input.value = url;
+ button.disabled = false;
+ });
+
+ button.addEventListener('click', e => {
+ e.preventDefault();
+ navigator.clipboard.writeText(input.value);
+ input.focus();
+
+ // Hide the 'Copy to clipboard' tooltip on the button.
+ buttonTooltip.hide();
+
+ // Show a new tooltip on the input element.
+ copiedTooltip.show();
+ setTimeout(() => {
+ copiedTooltip.hide();
+ }, 1500);
+ });
+
+ input.addEventListener('focus', e => {
+ input.select();
+ })
+}
+
+// Initialize the playground.
+document.addEventListener('DOMContentLoaded', async function(e) {
+ editor = new Editor(document.querySelector('.playground-editor'));
+
+ simulator = new Simulator({
+ root: document.querySelector('#output'),
+ editor: editor,
+ firmwareButton: document.querySelector('#btn-flash'),
+ baseURL: new URL('/playground/', document.baseURI),
+ apiURL: PLAYGROUND_API,
+ saveState: () => {
+ // Strip /s/* URL suffix.
+ clearShareURL();
+ localStorage.tinygo_playground_state = JSON.stringify(simulator.schematic.state);
+ },
+ });
+
+ setupShareButton();
+
+ // Update the drop down list of boards.
+ updateBoards();
+
+ // Now see which editor state we should load (depending on various things).
+ loadSavedState();
+})
diff --git a/static/tour-lis3dh.js b/static/tour-lis3dh.js
new file mode 100644
index 00000000..6f62a4c6
--- /dev/null
+++ b/static/tour-lis3dh.js
@@ -0,0 +1,128 @@
+import { setupTour } from '/tour.js';
+
+export function setupLIS3DH(code) {
+ let imuConfig = {
+ humanName: 'Adafruit LIS3DH',
+ svg: 'adafruit-lis3dh.svg',
+ };
+ setupTour({
+ boards: {
+ 'arduino-nano33': {
+ code: code.replace('SCL_PIN', 'A5').replace('SDA_PIN', 'A4'),
+ parts: {
+ main: {
+ y: -10,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ x: 5,
+ y: 10,
+ rotation: 180,
+ }
+ },
+ wires: [
+ {from: 'main.A5', to: 'imu.SCL'},
+ {from: 'main.A4', to: 'imu.SDA'},
+ ],
+ },
+ 'arduino': {
+ code: code.replace('SCL_PIN', 'ADC5').replace('SDA_PIN', 'ADC4'),
+ parts: {
+ main: {
+ y: 10,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ x: -13,
+ y: -30,
+ },
+ },
+ wires: [
+ {from: 'main.A5#2', to: 'imu.SCL'},
+ {from: 'main.A4#2', to: 'imu.SDA'},
+ ],
+ },
+ 'circuitplay-bluefruit': {
+ code: code.replace('SCL_PIN', 'SCL1_PIN').replace('SDA_PIN', 'SDA1_PIN').replaceAll('Tx(0x18', 'Tx(0x19'),
+ },
+ 'circuitplay-express': {
+ code: code.replace('SCL_PIN', 'SCL1_PIN').replace('SDA_PIN', 'SDA1_PIN').replace('machine.I2C0', 'machine.I2C1').replaceAll('Tx(0x18', 'Tx(0x19'),
+ },
+ 'microbit': {
+ code: code.replace('SCL_PIN', 'P0').replace('SDA_PIN', 'P1'),
+ parts: {
+ main: {
+ x: 15,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ y: -10,
+ x: -30,
+ },
+ },
+ wires: [
+ {from: 'main.P0', to: 'imu.SCL'},
+ {from: 'main.P1', to: 'imu.SDA'},
+ ],
+ },
+ 'gopher-badge': {
+ code: code.replace('SCL_PIN', 'I2C0_SCL_PIN').replace('SDA_PIN', 'I2C0_SDA_PIN'),
+ },
+ 'reelboard': {
+ code: code.replace('SCL_PIN', 'P0_27').replace('SDA_PIN', 'P0_26'),
+ parts: {
+ main: {
+ x: -10,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ x: 50,
+ },
+ },
+ wires: [
+ {from: 'main.P19', to: 'imu.SCL'},
+ {from: 'main.P20', to: 'imu.SDA'},
+ ],
+ },
+ 'pico': {
+ code: code.replace('SCL_PIN', 'GP17').replace('SDA_PIN', 'GP16'),
+ parts: {
+ main: {
+ y: 12,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ x: 21,
+ y: -13,
+ },
+ },
+ wires: [
+ {from: 'main.GP17', to: 'imu.SCL'},
+ {from: 'main.GP16', to: 'imu.SDA'},
+ ],
+ },
+ 'hifive1b': {
+ code: code.replace('SCL_PIN', 'D19').replace('SDA_PIN', 'D18'),
+ parts: {
+ main: {
+ x: -10,
+ },
+ imu: {
+ config: imuConfig,
+ location: 'parts/adafruit-lis3dh.json',
+ x: 45,
+ rotation: 180,
+ },
+ },
+ wires: [
+ {from: 'main.D19', to: 'imu.SCL'},
+ {from: 'main.D18', to: 'imu.SDA'},
+ ],
+ },
+ }});
+}
diff --git a/static/tour.js b/static/tour.js
new file mode 100644
index 00000000..6491918d
--- /dev/null
+++ b/static/tour.js
@@ -0,0 +1,147 @@
+import { Simulator } from './playground/simulator.js';
+import { Editor } from '/playground/resources/editor.bundle.min.js';
+
+export { setupTour };
+
+// Note: to test this locally, run the playground server!
+// Run the following in a terminal:
+//
+// cd static/playground
+// go run .
+//
+const PLAYGROUND_API = location.hostname == 'localhost' ? 'http://localhost:8080/api' : 'https://playground-bttoqog3vq-uc.a.run.app/api';
+
+const boardNames = {
+ 'arduino': 'Arduino Uno',
+ 'arduino-nano33': 'Arduino Nano 33 IoT',
+ 'circuitplay-bluefruit': 'Adafruit Circuit Playground Bluefruit',
+ 'circuitplay-express': 'Adafruit Circuit Playground Express',
+ 'gopher-badge': 'Gopher Badge',
+ 'hifive1b': 'SiFive HiFive1 rev B',
+ 'microbit': 'BBC micro:bit v1',
+ 'pico': 'Raspberry Pi Pico',
+ 'reelboard': 'Phytec reel board',
+}
+
+// Configure the tour. This works on pages that use the "tour" layout.
+// The config parameter has the following layout:
+//
+// {
+// code: '...', // default code
+// boards: {
+// 'arduino': { // board name
+// code: '...', // code for this board (optional)
+// parts: { // extra parts besides the main part (optional)
+// led: { ... }, // configuration for this part
+// },
+// wires: [ // wires (optional)
+// {from: 'main.D2', to: 'led.anode'},
+// {from: 'main.GND#2', to: 'led.cathode'},
+// ],
+// },
+// 'microbit': {}, // an empty value also works (and uses defaults)
+// },
+// }
+async function setupTour(config) {
+ let boards = [];
+ for (let boardName in config.boards) {
+ boards.push(boardName);
+ }
+ function createState(board) {
+ let state = {
+ target: board,
+ parts: [
+ {
+ id: 'main',
+ location: `parts/${board}.json`,
+ x: 0,
+ y: 0,
+ }
+ ],
+ wires: [],
+ }
+ let boardConfig = config.boards[board];
+ if (boardConfig.code) {
+ state.code = boardConfig.code.trim();
+ } else {
+ state.code = config.code.trim();
+ }
+ for (let key in boardConfig.parts) {
+ let value = structuredClone(boardConfig.parts[key]);
+ value.id = key;
+ value.x = value.x || 0;
+ value.y = value.y || 0;
+ if (key === 'main') {
+ Object.assign(state.parts[0], value);
+ } else {
+ state.parts.push(value);
+ }
+ }
+ for (let wire of (boardConfig.wires) || []) {
+ state.wires.push(wire);
+ }
+
+ return state;
+ }
+
+ let root = document.querySelector('.simulator');
+ let editor = new Editor(document.querySelector('.playground-editor'));
+ let firmwareButton = document.querySelector('.playground-btn-flash');
+ let resetButton = document.querySelector('.playground-btn-reset');
+
+ // Pick default board.
+ let currentBoard = boards[0];
+ if (localStorage.tinygo_tour_board in config.boards) {
+ // The user previously picked a different board.
+ currentBoard = localStorage.tinygo_tour_board;
+ }
+
+ let boardButton = document.querySelector('#board .dropdown-toggle');
+ let boardMenu = document.querySelector('#board .dropdown-menu');
+ for (let board of boards) {
+ let boardName = boardNames[board] || board;
+ let a = document.createElement('a');
+ a.textContent = boardName;
+ a.classList.add('dropdown-item');
+ if (board === currentBoard) {
+ a.classList.add('active');
+ boardButton.textContent = boardName;
+ }
+ a.href = "";
+ a.addEventListener('click', async e => {
+ // Select a different board.
+ localStorage.tinygo_tour_board = board;
+ e.preventDefault();
+ boardMenu.querySelector('a.dropdown-item.active').classList.remove('active');
+ a.classList.add('active');
+ boardButton.textContent = boardName;
+ currentBoard = board;
+ state = createState(currentBoard);
+ editor.setText(state.code);
+ await simulator.setState(state, currentBoard);
+ })
+ boardMenu.appendChild(a);
+ }
+
+ // Load simulator.
+ let state = createState(currentBoard);
+ editor.setText(state.code);
+ let simulator = new Simulator({
+ root: root,
+ editor: editor,
+ features: [],
+ firmwareButton: firmwareButton,
+ baseURL: new URL('/playground/', document.baseURI),
+ apiURL: PLAYGROUND_API,
+ });
+ await simulator.setState(state, state.target);
+
+ resetButton.disabled = false;
+ resetButton.addEventListener('click', async e => {
+ resetButton.disabled = true;
+ state = createState(currentBoard);
+ editor.setText(state.code);
+ await simulator.setState(state, currentBoard);
+ resetButton.disabled = false;
+ });
+}
diff --git a/static/x/device/index.html b/static/x/device/index.html
new file mode 100644
index 00000000..ab90441b
--- /dev/null
+++ b/static/x/device/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+Nothing to see here; move along .
+
\ No newline at end of file
diff --git a/static/x/tinyfs/index.html b/static/x/tinyfs/index.html
new file mode 100644
index 00000000..6f9107c5
--- /dev/null
+++ b/static/x/tinyfs/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+Nothing to see here; move along .
+
\ No newline at end of file
diff --git a/static/x/tinygba/index.html b/static/x/tinygba/index.html
new file mode 100644
index 00000000..46e452f2
--- /dev/null
+++ b/static/x/tinygba/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+Nothing to see here; move along .
+
diff --git a/static/x/tinygl-font/index.html b/static/x/tinygl-font/index.html
new file mode 100644
index 00000000..2d7a9c75
--- /dev/null
+++ b/static/x/tinygl-font/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+Nothing to see here; move along .
+
\ No newline at end of file
diff --git a/static/x/tinygl/index.html b/static/x/tinygl/index.html
new file mode 100644
index 00000000..49423919
--- /dev/null
+++ b/static/x/tinygl/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+Nothing to see here; move along .
+
diff --git a/themes/learn b/themes/learn
deleted file mode 160000
index 1d2d7f97..00000000
--- a/themes/learn
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 1d2d7f97a634c281f8a85e1efaed190d0d814f07