/* Programmed and tested with: Arduino IDE 1.8.15 28.02.2021 */ #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) Prepared to the best of our knowledge and belief. :-) Without warranty. _ __|_|__ | | (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 |_______| //---------------------------------------------------------------------------------------------------------------------------------------------- With 'default' in the table the view from the µC is meant. Not the one of the Arduino framework. If you don't change anything at the portmux registers, the setting according to the board label above is valid. Ardu | Event | CCL-LUTn | TCA0 | TCBn | ADC0 | Pin Port | Port | Channel | default | PortMux | default | PortMux | default | PortMux | default | 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 | AIN15 | 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 | AIN14 | 7 PA1 | 0 0 or 1 | 0-IN1 --- | 0-WO1 --- | --- --- | | 8 PE3 | 0 4 or 5 | --- --- | --- 0-WO3 | --- --- | AIN11 | 9 PB0 | 1 0 or 1 | --- --- | --- 0-WO0 | --- --- | | 10 PB1 | 1 0 or 1 | --- --- | --- 0-WO1 | --- --- | | 11 PE0 | 0 4 or 5 | --- --- | --- 0-WO0 | --- --- | AIN8 | 12 PE1 | 0 4 or 5 | --- --- | --- 0-WO1 | --- --- | AIN9 | 13 PE2 | 0 4 or 5 | --- --- | --- 0-WO2 | --- --- | AIN10 | 14 PD3 | 1 2 or 3 | 2-OUT --- | --- 0-WO3 | --- --- | AIN3 | 15 PD2 | 1 2 or 3 | 2-IN2 --- | --- 0-WO2 | --- --- | AIN2 | 16 PD1 | 1 2 or 3 | 2-IN1 --- | --- 0-WO1 | --- --- | AIN1 | 17 PD0 | 1 2 or 3 | 2-IN0 --- | --- 0-WO0 | --- --- | AIN0 | 18 PF2 | 1 4 or 5 | 3-IN2 --- | --- 0-WO2 | --- --- | AIN12 | board internal double assignment with PA2 observe !!! 19 PF3 | 1 4 or 5 | 3-OUT --- | --- 0-WO3 | --- --- | AIN13 | board internal double assignment with PA3 observe !!! 20 PD4 | 1 2 or 3 | --- --- | --- 0-WO4 | --- --- | AIN4 | 21 PD5 | 1 2 or 3 | --- --- | --- 0-WO5 | --- --- | AIN5 | //---------------------------------------------------------------------------------------------------------------------------------------------- Wahrheitstabelle: IN2 | IN1 | IN0 | LUTnOUT [bit number in CCL.TRUTHn] 0 | 0 | 0 | TRUTHn[0] 0 | 0 | 1 | TRUTHn[1] 0 | 1 | 0 | TRUTHn[2] 0 | 1 | 1 | TRUTHn[3] 1 | 0 | 0 | TRUTHn[4] 1 | 0 | 1 | TRUTHn[5] 1 | 1 | 0 | TRUTHn[6] 1 | 1 | 1 | TRUTHn[7] //---------------------------------------------------------------------------------------------------------------------------------------------- On the board to the outside are not wired: !!! double occupancy Arduino pin 18 and 19 observe !!! | Event | CCL-LUTn | Pin Port | Port | Channel | default | PortMux | 18 PA2 | | 0-IN2 --- | PF2 !!! 19 PA3 | | 0-OUT --- | PF3 !!! PA4 | | --- --- | PA5 | | --- --- | PA6 | | --- 0-OUT | PA7 | | --- --- | PB3 | | --- --- | PC0 | | 1-IN0 --- | PC1 | | 1-IN1 --- | PC2 | | 1-IN2 --- | PC3 | | 1-OUT --- | PC7 | | --- --- | PD6 | | --- 2-OUT | PF0 | | 3-IN0 --- | PF1 | | 3-IN1 --- | */