aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/machine_atsamd51.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-08-03 16:24:47 +0200
committerAyke <[email protected]>2022-08-04 12:18:32 +0200
commitc7a23183e822b9eebb639902414a0e08a09fbba0 (patch)
tree894a03fe2f4980a728c8401604d8a2c17503fde5 /src/machine/machine_atsamd51.go
parentf936125658e8aef885a0e31d8fc343859defe63c (diff)
downloadtinygo-c7a23183e822b9eebb639902414a0e08a09fbba0.tar.gz
tinygo-c7a23183e822b9eebb639902414a0e08a09fbba0.zip
all: format code according to Go 1.19 rules
Go 1.19 started reformatting code in a way that makes it more obvious how it will be rendered on pkg.go.dev. It gets it almost right, but not entirely. Therefore, I had to modify some of the comments so that they are formatted correctly.
Diffstat (limited to 'src/machine/machine_atsamd51.go')
-rw-r--r--src/machine/machine_atsamd51.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/machine/machine_atsamd51.go b/src/machine/machine_atsamd51.go
index 54bd1fc9f..dd0ba9994 100644
--- a/src/machine/machine_atsamd51.go
+++ b/src/machine/machine_atsamd51.go
@@ -5,7 +5,6 @@
//
// Datasheet:
// http://ww1.microchip.com/downloads/en/DeviceDoc/60001507C.pdf
-//
package machine
import (
@@ -250,12 +249,13 @@ const (
// SERCOM and SERCOM-ALT.
//
// Observations:
-// * There are eight SERCOMs. Those SERCOM numbers can be encoded in 4 bits.
-// * Even pad numbers are usually on even pins, and odd pad numbers are usually
+// - There are eight SERCOMs. Those SERCOM numbers can be encoded in 4 bits.
+// - Even pad numbers are usually on even pins, and odd pad numbers are usually
// on odd pins. The exception is SERCOM-ALT, which sometimes swaps pad 0 and 1.
// With that, there is still an invariant that the pad number for an odd pin is
// the pad number for the corresponding even pin with the low bit toggled.
-// * Pin pads come in pairs. If PA00 has pad 0, then PA01 has pad 1.
+// - Pin pads come in pairs. If PA00 has pad 0, then PA01 has pad 1.
+//
// With this information, we can encode SERCOM pin/pad numbers much more
// efficiently. Due to pads coming in pairs, we can ignore half the pins: the
// information for an odd pin can be calculated easily from the preceding even
@@ -1538,17 +1538,16 @@ var (
// 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)
+// 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)
+// 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)
-//
+// spi.Tx(nil, rx)
func (spi SPI) Tx(w, r []byte) error {
switch {
case w == nil:
@@ -1672,7 +1671,7 @@ func (tcc *TCC) Configure(config PWMConfig) error {
// SetPeriod updates the period of this TCC peripheral.
// To set a particular frequency, use the following formula:
//
-// period = 1e9 / frequency
+// period = 1e9 / frequency
//
// If you use a period of 0, a period that works well for LEDs will be picked.
//
@@ -1962,7 +1961,7 @@ func (tcc *TCC) SetInverting(channel uint8, inverting bool) {
// cycle, in other words the fraction of time the channel output is high (or low
// when inverted). For example, to set it to a 25% duty cycle, use:
//
-// tcc.Set(channel, tcc.Top() / 4)
+// tcc.Set(channel, tcc.Top() / 4)
//
// tcc.Set(channel, 0) will set the output to low and tcc.Set(channel,
// tcc.Top()) will set the output to high, assuming the output isn't inverted.