/*
 * 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_ABCDEF_H
#define ECXX_PLATFORM_AVR_PIN_NAME_STD_ABCDEF_H


//
// Available ports : A B C D E F (no Arduino variant)
//

//
// The pin name specified below is based on the DT-AVR Inoduino board that was
// manufactured by Innovative Electronics:
//     http://www.innovativeelectronics.com/index.php?pg=ie_pdet&idp=29
//

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

// ADC pins
static constexpr uint8_t A0   = 39;
static constexpr uint8_t A1   = 40;
static constexpr uint8_t A2   = 41;
static constexpr uint8_t A3   = 42;
static constexpr uint8_t A4   = 43;
static constexpr uint8_t A5   = 44;
static constexpr uint8_t A6   = 45;
static constexpr uint8_t A7   = 46;

static constexpr uint8_t AMin = A6;
static constexpr uint8_t AMax = A7;

// PWM pins
static constexpr uint8_t PWM0 =  7;
static constexpr uint8_t PWM1 =  8;
static constexpr uint8_t PWM2 =  9;
static constexpr uint8_t PWM3 = 10;
static constexpr uint8_t PWM4 = 11;
static constexpr uint8_t PWM5 = 12;
static constexpr uint8_t PWM6 = 13; // Indicator LED

// Interrupt pins
static constexpr uint8_t EINT0 =  5;
static constexpr uint8_t EINT1 =  6;
static constexpr uint8_t EINT2 =  0;
static constexpr uint8_t EINT3 =  1;
static constexpr uint8_t EINT4 =  2;
static constexpr uint8_t EINT5 =  3;
static constexpr uint8_t EINT6 = 37;
static constexpr uint8_t EINT7 = 38;

// 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 = 25;
static constexpr uint8_t SPI_MOSI = 24;
static constexpr uint8_t SPI_SCK  = 23;
static constexpr uint8_t SPI_SS   = 22;

static constexpr uint8_t TWI_SDA  =  6;
static constexpr uint8_t TWI_SCL  =  5;

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


#endif
