/*
 * 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_XBCDEF_H
#define ECXX_PLATFORM_AVR_PIN_NAME_STD_XBCDEF_H


//
// Available ports : B C D E F (e.g. Arduino variant leonardo)
//

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

// ADC pins
static constexpr uint8_t A0   = 18;
static constexpr uint8_t A1   = 19;
static constexpr uint8_t A2   = 20;
static constexpr uint8_t A3   = 21;
static constexpr uint8_t A4   = 22;
static constexpr uint8_t A5   = 23;

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

// PWM pins
static constexpr uint8_t PWM0 =  5;
static constexpr uint8_t PWM1 =  6;
static constexpr uint8_t PWM2 =  9;
static constexpr uint8_t PWM3 = 10;

// Interrupt pins
static constexpr uint8_t EINT0 = 3;
static constexpr uint8_t EINT1 = 2;
static constexpr uint8_t EINT2 = 0;
static constexpr uint8_t EINT3 = 1;
static constexpr uint8_t EINT4 = 7;

// Communication pins
static constexpr uint8_t UART1_Rx =  0;
static constexpr uint8_t UART1_Tx =  1;

static constexpr uint8_t UART_Rx  = UART1_Rx;
static constexpr uint8_t UART_Tx  = UART1_Tx;

static constexpr uint8_t SPI_MISO = 14;
static constexpr uint8_t SPI_MOSI = 16;
static constexpr uint8_t SPI_SCK  = 15;
static constexpr uint8_t SPI_SS   = 17; /** Not connected to any header pin in Arduino variant leonardo **/

static constexpr uint8_t TWI_SDA  =  2;
static constexpr uint8_t TWI_SCL  =  3;

// Analog comparator pins
static constexpr uint8_t AC_InPos = 7; /* AIN0 - PE 6 */
static constexpr uint8_t AC_InNeg = InvalidPin;


#endif
