/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef INCLUDE_ECXX_PLATFORM_AVR_PIN_NAME_STD_H
#error "this file cannot be included directly"
#endif
#undef INCLUDE_ECXX_PLATFORM_AVR_PIN_NAME_STD_H


#ifndef ECXX_PLATFORM_AVR_PIN_NAME_STD_ABCDEFGHXJKL_H
#define ECXX_PLATFORM_AVR_PIN_NAME_STD_ABCDEFGHXJKL_H


//
// Available ports : A B C D E F G H J K L (e.g. Arduino variant mega)
//

// Maximum digital pin number
static constexpr uint8_t DMax = 72;

// ADC pins
static constexpr uint8_t A0   = 54;
static constexpr uint8_t A1   = 55;
static constexpr uint8_t A2   = 56;
static constexpr uint8_t A3   = 57;
static constexpr uint8_t A4   = 58;
static constexpr uint8_t A5   = 59;
static constexpr uint8_t A6   = 60;
static constexpr uint8_t A7   = 61;
static constexpr uint8_t A8   = 62;
static constexpr uint8_t A9   = 63;
static constexpr uint8_t A10  = 64;
static constexpr uint8_t A11  = 65;
static constexpr uint8_t A12  = 66;
static constexpr uint8_t A13  = 67;
static constexpr uint8_t A14  = 68;
static constexpr uint8_t A15  = 69;

static constexpr uint8_t AMin =  A0;
static constexpr uint8_t AMax = A15;

// PWM pins
static constexpr uint8_t PWM0  = 11;
static constexpr uint8_t PWM1  = 12;
static constexpr uint8_t PWM2  = 10;
static constexpr uint8_t PWM3  =  9;
static constexpr uint8_t PWM4  =  5;
static constexpr uint8_t PWM5  =  6;
static constexpr uint8_t PWM6  =  7;
static constexpr uint8_t PWM7  =  8;
static constexpr uint8_t PWM8  = 46;
static constexpr uint8_t PWM9  = 45;
static constexpr uint8_t PWM10 = 44;

// Interrupt pins
static constexpr uint8_t EINT0 = 21;
static constexpr uint8_t EINT1 = 20;
static constexpr uint8_t EINT2 = 19;
static constexpr uint8_t EINT3 = 18;
static constexpr uint8_t EINT4 =  2;
static constexpr uint8_t EINT5 =  3;
static constexpr uint8_t EINT6 = 71; /** Not connected to any header pin in Arduino variant mega **/
static constexpr uint8_t EINT7 = 72; /** Not connected to any header pin in Arduino variant mega **/

// Communication pins
static constexpr uint8_t UART0_Rx =  0;
static constexpr uint8_t UART0_Tx =  1;

static constexpr uint8_t UART1_Rx = 19;
static constexpr uint8_t UART1_Tx = 18;

static constexpr uint8_t UART2_Rx = 17;
static constexpr uint8_t UART2_Tx = 16;

static constexpr uint8_t UART3_Rx = 15;
static constexpr uint8_t UART3_Tx = 14;

static constexpr uint8_t UART_Rx  = UART0_Rx;
static constexpr uint8_t UART_Tx  = UART0_Tx;

static constexpr uint8_t SPI_MISO = 50;
static constexpr uint8_t SPI_MOSI = 51;
static constexpr uint8_t SPI_SCK  = 52;
static constexpr uint8_t SPI_SS   = 53;

static constexpr uint8_t TWI_SDA  = 20;
static constexpr uint8_t TWI_SCL  = 21;

// Analog comparator pins
static constexpr uint8_t AC_InPos = 70; /* AIN0 - PE 2 */ /** Not connected to any header pin in Arduino variant mega **/
static constexpr uint8_t AC_InNeg =  5; /* AIN1 - PE 3 */


#endif
