avr: use standard pin numbering

This commit changes pin numbering for atmega328 based boards (Uno, Nano)
to use the standard format, where pin number is determined by the
pin/port. Previously, pin numbers were based on what the Uno uses, which
does not seem to have a clear pattern.

One difference is that counting starts at port B, as there is no port A.
So PB0 is 0, PB1 is 1… PC0 is 8.

This commit also moves PWM code to the atmega328 file, as it may not be
generic to all ATmega chips.
This commit is contained in:
Ayke van Laethem
2020-05-10 15:07:58 +02:00
committed by Ron Evans
parent 2c71f08922
commit 6b8940421e
8 changed files with 195 additions and 120 deletions
+1 -3
View File
@@ -5,11 +5,9 @@ import (
"time"
)
// This example assumes that the button is connected to pin 8. Change the value
// below to use a different pin.
const (
led = machine.LED
button = machine.Pin(8)
button = machine.BUTTON
)
func main() {