#pragma once namespace Pins { namespace Addr { // Arduino Nano Every struct Offset { // VPORTs const uint8_t vDir = 0x00; const uint8_t vOut = 0x01; const uint8_t vIn = 0x02; const uint8_t vFlag = 0x03; // PORTs const uint8_t dir = 0x00; const uint8_t dirSet = 0x01; const uint8_t dirClear = 0x02; const uint8_t dirToggle = 0x03; const uint8_t out = 0x04; const uint8_t outSet = 0x05; const uint8_t outClear = 0x06; const uint8_t outToggle = 0x07; const uint8_t in = 0x08; const uint8_t flag = 0x09; // Interrupt Flag const uint8_t portCtrl = 0x0A; // Slewrate Bit }; constexpr Offset addrOffset; struct Address // base addresses of registers { uint16_t vport; uint16_t port; uint8_t pinCtrl; uint8_t mask; }; // The index is always the Arduino pin number. constexpr Address baseAddr[] { // | VPORT | PORT | PINn | BIT | // | Base | Base | CTRL | MASK | // BIT | PIN {0x0008, 0x0440, 0x15, 0x20}, // 5 | 0 {0x0008, 0x0440, 0x14, 0x10}, // 4 | 1 {0x0000, 0x0400, 0x10, 0x01}, // 0 | 2 {0x0014, 0x04A0, 0x15, 0x20}, // 5 | 3 {0x0008, 0x0440, 0x16, 0x40}, // 6 | 4 {0x0004, 0x0420, 0x12, 0x04}, // 2 | 5 {0x0014, 0x04A0, 0x14, 0x10}, // 4 | 6 {0x0000, 0x0400, 0x11, 0x02}, // 1 | 7 {0x0010, 0x0480, 0x13, 0x08}, // 3 | 8 {0x0004, 0x0420, 0x10, 0x01}, // 0 | 9 {0x0004, 0x0420, 0x11, 0x02}, // 1 | 10 {0x0010, 0x0480, 0x10, 0x01}, // 0 | 11 {0x0010, 0x0480, 0x11, 0x02}, // 1 | 12 {0x0010, 0x0480, 0x12, 0x04}, // 2 | 13 {0x000C, 0x0460, 0x13, 0x08}, // 3 | 14 {0x000C, 0x0460, 0x12, 0x04}, // 2 | 15 {0x000C, 0x0460, 0x11, 0x02}, // 1 | 16 {0x000C, 0x0460, 0x10, 0x01}, // 0 | 17 {0x0014, 0x04A0, 0x12, 0x04}, // 2 | 18 {0x0014, 0x04A0, 0x13, 0x08}, // 3 | 19 {0x000C, 0x0460, 0x14, 0x10}, // 4 | 20 {0x000C, 0x0460, 0x15, 0x20}, // 5 | 21 // ----------------------------------------------------- // because of pin double assignment 18<>22 and 19<>23 // PA2 and PA3 are used for I2C {0x0000, 0x0400, 0x12, 0x04}, // 2 | 22, PA2 (18) {0x0000, 0x0400, 0x13, 0x08}, // 3 | 23, PA3 (19) }; constexpr uint8_t ANZAHLPINS = ( sizeof(baseAddr) / sizeof(baseAddr[0]) ) - 2; } } /* Arduino Nano Every PinOut (ATmega4809) _ __|_|__ | | (D13) PE2 + + PE1 (D12) 3.3V + + PE0 (D11) (AREF) PD7 + + PB1 (D10)(~)(TCA0 Channel 1) (A0)(D14) PD3 + + PB0 (D 9)(~)(TCA0 Channel 0) (A1)(D15) PD2 + + PE3 (D 8) (A2)(D16) PD1 + + PA1 (D 7) (A3)(D17) PD0 + + PF4 (D 6)(~)(TCB0) (A4)(D18) PF2 + + PB2 (D 5)(~)(TCA0 Channel 2) (A5)(D19) PF3 + + PC6 (D 4) (A6)(D20) PD4 + + PF5 (D 3)(~)(TCB1) (A7)(D21) PD5 + + PA0 (D 2) 5.0V + + GND RESET + + RESET GND + + PC5 (D 0) RX1 VIN + + PC4 (D 1) TX1 |_______| Ardu | Event | CCL-LUTn | TCA0 | TCBn | Pin Port | Port | Channel | default | PortMux | default | PortMux | default | PortMux | 0 PC5 | 0 2 or 3 | --- --- | --- 0-WO5 | --- --- | 1 PC4 | 0 2 or 3 | --- --- | --- 0-WO4 | --- --- | 2 PA0 | 0 0 or 1 | 0-IN0 --- | 0-WO0 --- | --- --- | 3 PF5 | 1 4 or 5 | --- --- | --- 0-WO5 | --- 1-WO | 4 PC6 | 0 2 or 3 | --- 1-OUT | --- --- | --- --- | 5 PB2 | 1 0 or 1 | --- --- | --- 0-WO2 | --- --- | 6 PF4 | 1 4 or 5 | --- --- | --- 0-WO4 | --- 0-WO | 7 PA1 | 0 0 or 1 | 0-IN1 --- | 0-WO1 --- | --- --- | 8 PE3 | 0 4 or 5 | --- --- | --- 0-WO3 | --- --- | 9 PB0 | 1 0 or 1 | --- --- | --- 0-WO0 | --- --- | 10 PB1 | 1 0 or 1 | --- --- | --- 0-WO1 | --- --- | 11 PE0 | 0 4 or 5 | --- --- | --- 0-WO0 | --- --- | 12 PE1 | 0 4 or 5 | --- --- | --- 0-WO1 | --- --- | 13 PE2 | 0 4 or 5 | --- --- | --- 0-WO2 | --- --- | 14 PD3 | 1 2 or 3 | 2-OUT --- | --- 0-WO3 | --- --- | 15 PD2 | 1 2 or 3 | 2-IN2 --- | --- 0-WO2 | --- --- | 16 PD1 | 1 2 or 3 | 2-IN1 --- | --- 0-WO1 | --- --- | 17 PD0 | 1 2 or 3 | 2-IN0 --- | --- 0-WO0 | --- --- | 18 PF2 | 1 4 or 5 | 3-IN2 --- | --- 0-WO2 | --- --- | Doppelbelegung mit PA2 beachten !!! 19 PF3 | 1 4 or 5 | 3-OUT --- | --- 0-WO3 | --- --- | Doppelbelegung mit PA3 beachten !!! 20 PD4 | 1 2 or 3 | --- --- | --- 0-WO4 | --- --- | 21 PD5 | 1 2 or 3 | --- --- | --- 0-WO5 | --- --- | */