/******************************************************************************

   lincoln_board.h - CMSIS defines for the Lincoln  
                      
                      by Micromint Support <support@micromint.com>    June-2011

*******************************************************************************/
#ifndef __LINCOLN_BOARD_H
#define __LINCOLN60_BOARD_H


#include "lpc17xx_pinsel.h"
/*******************************************************************************

 Defines for the number of Lincoln 60 Peripherals

*******************************************************************************/
#define  NUM_LEDS            2
#define  NUM_BUZZ            1
#define  NUM_COM             2
#define  NUM_RS485           1
#define  NUM_USB_HOST        1
#define  NUM_USB_DEV         1
#define  NUM_CAN             1
#define  NUM_ADC             8
#define  NUM_DAC             4

/*******************************************************************************

 Analog to Digital Define

*******************************************************************************/

/* ADC GPIO Defines */
#define  ADC0_PORT        PINSEL_PORT_0
#define  ADC0_PIN         PINSEL_PIN_23
#define  ADC0_FUNCTION    PINSEL_FUNC_1
#define  ADC1_PORT        PINSEL_PORT_0
#define  ADC1_PIN         PINSEL_PIN_24
#define  ADC1_FUNCTION    PINSEL_FUNC_1
#define  ADC2_PORT        PINSEL_PORT_0
#define  ADC2_PIN         PINSEL_PIN_25
#define  ADC2_FUNCTION    PINSEL_FUNC_1
#define  ADC3_PORT        PINSEL_PORT_0
#define  ADC3_PIN         PINSEL_PIN_26
#define  ADC3_FUNCTION    PINSEL_FUNC_1
#define  ADC4_PORT        PINSEL_PORT_1
#define  ADC4_PIN         PINSEL_PIN_30
#define  ADC4_FUNCTION    PINSEL_FUNC_3
#define  ADC5_PORT        PINSEL_PORT_1
#define  ADC5_PIN         PINSEL_PIN_31
#define  ADC5_FUNCTION    PINSEL_FUNC_3
#define  ADC6_PORT        PINSEL_PORT_0
#define  ADC6_PIN         PINSEL_PIN_3
#define  ADC6_FUNCTION    PINSEL_FUNC_2
#define  ADC7_PORT        PINSEL_PORT_0
#define  ADC7_PIN         PINSEL_PIN_2
#define  ADC7_FUNCTION    PINSEL_FUNC_2
/******************************************************************************

 COM Port Defines 

*******************************************************************************/
/* COM1 Defines */
#define  COM1_UART           LPC_UART0
#define  COM1_IRQn           UART0_IRQn
#define  COM1_IRQHandler     UART0_IRQHandler
#define  COM1_StdIntHandler  UART0_StdIntHandler
/* COM1 GPIO Defines */
#define  COM1_PORT       PINSEL_PORT_0
#define  COM1_RXD_PIN    PINSEL_PIN_3
#define  COM1_TXD_PIN    PINSEL_PIN_2
#define  COM1_FUNCTION   PINSEL_FUNC_1
#define  COM1_OPENDRAIN  PINSEL_PINMODE_NORMAL
#define  COM1_PINMODE    PINSEL_PINMODE_PULLUP

/* COM2 Defines */
#define  COM2_UART           LPC_UART3
#define  COM2_IRQn           UART3_IRQn
#define  COM2_IRQHandler     UART3_IRQHandler
#define  COM2_StdIntHandler  UART3_StdIntHandler
/* COM2 GPIO Defines */
#define  COM2_PORT       PINSEL_PORT_0
#define  COM2_RXD_PIN    PINSEL_PIN_1
#define  COM2_TXD_PIN    PINSEL_PIN_0
#define  COM2_FUNCTION   PINSEL_FUNC_2
#define  COM2_OPENDRAIN  PINSEL_PINMODE_NORMAL
#define  COM2_PINMODE    PINSEL_PINMODE_PULLUP

/* RS485 Defines */
#define  RS485_UART           LPC_UART1
#define  RS485_IRQn           UART1_IRQn
#define  RS485_IRQHandler     UART1_IRQHandler
#define  RS485_StdIntHandler  UART1_StdIntHandler
/* RS485 GPIO Defines */
#define  RS485_PORT       PINSEL_PORT_2
#define  RS485_RXD_PIN    PINSEL_PIN_1
#define  RS485_TXD_PIN    PINSEL_PIN_0
#define  RS485_RTS_PIN    PINSEL_PIN_7
#define  RS485_FUNCTION   PINSEL_FUNC_2
#define  RS485_OPENDRAIN  PINSEL_PINMODE_NORMAL
#define  RS485_PINMODE    PINSEL_PINMODE_PULLUP

/* CAN Port Defines */
#define  CAN                 LPC_CAN1

/* CAN Port GPIO Defines */
#define  CAN_PORT        PINSEL_PORT_0
#define  CAN_RD1_PIN     PINSEL_PIN_21
#define  CAN_TD1_PIN    PINSEL_PIN_22
#define  CAN_FUNCTION    PINSEL_FUNC_3
#define  CAN1_OPENDRAIN  PINSEL_PINMODE_NORMAL
#define  CAN_PINMODE    PINSEL_PINMODE_PULLUP
/*******************************************************************************

 Defines for the User Buzzer

*******************************************************************************/
#define  BUZZER_PORT       PINSEL_PORT_3
#define  BUZZER_PIN        PINSEL_PIN_25
#define  BUZZER_OPENDRAIN  PINSEL_PINMODE_NORMAL
#define  BUZZER_PINMODE    PINSEL_PINMODE_PULLUP
/* Defines for the User Buzzer using PWM */
#define  BUZZER_FUNC_PWM   PINSEL_FUNC_3
#define  BUZZER_PWM        LPC_PWM1
#define  BUZZER_MATCH      2
#define  BUZZER_CHANNEL    2
/* Defines for the User Buzzer using Timer 0's match output 0.0 */
#define  BUZZER_FUNC_MATCH      PINSEL_FUNC_2
#define  BUZZER_TIMER           LPC_TIM0
#define  BUZZER_MATCH_CHANNEL   0

/*******************************************************************************

 Defines for the User LEDs

*******************************************************************************/
/* Defines for the PWM used with the User LEDs */
#define  LED_PWM              LPC_PWM1
#define  LED1_FUNC            PINSEL_FUNC_2
#define  LED1_MATCH           0
#define  LED1_CHANNEL         1
#define  LED2_FUNC            PINSEL_FUNC_3
#define  LED2_MATCH           3
#define  LED2_CHANNEL         3
#define  GREEN_LED_FUNC       LED1_FUNC
#define  GREEN_LED_MATCH      LED1_MATCH
#define  GREEN_LED_CHANNEL    LED1_CHANNEL
#define  YELLOW_LED_FUNC      LED2_FUNC
#define  YELLOW_LED_MATCH     LED2_MATCH
#define  YELLOW_LED_CHANNEL   LED2_CHANNEL
/* Defines for the LED1 (Green User LED) GPIO*/
#define  LED1_PORT            PINSEL_PORT_1
#define  LED1_PIN             PINSEL_PIN_18
#define  LED1_OPENDRAIN       PINSEL_PINMODE_NORMAL
#define  LED1_PINMODE         PINSEL_PINMODE_PULLUP
#define  GREEN_LED_PORT       LED1_PORT
#define  GREEN_LED_PIN        LED1_PIN
#define  GREEN_LED_OPENDRAIN  LED1_OPENDRAIN
#define  GREEN_LED_PINMODE    LED1_PINMODE
/* Defines for the LED2 (Yellow User LED) GPIO */
#define  LED2_PORT            PINSEL_PORT_3
#define  LED2_PIN             PINSEL_PIN_26
#define  LED2_OPENDRAIN       PINSEL_PINMODE_NORMAL
#define  LED2_PINMODE         PINSEL_PINMODE_PULLUP
#define  YELLOW_LED_PORT      LED2_PORT
#define  YELLOW_LED_PIN       LED2_PIN
#define  YELLOW_OPENDRAIN     LED2_OPENDRAIN
#define  YELLOW_PINMODE       LED2_PINMODE
/*  Defines for the LED2 (Yellow User LED) Timer 0 Match Mode */
#define  LED2_FUNC_MATCH      PINSEL_FUNC_2
#define  LED2_TIMER           LPC_TIM0
#define  LED2_MATCH_CHANNEL   1
#define  YELLOW_LED_FUNC_MATCH      LED2_FUNC_MATCH
#define  YELLOW_LED_TIMER           LED2_TIMER
#define  YELLOW_LED_MATCH_CHANNEL   LED2_MATCH_CHANNEL
/*******************************************************************************

 Defines for the User Push Button

*******************************************************************************/
/* Defines for the User Push Button */
#define  USERPB_PORT          PINSEL_PORT_2
#define  USERPB_PIN           PINSEL_PIN_10
#define  USERPB_FUNCTION      PINSEL_FUNC_1
#define  USERPB_OPENDRAIN     PINSEL_PINMODE_NORMAL
#define  USERPB_PINMODE       PINSEL_PINMODE_PULLUP

/*******************************************************************************

 Defines for GPIO on J2

*******************************************************************************/
#define  J2_3_PORT     PINSEL_PORT_0
#define  J2_3_PIN      PINSEL_PIN_4
#define  J2_4_PORT     PINSEL_PORT_0
#define  J2_4_PIN      PINSEL_PIN_5
#define  J2_5_PORT     PINSEL_PORT_0
#define  J2_5_PIN      PINSEL_PIN_6
#define  J2_6_PORT     PINSEL_PORT_0
#define  J2_6_PIN      PINSEL_PIN_7
#define  J2_7_PORT     PINSEL_PORT_0
#define  J2_7_PIN      PINSEL_PIN_8
#define  J2_8_PORT     PINSEL_PORT_0
#define  J2_8_PIN      PINSEL_PIN_9
#define  J2_9_PORT     PINSEL_PORT_0
#define  J2_9_PIN      PINSEL_PIN_10
#define  J2_10_PORT    PINSEL_PORT_0
#define  J2_10_PIN     PINSEL_PIN_11
#define  J2_11_PORT    PINSEL_PORT_0
#define  J2_11_PIN     PINSEL_PIN_27
#define  J2_12_PORT    PINSEL_PORT_0
#define  J2_12_PIN     PINSEL_PIN_28
#define  J2_13_PORT    PINSEL_PORT_1
#define  J2_13_PIN     PINSEL_PIN_22
#define  J2_14_PORT    PINSEL_PORT_1
#define  J2_14_PIN     PINSEL_PIN_23
#define  J2_15_PORT    PINSEL_PORT_1
#define  J2_15_PIN     PINSEL_PIN_24
#define  J2_16_PORT    PINSEL_PORT_1
#define  J2_16_PIN     PINSEL_PIN_25
#define  J2_17_PORT    PINSEL_PORT_1
#define  J2_17_PIN     PINSEL_PIN_26
#define  J2_18_PORT    PINSEL_PORT_1
#define  J2_18_PIN     PINSEL_PIN_27
#define  J2_19_PORT    PINSEL_PORT_1
#define  J2_19_PIN     PINSEL_PIN_28
#define  J2_20_PORT    PINSEL_PORT_1
#define  J2_20_PIN     PINSEL_PIN_29
#define  J2_21_PORT    PINSEL_PORT_2
#define  J2_21_PIN     PINSEL_PIN_2
#define  J2_22_PORT    PINSEL_PORT_2
#define  J2_22_PIN     PINSEL_PIN_3
#define  J2_23_PORT    PINSEL_PORT_2
#define  J2_23_PIN     PINSEL_PIN_4
#define  J2_24_PORT    PINSEL_PORT_2
#define  J2_24_PIN     PINSEL_PIN_5
#define  J2_25_PORT    PINSEL_PORT_2
#define  J2_25_PIN     PINSEL_PIN_11
#define  J2_26_PORT    PINSEL_PORT_2
#define  J2_26_PIN     PINSEL_PIN_12
#define  J2_27_PORT    PINSEL_PORT_4
#define  J2_27_PIN     PINSEL_PIN_28
#define  J2_28_PORT    PINSEL_PORT_4
#define  J2_28_PIN     PINSEL_PIN_29
/*******************************************************************************

 Defines for GPIO on J12

*******************************************************************************/
#define  J12_3_PORT     PINSEL_PORT_0
#define  J12_3_PIN      PINSEL_PIN_15
#define  J12_4_PORT     PINSEL_PORT_0
#define  J12_4_PIN      PINSEL_PIN_17
#define  J12_5_PORT     PINSEL_PORT_0
#define  J12_5_PIN      PINSEL_PIN_18
#define  J12_6_PORT     PINSEL_PORT_0
#define  J12_6_PIN      PINSEL_PIN_21
#define  J12_7_PORT     PINSEL_PORT_1
#define  J12_7_PIN      PINSEL_PIN_0
#define  J12_8_PORT     PINSEL_PORT_0
#define  J12_8_PIN      PINSEL_PIN_22
#define  J12_9_PORT     PINSEL_PORT_1
#define  J12_9_PIN      PINSEL_PIN_1
#define  J12_10_PORT    PINSEL_PORT_1
#define  J12_10_PIN     PINSEL_PIN_4
#define  J12_11_PORT    PINSEL_PORT_1
#define  J12_11_PIN     PINSEL_PIN_8
#define  J12_12_PORT    PINSEL_PORT_1
#define  J12_12_PIN     PINSEL_PIN_9
#define  J12_13_PORT    PINSEL_PORT_1
#define  J12_13_PIN     PINSEL_PIN_15
#define  J12_14_PORT    PINSEL_PORT_1
#define  J12_14_PIN     PINSEL_PIN_10
#define  J12_15_PORT    PINSEL_PORT_1
#define  J12_15_PIN     PINSEL_PIN_17
#define  J12_16_PORT    PINSEL_PORT_1
#define  J12_16_PIN     PINSEL_PIN_14
#define  J12_17_PORT    PINSEL_PORT_0
#define  J12_17_PIN     PINSEL_PIN_19
#define  J12_18_PORT    PINSEL_PORT_1
#define  J12_18_PIN     PINSEL_PIN_16
#define  J12_19_PORT    PINSEL_PORT_0
#define  J12_19_PIN     PINSEL_PIN_20
#define  J12_20_PORT    PINSEL_PORT_1
#define  J12_20_PIN     PINSEL_PIN_19
#define  J12_21_PORT    PINSEL_PORT_1
#define  J12_21_PIN     PINSEL_PIN_20
#define  J12_22_PORT    PINSEL_PORT_1
#define  J12_22_PIN     PINSEL_PIN_21
#define  J12_23_PORT    PINSEL_PORT_2
#define  J12_23_PIN     PINSEL_PIN_0
#define  J12_24_PORT    PINSEL_PORT_2
#define  J12_24_PIN     PINSEL_PIN_1
#define  J12_25_PORT    PINSEL_PORT_2
#define  J12_25_PIN     PINSEL_PIN_6
#define  J12_26_PORT    PINSEL_PORT_2
#define  J12_26_PIN     PINSEL_PIN_7
#define  J12_27_PORT    PINSEL_PORT_2
#define  J12_27_PIN     PINSEL_PIN_8
#define  J12_29_PORT    PINSEL_PORT_2
#define  J12_29_PIN     PINSEL_PIN_13
#define  J12_30_PORT    PINSEL_PORT_3
#define  J12_30_PIN     PINSEL_PIN_25
#endif /* __LINCOLN_BOARD_H */
