blob: 88d7fba000b4416fa743ffb40f48d28749e130b3 [file] [log] [blame]
/**
* \file
*
* \brief SAM3S-EK2 Board Definition.
*
* Copyright (c) 2011 - 2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
#ifndef _SAM3S_EK2_H_
#define _SAM3S_EK2_H_
#include "compiler.h"
#include "system_sam3sd8.h"
#include "exceptions.h"
/*
#define BOARD_REV_A
*/
#define BOARD_REV_B
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_opfreq "SAM3S-EK2 - Operating frequencies"
* This page lists several definition related to the board operating frequency
*
* \section Definitions
* - \ref BOARD_FREQ_*
* - \ref BOARD_MCK
*/
/** Board oscillator settings */
#define BOARD_FREQ_SLCK_XTAL (32768U)
#define BOARD_FREQ_SLCK_BYPASS (32768U)
#define BOARD_FREQ_MAINCK_XTAL (12000000U)
#define BOARD_FREQ_MAINCK_BYPASS (12000000U)
/** Master clock frequency */
#define BOARD_MCK CHIP_FREQ_CPU_MAX
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_board_info "SAM3S-EK2 - Board informations"
* This page lists several definition related to the board description.
*
* \section Definitions
* - \ref BOARD_NAME
*/
/** Name of the board */
#define BOARD_NAME "SAM3S-EK2"
/** Board definition */
#define sam3sek2
/** Family definition (already defined) */
#define sam3sd8
/** Core definition */
#define cortexm3
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_piodef "SAM3S-EK - PIO definitions"
* This pages lists all the pio definitions. The constants
* are named using the following convention: PIN_* for a constant which defines
* a single Pin instance (but may include several PIOs sharing the same
* controller), and PINS_* for a list of Pin instances.
*
* ADC
* - \ref PIN_ADC0_AD0
* - \ref PIN_ADC0_AD1
* - \ref PIN_ADC0_AD2
* - \ref PIN_ADC0_AD3
* - \ref PIN_ADC0_AD4
* - \ref PIN_ADC0_AD5
* - \ref PIN_ADC0_AD6
* - \ref PIN_ADC0_AD7
* - \ref PINS_ADC
*
* UART
* - \ref PINS_UART
*
* EBI
* - \ref PIN_EBI_DATA_BUS
* - \ref PIN_EBI_NRD
* - \ref PIN_EBI_NWE
* - \ref PIN_EBI_NCS0
* - \ref PIN_EBI_PSRAM_ADDR_BUS
* - \ref PIN_EBI_PSRAM_NBS
* - \ref PIN_EBI_A1
* - \ref PIN_EBI_NCS1
* - \ref PIN_EBI_LCD_RS
*
* LEDs
* - \ref PIN_LED_0
* - \ref PIN_LED_1
* - \ref PIN_LED_2
* - \ref PINS_LEDS
*
* HSMCI
* - \ref PINS_HSMCI
*
* Push buttons
* - \ref PIN_PUSHBUTTON_1
* - \ref PIN_PUSHBUTTON_2
* - \ref PINS_PUSHBUTTONS
* - \ref PUSHBUTTON_BP1
* - \ref PUSHBUTTON_BP2
*
* PWMC
* - \ref PIN_PWMC_PWMH0
* - \ref PIN_PWMC_PWML0
* - \ref PIN_PWMC_PWMH1
* - \ref PIN_PWMC_PWML1
* - \ref PIN_PWMC_PWMH2
* - \ref PIN_PWMC_PWML2
* - \ref PIN_PWMC_PWMH3
* - \ref PIN_PWMC_PWML3
* - \ref PIN_PWM_LED0
* - \ref PIN_PWM_LED1
* - \ref PIN_PWM_LED2
* - \ref CHANNEL_PWM_LED0
* - \ref CHANNEL_PWM_LED1
* - \ref CHANNEL_PWM_LED2
*
* SPI
* - \ref PIN_SPI_MISO
* - \ref PIN_SPI_MOSI
* - \ref PIN_SPI_SPCK
* - \ref PINS_SPI
* - \ref PIN_SPI_NPCS0_PA11
*
* SSC
* - \ref PIN_SSC_TD
* - \ref PIN_SSC_TK
* - \ref PIN_SSC_TF
* - \ref PINS_SSC_CODEC
*
* PCK0
* - \ref PIN_PCK0
*
* PIO PARALLEL CAPTURE
* - \ref PIN_PIODCEN1
* - \ref PIN_PIODCEN2
*
* TWI
* - \ref TWI_V3XX
* - \ref PIN_TWI_TWD0
* - \ref PIN_TWI_TWCK0
* - \ref PINS_TWI0
* - \ref PIN_TWI_TWD1
* - \ref PIN_TWI_TWCK1
* - \ref PINS_TWI1
*
* USART0
* - \ref PIN_USART0_RXD
* - \ref PIN_USART0_TXD
* - \ref PIN_USART0_CTS
* - \ref PIN_USART0_RTS
* - \ref PIN_USART0_SCK
*
* USB
* - \ref PIN_USB_VBUS
*
* NandFlash
* - \ref PIN_EBI_NANDOE
* - \ref PIN_EBI_NANDWE
* - \ref PIN_EBI_NANDCLE
* - \ref PIN_EBI_NANDALE
* - \ref PIN_EBI_NANDIO
* - \ref BOARD_NF_CE_PIN
* - \ref BOARD_NF_RB_PIN
* - \ref PINS_NANDFLASH
*
* QTouch
* PIO definitions for Slider
* \ref SLIDER_IOMASK_SNS
* \ref SLIDER_IOMASK_SNSK
* \ref PINS_SLIDER_SNS
* \ref PINS_SLIDER_SNSK
*
* PIO definitions for keys
* \ref KEY_IOMASK_SNS
* \ref KEY_IOMASK_SNSK
* \ref PINS_KEY_SNS
* \ref PINS_KEY_SNSK
*
* PIOS for QTouch
* \ref PINS_QTOUCH
*/
/** ADC_AD0 pin definition. */
#define PIN_ADC0_AD0 {1 << 21, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD1 pin definition. */
#define PIN_ADC0_AD1 {1 << 30, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD2 pin definition. */
#define PIN_ADC0_AD2 {1 << 3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD3 pin definition. */
#define PIN_ADC0_AD3 {1 << 4, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD4 pin definition. */
#define PIN_ADC0_AD4 {1 << 15, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD5 pin definition. */
#define PIN_ADC0_AD5 {1 << 16, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD6 pin definition. */
#define PIN_ADC0_AD6 {1 << 17, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/** ADC_AD7 pin definition. */
#define PIN_ADC0_AD7 {1 << 18, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/** Pins ADC */
#define PINS_ADC PIN_ADC0_AD0, PIN_ADC0_AD1, PIN_ADC0_AD2, PIN_ADC0_AD3, PIN_ADC0_AD4, PIN_ADC0_AD5, PIN_ADC0_AD6, PIN_ADC0_AD7
#define PINS_ADC_TRIG PIO_PA8_IDX
#define PINS_ADC_TRIG_FLAG (PIO_PERIPH_B | PIO_DEFAULT)
/** Startup time max, return from Idle mode (in ┬Ás) */
#define ADC_STARTUP_TIME_MAX 15
/** Track and hold Acquisition Time min (in ns) */
#define ADC_TRACK_HOLD_TIME_MIN 1200
/** ADC clock frequency */
#define BOARD_ADC_FREQ (6000000)
/** UART pins (UTXD0 and URXD0) definitions, PA9,10. */
#define PINS_UART (PIO_PA9A_URXD0 | PIO_PA10A_UTXD0)
#define PINS_UART_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
#define PINS_UART_MASK PIO_PA9A_URXD0|PIO_PA10A_UTXD0
#define PINS_UART_PIO PIOA
#define PINS_UART_ID ID_PIOA
#define PINS_UART_TYPE PIO_PERIPH_A
#define PINS_UART_ATTR PIO_DEFAULT
/** EBI Data Bus pins */
#define PIN_EBI_DATA_BUS_D0 PIO_PC0_IDX
#define PIN_EBI_DATA_BUS_D1 PIO_PC1_IDX
#define PIN_EBI_DATA_BUS_D2 PIO_PC2_IDX
#define PIN_EBI_DATA_BUS_D3 PIO_PC3_IDX
#define PIN_EBI_DATA_BUS_D4 PIO_PC4_IDX
#define PIN_EBI_DATA_BUS_D5 PIO_PC5_IDX
#define PIN_EBI_DATA_BUS_D6 PIO_PC6_IDX
#define PIN_EBI_DATA_BUS_D7 PIO_PC7_IDX
#define PIN_EBI_DATA_BUS_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_DATA_BUS_MASK 0xFF
#define PIN_EBI_DATA_BUS_PIO PIOC
#define PIN_EBI_DATA_BUS_ID ID_PIOC
#define PIN_EBI_DATA_BUS_TYPE PIO_PERIPH_A
#define PIN_EBI_DATA_BUS_ATTR PIO_PULLUP
/** EBI NRD pin */
#define PIN_EBI_NRD PIO_PC11_IDX
#define PIN_EBI_NRD_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_NRD_MASK 1 << 11
#define PIN_EBI_NRD_PIO PIOC
#define PIN_EBI_NRD_ID ID_PIOC
#define PIN_EBI_NRD_TYPE PIO_PERIPH_A
#define PIN_EBI_NRD_ATTR PIO_PULLUP
/** EBI NWE pin */
#define PIN_EBI_NWE PIO_PC8_IDX
#define PIN_EBI_NWE_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_NWE_MASK 1 << 8
#define PIN_EBI_NWE_PIO PIOC
#define PIN_EBI_NWE_ID ID_PIOC
#define PIN_EBI_NWE_TYPE PIO_PERIPH_A
#define PIN_EBI_NWE_ATTR PIO_PULLUP
/** EBI NCS0 pin */
#define PIN_EBI_NCS0 PIO_PC14_IDX
#define PIN_EBI_NCS0_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_NCS0_MASK 1 << 14
#define PIN_EBI_NCS0_PIO PIOC
#define PIN_EBI_NCS0_ID ID_PIOC
#define PIN_EBI_NCS0_TYPE PIO_PERIPH_A
#define PIN_EBI_NCS0_ATTR PIO_PULLUP
/** EBI address bus pins */
#define PIN_EBI_ADDR_BUS_A0 PIO_PC18_IDX
#define PIN_EBI_ADDR_BUS_A1 PIO_PC19_IDX
#define PIN_EBI_ADDR_BUS_A2 PIO_PC20_IDX
#define PIN_EBI_ADDR_BUS_A3 PIO_PC21_IDX
#define PIN_EBI_ADDR_BUS_A4 PIO_PC22_IDX
#define PIN_EBI_ADDR_BUS_A5 PIO_PC23_IDX
#define PIN_EBI_ADDR_BUS_A6 PIO_PC24_IDX
#define PIN_EBI_ADDR_BUS_A7 PIO_PC25_IDX
#define PIN_EBI_ADDR_BUS_A8 PIO_PC26_IDX
#define PIN_EBI_ADDR_BUS_A9 PIO_PC27_IDX
#define PIN_EBI_ADDR_BUS_A10 PIO_PC28_IDX
#define PIN_EBI_ADDR_BUS_A11 PIO_PC29_IDX
#define PIN_EBI_ADDR_BUS_A12 PIO_PC30_IDX
#define PIN_EBI_ADDR_BUS_A13 PIO_PC31_IDX
#define PIN_EBI_ADDR_BUS_FLAG1 PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_ADDR_BUS_A14 PIO_PA18_IDX
#define PIN_EBI_ADDR_BUS_A15 PIO_PA19_IDX
#define PIN_EBI_ADDR_BUS_A16 PIO_PA20_IDX
#define PIN_EBI_ADDR_BUS_A17 PIO_PA0_IDX
#define PIN_EBI_ADDR_BUS_A18 PIO_PA1_IDX
#define PIN_EBI_ADDR_BUS_A19 PIO_PA23_IDX
#define PIN_EBI_ADDR_BUS_A20 PIO_PA24_IDX
#define PIN_EBI_ADDR_BUS_FLAG2 PIO_PERIPH_C | PIO_PULLUP
/** EBI pin for LCD CS */
#define PIN_EBI_NCS1 PIO_PC15_IDX
#define PIN_EBI_NCS1_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_NCS1_MASK 1 << 15
#define PIN_EBI_NCS1_PIO PIOC
#define PIN_EBI_NCS1_ID ID_PIOC
#define PIN_EBI_NCS1_TYPE PIO_PERIPH_A
#define PIN_EBI_NCS1_ATTR PIO_PULLUP
/** EBI pin for LCD RS */
#define PIN_EBI_LCD_RS PIO_PC19_IDX
#define PIN_EBI_LCD_RS_FLAGS PIO_PERIPH_A | PIO_PULLUP
#define PIN_EBI_LCD_RS_MASK 1 << 19
#define PIN_EBI_LCD_RS_PIO PIOC
#define PIN_EBI_LCD_RS_ID ID_PIOC
#define PIN_EBI_LCD_RS_TYPE PIO_PERIPH_A
#define PIN_EBI_LCD_RS_ATTR PIO_PULLUP
#define LED_BLUE 0
#define LED_GREEN 1
#define LED_RED 2
#ifdef BOARD_REV_A
/** LED #0 pin definition (BLUE). */
#define LED_0_NAME "blue LED D2"
#define LED0_GPIO (PIO_PC20_IDX)
#define LED0_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_0 {PIO_PC20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
#define PIN_LED_0_MASK PIO_PC20
#define PIN_LED_0_PIO PIOC
#define PIN_LED_0_ID ID_PIOC
#define PIN_LED_0_TYPE PIO_OUTPUT_1
#define PIN_LED_0_ATTR PIO_DEFAULT
/** LED #1 pin definition (GREEN). */
#define LED_1_NAME "green LED D3"
#define LED1_GPIO (PIO_PC21_IDX)
#define LED1_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_1 {PIO_PC21, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
/** LED #2 pin definition (RED). */
#define LED2_GPIO (PIO_PC22_IDX)
#define LED2_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_2 {PIO_PC22, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
#endif
#ifdef BOARD_REV_B
/** LED #0 pin definition (BLUE). */
#define LED_0_NAME "blue LED D2"
#define LED0_GPIO (PIO_PA19_IDX)
#define LED0_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_0 {PIO_PA19, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define PIN_LED_0_MASK PIO_PA19
#define PIN_LED_0_PIO PIOA
#define PIN_LED_0_ID ID_PIOA
#define PIN_LED_0_TYPE PIO_OUTPUT_1
#define PIN_LED_0_ATTR PIO_DEFAULT
/** LED #1 pin definition (GREEN). */
#define LED_1_NAME "green LED D3"
#define LED1_GPIO (PIO_PA20_IDX)
#define LED1_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_1 {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
#define PIN_LED_1_MASK PIO_PA20
#define PIN_LED_1_PIO PIOA
#define PIN_LED_1_ID ID_PIOA
#define PIN_LED_1_TYPE PIO_OUTPUT_1
#define PIN_LED_1_ATTR PIO_DEFAULT
/** LED #2 pin definition (RED). */
#define LED2_GPIO (PIO_PC20_IDX)
#define LED2_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
#define PIN_LED_2 {PIO_PC20, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
#endif
/** List of all LEDs definitions. */
#define PINS_LEDS PIN_LED_0, PIN_LED_1, PIN_LED_2
/** HSMCI pins definition. */
#define PINS_HSMCI {0x3fUL << 26, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_PULLUP}
/** HSMCI pin Card Detect. */
#ifdef BOARD_REV_A
#define PIN_HSMCI_CD {PIO_PA15, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#endif
#ifdef BOARD_REV_B
#define PIN_HSMCI_CD {PIO_PA6, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#endif
/** Push button #0 definition. Attributes = pull-up + debounce + interrupt on rising edge. */
#define PUSHBUTTON_1_NAME "USRPB1"
#define GPIO_PUSH_BUTTON_1 (PIO_PB3_IDX)
#define GPIO_PUSH_BUTTON_1_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE)
#define PIN_PUSHBUTTON_1 {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE}
#define PIN_PUSHBUTTON_1_MASK PIO_PB3
#define PIN_PUSHBUTTON_1_PIO PIOB
#define PIN_PUSHBUTTON_1_ID ID_PIOB
#define PIN_PUSHBUTTON_1_TYPE PIO_INPUT
#define PIN_PUSHBUTTON_1_ATTR PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_RISE_EDGE
/** Push button #1 definition. Attributes = pull-up + debounce + interrupt on falling edge. */
#define PUSHBUTTON_2_NAME "USRPB2"
#define GPIO_PUSH_BUTTON_2 (PIO_PC12_IDX)
#define GPIO_PUSH_BUTTON_2_FLAGS (PIO_INPUT | PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_FALL_EDGE)
#define PIN_PUSHBUTTON_2 {PIO_PC12, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_FALL_EDGE}
#define PIN_PUSHBUTTON_2_MASK PIO_PC12
#define PIN_PUSHBUTTON_2_PIO PIOC
#define PIN_PUSHBUTTON_2_ID ID_PIOC
#define PIN_PUSHBUTTON_2_TYPE PIO_INPUT
#define PIN_PUSHBUTTON_2_ATTR PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_FALL_EDGE
/** List of all push button definitions. */
#define PINS_PUSHBUTTONS PIN_PUSHBUTTON_1, PIN_PUSHBUTTON_2
/** Push button #1 index. */
#define PUSHBUTTON_BP1 0
/** Push button #2 index. */
#define PUSHBUTTON_BP2 1
#define PIN_TC0_TIOA0 (PIO_PA0_IDX)
#define PIN_TC0_TIOA0_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define PIN_TC0_TIOA1 (PIO_PA15_IDX)
#define PIN_TC0_TIOA1_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define PIN_TC0_TIOA1_PIO PIOA
#define PIN_TC0_TIOA1_MASK PIO_PA15
#define PIN_TC0_TIOA1_ID ID_PIOA
#define PIN_TC0_TIOA1_TYPE PIO_PERIPH_B
#define PIN_TC0_TIOA1_ATTR PIO_DEFAULT
#define PIN_TC0_TIOA2 (PIO_PA26_IDX)
#define PIN_TC0_TIOA2_FLAGS (PIO_INPUT | PIO_DEFAULT)
#define PIN_TC0_TIOA2_PIO PIOA
#define PIN_TC0_TIOA2_MASK PIO_PA26
#define PIN_TC0_TIOA2_ID ID_PIOA
#define PIN_TC0_TIOA2_TYPE PIO_INPUT
#define PIN_TC0_TIOA2_ATTR PIO_DEFAULT
/** PWMC PWM0 pin definition: Output High. */
#define PIN_PWMC_PWMH0 {PIO_PC18B_PWMH0, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT}
#define PIN_PWMC_PWMH0_TRIG PIO_PC18_IDX
#define PIN_PWMC_PWMH0_TRIG_FLAG PIO_PERIPH_B | PIO_DEFAULT
/** PWMC PWM0 pin definition: Output Low. */
#define PIN_PWMC_PWML0 {PIO_PA19B_PWML0, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/** PWMC PWM1 pin definition: Output High. */
#define PIN_PWMC_PWMH1 {PIO_PC19B_PWMH1, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT}
/** PWMC PWM1 pin definition: Output Low. */
#define PIN_PWMC_PWML1 {PIO_PA20B_PWML1, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/** PWMC PWM2 pin definition: Output High. */
#define PIN_PWMC_PWMH2 {PIO_PC20B_PWMH2, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT}
/** PWMC PWM2 pin definition: Output Low. */
#define PIN_PWMC_PWML2 {PIO_PA16C_PWML2, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT}
/** PWMC PWM3 pin definition: Output High. */
#define PIN_PWMC_PWMH3 {PIO_PC21B_PWMH3, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT}
/** PWMC PWM3 pin definition: Output Low. */
#define PIN_PWMC_PWML3 {PIO_PA15C_PWML3, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT}
/** PWM pins definition for LED0 */
#define PIN_PWM_LED0 PIN_PWMC_PWMH0, PIN_PWMC_PWML0
/** PWM pins definition for LED1 */
#define PIN_PWM_LED1 PIN_PWMC_PWMH1, PIN_PWMC_PWML1
/** PWM pins definition for LED2 */
#define PIN_PWM_LED2 PIN_PWMC_PWMH2, PIN_PWMC_PWML2
/** PWM channel for LED0 */
#define CHANNEL_PWM_LED0 0
/** PWM channel for LED1 */
#define CHANNEL_PWM_LED1 1
/** PWM channel for LED2 */
#define CHANNEL_PWM_LED2 2
/** PWM LED0 pin definitions. */
#define PIN_PWM_LED0_GPIO PIO_PA19_IDX
#define PIN_PWM_LED0_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define PIN_PWM_LED0_CHANNEL PWM_CHANNEL_0
/** PWM LED1 pin definitions. */
#define PIN_PWM_LED1_GPIO PIO_PA20_IDX
#define PIN_PWM_LED1_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define PIN_PWM_LED1_CHANNEL PWM_CHANNEL_1
/** PWM LED2 pin definitions. */
#define PIN_PWM_LED2_GPIO PIO_PC20_IDX
#define PIN_PWM_LED2_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
/** SPI MISO pin definition. */
#define PIN_SPI_MISO {PIO_PA12A_MISO, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SPI MOSI pin definition. */
#define PIN_SPI_MOSI {PIO_PA13A_MOSI, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SPI SPCK pin definition. */
#define PIN_SPI_SPCK {PIO_PA14A_SPCK, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SPI chip select pin definition. */
#define PIN_SPI_NPCS0_PA11 {PIO_PA11A_NPCS0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** List of SPI pin definitions (MISO, MOSI & SPCK). */
#define PINS_SPI PIN_SPI_MISO, PIN_SPI_MOSI, PIN_SPI_SPCK
/** SPI MISO pin definition. */
#define SPI_MISO_GPIO (PIO_PA12_IDX)
#define SPI_MISO_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI MOSI pin definition. */
#define SPI_MOSI_GPIO (PIO_PA13_IDX)
#define SPI_MOSI_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI SPCK pin definition. */
#define SPI_SPCK_GPIO (PIO_PA14_IDX)
#define SPI_SPCK_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI chip select 0 pin definition. (Only one configuration is possible) */
#define SPI_NPCS0_GPIO (PIO_PA11_IDX)
#define SPI_NPCS0_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** SPI chip select 1 pin definition. (multiple configurations are possible) */
#define SPI_NPCS1_PA9_GPIO (PIO_PA9_IDX)
#define SPI_NPCS1_PA9_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define SPI_NPCS1_PA31_GPIO (PIO_PA31_IDX)
#define SPI_NPCS1_PA31_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
#define SPI_NPCS1_PB14_GPIO (PIO_PB14_IDX)
#define SPI_NPCS1_PB14_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
#define SPI_NPCS1_PC4_GPIO (PIO_PC4_IDX)
#define SPI_NPCS1_PC4_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
/** SPI chip select 2 pin definition. (multiple configurations are possible) */
#define SPI_NPCS2_PA10_GPIO (PIO_PA10_IDX)
#define SPI_NPCS2_PA10_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define SPI_NPCS2_PA30_GPIO (PIO_PA30_IDX)
#define SPI_NPCS2_PA30_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define SPI_NPCS2_PB2_GPIO (PIO_PB2_IDX)
#define SPI_NPCS2_PB2_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
/** SPI chip select 3 pin definition. (multiple configurations are possible) */
#define SPI_NPCS3_PA3_GPIO (PIO_PA3_IDX)
#define SPI_NPCS3_PA3_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define SPI_NPCS3_PA5_GPIO (PIO_PA5_IDX)
#define SPI_NPCS3_PA5_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define SPI_NPCS3_PA22_GPIO (PIO_PA22_IDX)
#define SPI_NPCS3_PA22_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
/** SSC pin Transmitter Data (TD) */
#define PIN_SSC_TD {PIO_PA17A_TD, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SSC pin Transmitter Clock (TK) */
#define PIN_SSC_TK {PIO_PA16A_TK, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SSC pin Transmitter FrameSync (TF) */
#define PIN_SSC_TF {PIO_PA15A_TF, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SSC pins definition for codec. */
#define PINS_SSC_CODEC PIN_SSC_TD, PIN_SSC_TK, PIN_SSC_TF
/** PCK0 */
#define PIN_PCK0 (PIO_PA6_IDX)
#define PIN_PCK0_FLAGS (PIO_PERIPH_B | PIO_DEFAULT)
#define PIN_PCK_0_MASK PIO_PA6
#define PIN_PCK_0_PIO PIOA
#define PIN_PCK_0_ID ID_PIOA
#define PIN_PCK_0_TYPE PIO_PERIPH_B
#define PIN_PCK_0_ATTR PIO_DEFAULT
#define PIN_PCK1 {PIO_PA17B_PCK1,PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
#define PIN_PCK_1_MASK PIO_PA17
#define PIN_PCK_1_PIO PIOA
#define PIN_PCK_1_ID ID_PIOA
#define PIN_PCK_1_TYPE PIO_PERIPH_B
#define PIN_PCK_1_ATTR PIO_DEFAULT
/** PIO PARALLEL CAPTURE */
/** Parallel Capture Mode Data Enable1 */
#define PIN_PIODCEN1 PIO_PA15
/** Parallel Capture Mode Data Enable2 */
#define PIN_PIODCEN2 PIO_PA16
/** TWI ver 3.xx */
#define TWI_V3XX
/** TWI0 data pin */
#define PIN_TWI_TWD0 {PIO_PA3A_TWD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI0 clock pin */
#define PIN_TWI_TWCK0 {PIO_PA4A_TWCK0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI0 pins */
#define PINS_TWI0 PIN_TWI_TWD0, PIN_TWI_TWCK0
/** TWI1 data pin */
#define PIN_TWI_TWD1 {PIO_PB4A_TWD1, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI1 clock pin */
#define PIN_TWI_TWCK1 {PIO_PB5A_TWCK1, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI1 pins */
#define PINS_TWI1 PIN_TWI_TWD1, PIN_TWI_TWCK1
/** USART0 pin RX */
#define PIN_USART0_RXD {PIO_PA5A_RXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART0_RXD_IDX (PIO_PA5_IDX)
#define PIN_USART0_RXD_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART0 pin TX */
#define PIN_USART0_TXD {PIO_PA6A_TXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART0_TXD_IDX (PIO_PA6_IDX)
#define PIN_USART0_TXD_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART0 pin CTS */
#define PIN_USART0_CTS {PIO_PA8A_CTS0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART0_CTS_IDX (PIO_PA8_IDX)
#define PIN_USART0_CTS_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART0 pin RTS */
#define PIN_USART0_RTS {PIO_PA7A_RTS0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART0_RTS_IDX (PIO_PA7_IDX)
#define PIN_USART0_RTS_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART0 pin SCK */
#define PIN_USART0_SCK {PIO_PA2B_SCK0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART0_SCK_IDX (PIO_PA2_IDX)
#define PIN_USART0_SCK_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART1 pin RX */
#define PIN_USART1_RXD {PIO_PA21A_RXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART1_RXD_IDX (PIO_PA21_IDX)
#define PIN_USART1_RXD_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART1 pin TX */
#define PIN_USART1_TXD {PIO_PA22A_TXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART1_TXD_IDX (PIO_PA22_IDX)
#define PIN_USART1_TXD_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART1 pin CTS */
#define PIN_USART1_CTS {PIO_PA25A_CTS1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART1_CTS_IDX (PIO_PA25_IDX)
#define PIN_USART1_CTS_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART1 pin RTS */
#define PIN_USART1_RTS {PIO_PA24A_RTS1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART1_RTS_IDX (PIO_PA24_IDX)
#define PIN_USART1_RTS_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USART1 pin ENABLE */
#define PIN_USART1_EN {PIO_PA23A_SCK1, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
#define PIN_USART1_EN_IDX (PIO_PA23_IDX)
#define PIN_USART1_EN_FLAGS (PIO_OUTPUT_0 | PIO_DEFAULT)
/** USART1 pin SCK */
#define PIN_USART1_SCK {PIO_PA23A_SCK1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_USART1_SCK_IDX (PIO_PA23_IDX)
#define PIN_USART1_SCK_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
/** USB VBus monitoring pin definition. */
#ifdef BOARD_REV_A
#define PIN_USB_VBUS {PIO_PC23, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP}
#endif
#ifdef BOARD_REV_B
#define PIN_USB_VBUS {PIO_PC21, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP}
#endif
/** NandFlash pins definition: OE. */
#define PIN_EBI_NANDOE (PIO_PC9_IDX)
#define PIN_EBI_NANDOE_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** NandFlash pins definition: WE. */
#define PIN_EBI_NANDWE (PIO_PC10_IDX)
#define PIN_EBI_NANDWE_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** NandFlash pins definition: CLE. */
#define PIN_EBI_NANDCLE (PIO_PC17_IDX)
#define PIN_EBI_NANDCLE_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** NandFlash pins definition: ALE. */
#define PIN_EBI_NANDALE (PIO_PC16_IDX)
#define PIN_EBI_NANDALE_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** NandFlash pins definition: DATA. */
#define PIN_EBI_NANDIO_0 (PIO_PC0_IDX)
#define PIN_EBI_NANDIO_0_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_1 (PIO_PC1_IDX)
#define PIN_EBI_NANDIO_1_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_2 (PIO_PC2_IDX)
#define PIN_EBI_NANDIO_2_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_3 (PIO_PC3_IDX)
#define PIN_EBI_NANDIO_3_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_4 (PIO_PC4_IDX)
#define PIN_EBI_NANDIO_4_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_5 (PIO_PC5_IDX)
#define PIN_EBI_NANDIO_5_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_6 (PIO_PC6_IDX)
#define PIN_EBI_NANDIO_6_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
#define PIN_EBI_NANDIO_7 (PIO_PC7_IDX)
#define PIN_EBI_NANDIO_7_FLAGS (PIO_PERIPH_A | PIO_PULLUP)
/** Nandflash chip enable pin definition. */
#define PIN_NF_CE_IDX (PIO_PC14_IDX)
#define PIN_NF_CE_FLAGS (PIO_TYPE_PIO_OUTPUT_1 | PIO_DEFAULT)
/** Nandflash ready/busy pin definition. */
#define PIN_NF_RB_IDX (PIO_PC18_IDX)
#define PIN_NF_RB_FLAGS (PIO_INPUT | PIO_PULLUP)
/* Chip select number for nand */
#define BOARD_NAND_CS 0
/* PIO definitions for Slider */
#define SLIDER_IOMASK_SNS (uint32_t)(PIO_PA0 | PIO_PA2 | PIO_PA4)
#define SLIDER_IOMASK_SNSK (uint32_t)(PIO_PA1 | PIO_PA3 | PIO_PA5)
#define PINS_SLIDER_SNS {SLIDER_IOMASK_SNS, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
#define PINS_SLIDER_SNSK {SLIDER_IOMASK_SNSK, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
/* PIO definitions for keys */
#define KEY_IOMASK_SNS (uint32_t)(PIO_PC22 | PIO_PC24 | PIO_PC26 | PIO_PC28 | PIO_PC30)
#define KEY_IOMASK_SNSK (uint32_t)(PIO_PC23 | PIO_PC25 | PIO_PC27 | PIO_PC29 | PIO_PC31)
#define PINS_KEY_SNS {KEY_IOMASK_SNS, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
#define PINS_KEY_SNSK {KEY_IOMASK_SNSK, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/* PIOS for QTouch */
#define PINS_QTOUCH PINS_SLIDER_SNS, PINS_SLIDER_SNSK, PINS_KEY_SNS, PINS_KEY_SNSK
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_usb "SAM3S-EK - USB device"
*
* \section Definitions
* - \ref BOARD_USB_BMATTRIBUTES
* - \ref CHIP_USB_UDP
* - \ref CHIP_USB_PULLUP_INTERNAL
* - \ref CHIP_USB_NUMENDPOINTS
* - \ref CHIP_USB_ENDPOINTS_MAXPACKETSIZE
* - \ref CHIP_USB_ENDPOINTS_BANKS
*/
/** USB attributes configuration descriptor (bus or self powered, remote wakeup) */
#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_RWAKEUP
/** Indicates chip has an UDP Full Speed. */
#define CHIP_USB_UDP
/** Indicates chip has an internal pull-up. */
#define CHIP_USB_PULLUP_INTERNAL
/** Number of USB endpoints */
#define CHIP_USB_NUMENDPOINTS 8
/** Endpoints max packet size */
#define CHIP_USB_ENDPOINTS_MAXPACKETSIZE(i) \
((i == 0) ? 64 : \
((i == 1) ? 64 : \
((i == 2) ? 64 : \
((i == 3) ? 64 : \
((i == 4) ? 512 : \
((i == 5) ? 512 : \
((i == 6) ? 64 : \
((i == 7) ? 64 : 0 ))))))))
/** Endpoints Number of Bank */
#define CHIP_USB_ENDPOINTS_BANKS(i) \
((i == 0) ? 1 : \
((i == 1) ? 2 : \
((i == 2) ? 2 : \
((i == 3) ? 1 : \
((i == 4) ? 2 : \
((i == 5) ? 2 : \
((i == 6) ? 2 : \
((i == 7) ? 2 : 0 ))))))))
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_extcomp "SAM3S-EK - External components"
* This page lists the definitions related to external on-board components
* located in the board.h file for the SAM3S-EK.
*
* SD Card
* - \ref BOARD_SD_PINS
* - \ref BOARD_SD_PIN_CD
*
* LCD
* - \ref BOARD_LCD_ILI9325
* - \ref BOARD_LCD_PINS
* - \ref BOARD_BACKLIGHT_PIN
* - \ref BOARD_LCD_BASE
* - \ref BOARD_LCD_RS
*
* TouchScreen
* - \ref BOARD_TSC_ADS7843
* - \ref PIN_TCS_IRQ
* - \ref PIN_TCS_BUSY
* - \ref BOARD_TSC_SPI_BASE
* - \ref BOARD_TSC_SPI_ID
* - \ref BOARD_TSC_SPI_PINS
* - \ref BOARD_TSC_NPCS
* - \ref BOARD_TSC_NPCS_PIN
*
* SmartCard
* - \ref SMARTCARD_CONNECT_PIN
* - \ref PIN_ISO7816_RSTMC
* - \ref PINS_ISO7816
*/
/** HSMCI pins that shall be configured to access the SD card. */
#define BOARD_SD_PINS PINS_HSMCI
/** HSMCI Card Detect pin. */
#define BOARD_SD_PIN_CD PIN_HSMCI_CD
/** Indicates board has an ILI9325 external component to manage LCD. */
#define BOARD_LCD_ILI9325
/** Backlight pin definition. */
#define BOARD_BACKLIGHT PIO_PC13_IDX
#define BOARD_BACKLIGHT_FLAG PIO_OUTPUT_0 | PIO_DEFAULT
#define BOARD_BACKLIGHT_PIN {PIO_PC13, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}
#define PIN_BOARD_BACKLIGHT_MASK PIO_PC13
#define PIN_BOARD_BACKLIGHT_PIO PIOC
#define PIN_BOARD_BACKLIGHT_ID ID_PIOC
#define PIN_BOARD_BACKLIGHT_TYPE PIO_OUTPUT_0
#define PIN_BOARD_BACKLIGHT_ATTR PIO_PULLUP
/** Define ILI9325 base address. */
#define BOARD_LCD_BASE 0x61000000
/** Define ILI9325 register select signal. */
#define BOARD_LCD_RS (1 << 1)
/** Indicates board has an ADS7843 external component to manage Touch Screen */
#define BOARD_TSC_ADS7843
/** Definition of MMA7341L x,y,z axis channel number */
#define MMA7341L_ADC_CHANNEL_X 2
#define MMA7341L_ADC_CHANNEL_Y 6
#define MMA7341L_ADC_CHANNEL_Z 7
/** MMA7341L mode set pin definition. */
#define PIN_MMA7341L_MODE PIO_PC13_IDX
#define PIN_MMA7341L_MODE_FLAG PIO_OUTPUT_1 | PIO_DEFAULT
/** MMA7341L X,Y,Z axis pin definition. */
#define PIN_MMA7341L_X_AXIS PIO_PB3_IDX
#define PIN_MMA7341L_X_AXIS_FLAG PIO_INPUT | PIO_DEFAULT
#define PIN_MMA7341L_Y_AXIS PIO_PC17_IDX
#define PIN_MMA7341L_Y_AXIS_FLAG PIO_INPUT | PIO_DEFAULT
#define PIN_MMA7341L_Z_AXIS PIO_PC18_IDX
#define PIN_MMA7341L_Z_AXIS_FLAG PIO_INPUT | PIO_DEFAULT
/** Touchscreen controller IRQ pin definition. */
#ifdef BOARD_REV_A
#define PIN_TSC_IRQ_IDX PIO_PA4_IDX
#define PIN_TSC_IRQ_FLAG PIO_INPUT | PIO_PULLUP
#define PIN_TSC_IRQ {PIO_PA4, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#define PIN_TSC_IRQ_MASK PIO_PA4
#define PIN_TSC_IRQ_PIO PIOA
#define PIN_TSC_IRQ_ID ID_PIOA
#define PIN_TSC_IRQ_TYPE PIO_INPUT
#define PIN_TSC_IRQ_ATTR PIO_PULLUP
#define PIN_TSC_IRQ_WUP_ID (1 << 3)
/** Touchscreen controller Busy pin definition. */
#define PIN_TSC_BUSY_IDX PIO_PA5_IDX
#define PIN_TSC_BUSY_FLAG PIO_INPUT | PIO_PULLUP
#define PIN_TSC_BUSY {PIO_PA5, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#define PIN_TSC_BUSY_MASK PIO_PA5
#define PIN_TSC_BUSY_PIO PIOA
#define PIN_TSC_BUSY_ID ID_PIOA
#define PIN_TSC_BUSY_TYPE PIO_INPUT
#define PIN_TSC_BUSY_ATTR PIO_PULLUP
#endif
#ifdef BOARD_REV_B
#define PIN_TSC_IRQ_IDX PIO_PA16_IDX
#define PIN_TSC_IRQ_FLAG PIO_INPUT | PIO_PULLUP
#define PIN_TSC_IRQ {PIO_PA16, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#define PIN_TSC_IRQ_MASK PIO_PA16
#define PIN_TSC_IRQ_PIO PIOA
#define PIN_TSC_IRQ_ID ID_PIOA
#define PIN_TSC_IRQ_TYPE PIO_INPUT
#define PIN_TSC_IRQ_ATTR PIO_PULLUP
#define PIN_TSC_IRQ_WUP_ID (1 << 15)
/** Touchscreen controller Busy pin definition. */
#define PIN_TSC_BUSY_IDX PIO_PA17_IDX
#define PIN_TSC_BUSY_FLAG PIO_INPUT | PIO_PULLUP
#define PIN_TSC_BUSY {PIO_PA17, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP}
#define PIN_TSC_BUSY_MASK PIO_PA17
#define PIN_TSC_BUSY_PIO PIOA
#define PIN_TSC_BUSY_ID ID_PIOA
#define PIN_TSC_BUSY_TYPE PIO_INPUT
#define PIN_TSC_BUSY_ATTR PIO_PULLUP
#endif
/** Base address of SPI peripheral connected to the touchscreen controller. */
#define BOARD_TSC_SPI_BASE SPI
/** Identifier of SPI peripheral connected to the touchscreen controller. */
#define BOARD_TSC_SPI_ID ID_SPI
/** Pins of the SPI peripheral connected to the touchscreen controller. */
#define BOARD_TSC_SPI_PINS PINS_SPI
/** Chip select connected to the touchscreen controller. */
#define BOARD_TSC_NPCS 0
/** Chip select pin connected to the touchscreen controller. */
#define BOARD_TSC_NPCS_PIN PIN_SPI_NPCS0_PA11
/// Smartcard detection pin
//#define SMARTCARD_CONNECT_PIN {1 << 13, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
/// PIN used for reset the smartcard
#define PIN_ISO7816_RSTMC {1 << 11, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/// Pins used for connect the smartcard
#define PINS_ISO7816 PIN_USART1_TXD, PIN_USART1_SCK, PIN_ISO7816_RSTMC
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_mem "SAM3S-EK - Memories"
* This page lists definitions related to internal & external on-board memories.
*
* \section NandFlash
* - \ref BOARD_NF_COMMAND_ADDR
* - \ref BOARD_NF_ADDRESS_ADDR
* - \ref BOARD_NF_DATA_ADDR
*
* \section NorFlash
* - \ref BOARD_NORFLASH_ADDR
* - \ref BOARD_NORFLASH_DFT_BUS_SIZE
*/
/** Address for transferring command bytes to the nandflash. */
#define BOARD_NF_COMMAND_ADDR 0x60400000
/** Address for transferring address bytes to the nandflash. */
#define BOARD_NF_ADDRESS_ADDR 0x60200000
/** Address for transferring data bytes to the nandflash. */
#define BOARD_NF_DATA_ADDR 0x60000000
/* Bus width for NAND */
#define CONF_NF_BUSWIDTH 8
/* Access timing for NAND */
#define CONF_NF_SETUP_TIMING (SMC_SETUP_NWE_SETUP(0) \
| SMC_SETUP_NCS_WR_SETUP(1) \
| SMC_SETUP_NRD_SETUP(0) \
| SMC_SETUP_NCS_RD_SETUP(1))
#define CONF_NF_PULSE_TIMING (SMC_PULSE_NWE_PULSE(2) \
| SMC_PULSE_NCS_WR_PULSE(3) \
| SMC_PULSE_NRD_PULSE(4) \
| SMC_PULSE_NCS_RD_PULSE(4))
#define CONF_NF_CYCLE_TIMING (SMC_CYCLE_NWE_CYCLE(4) \
| SMC_CYCLE_NRD_CYCLE(7))
/** Address for transferring command bytes to the norflash. */
#define BOARD_NORFLASH_ADDR 0x63000000
/** Default NOR bus size after power up reset */
#define BOARD_NORFLASH_DFT_BUS_SIZE 8
/*----------------------------------------------------------------------------*/
/**
* \page sam3s_ek_chipdef "SAM3S-EK - Individual chip definition"
* This page lists the definitions related to different chip's definition
* located in the board.h file for the SAM3S-EK.
*
* \section USART
* - \ref BOARD_PIN_USART_RXD
* - \ref BOARD_PIN_USART_TXD
* - \ref BOARD_PIN_USART_CTS
* - \ref BOARD_PIN_USART_RTS
* - \ref BOARD_PIN_USART_EN
* - \ref BOARD_USART_BASE
* - \ref BOARD_ID_USART
*/
/** Rtc */
#define BOARD_RTC_ID ID_RTC
/** TWI ID for EEPROM application to use */
#define BOARD_ID_TWI_EEPROM ID_TWI1
/** TWI Base for TWI EEPROM application to use */
#define BOARD_BASE_TWI_EEPROM TWI1
/** TWI pins for EEPROM application to use */
#define BOARD_PINS_TWI_EEPROM PINS_TWI1
/** USART RX pin for application */
#define BOARD_PIN_USART_RXD PIN_USART1_RXD
/** USART TX pin for application */
#define BOARD_PIN_USART_TXD PIN_USART1_TXD
/** USART CTS pin for application */
#define BOARD_PIN_USART_CTS PIN_USART1_CTS
/** USART RTS pin for application */
#define BOARD_PIN_USART_RTS PIN_USART1_RTS
/** USART ENABLE pin for application */
#define BOARD_PIN_USART_EN PIN_USART1_EN
/** USART Base for application */
#define BOARD_USART_BASE USART1
/** USART ID for application */
#define BOARD_ID_USART ID_USART1
#define CONSOLE_UART UART0
#define CONSOLE_UART_ID ID_UART0
/* RE pin. */
#define PIN_RE_IDX PIN_USART1_CTS_IDX
#define PIN_RE_FLAGS (PIO_OUTPUT_0 | PIO_DEFAULT)
/* IRDA SD pin. */
#define PIN_IRDA_SD_IDX PIN_USART1_CTS_IDX
#define PIN_IRDA_SD_FLAGS (PIO_OUTPUT_1 | PIO_DEFAULT)
/* TXD pin configuration. */
#define PIN_USART_TXD_IDX PIN_USART1_TXD_IDX
#define PIN_USART_TXD_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
#define PIN_USART_TXD_IO_FLAGS (PIO_OUTPUT_0 | PIO_DEFAULT)
/* ISO7816 example relate PIN definition. */
#define ISO7816_USART_ID ID_USART1
#define ISO7816_USART USART1
#define PIN_ISO7816_RST_IDX PIO_PA15_IDX
#define PIN_ISO7816_RST_FLAG (PIO_OUTPUT_0 | PIO_DEFAULT)
#endif // _SAM3S_EK2_H_