/*
 * 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_ABCD_H
#define ECXX_PLATFORM_AVR_PIN_NAME_STD_ABCD_H


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

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

// ADC pins
static constexpr uint8_t A0   = 24;
static constexpr uint8_t A1   = 25;
static constexpr uint8_t A2   = 26;
static constexpr uint8_t A3   = 27;
static constexpr uint8_t A4   = 28;
static constexpr uint8_t A5   = 29;
static constexpr uint8_t A6   = 30;
static constexpr uint8_t A7   = 31;

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

// PWM pins
static constexpr uint8_t PWM0 = 5;
static constexpr uint8_t PWM1 = 4;
static constexpr uint8_t PWM2 = 7;
#if !defined(__AVR_ATmega16__) && !defined(__AVR_ATmega16A__) && !defined(__AVR_ATmega32__) && !defined(__AVR_ATmega32A__)
static constexpr uint8_t PWM3 = 6;
#endif

// Interrupt pins
static constexpr uint8_t EINT0 =  2;
static constexpr uint8_t EINT1 =  3;
static constexpr uint8_t EINT2 = 10;

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

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

static constexpr uint8_t SPI_MISO = 14;
static constexpr uint8_t SPI_MOSI = 13;
static constexpr uint8_t SPI_SCK  = 15;
static constexpr uint8_t SPI_SS   = 12;

static constexpr uint8_t TWI_SDA  = 17;
static constexpr uint8_t TWI_SCL  = 16;

// Analog comparator pins
static constexpr uint8_t AC_InPos = 10; /* AIN0 - PB 2 */
static constexpr uint8_t AC_InNeg = 11; /* AIN1 - PB 3 */


#endif
