/*
 * Copyright (C) 2019-2020 Alibaba Group Holding Limited
 */

/******************************************************************************
 * @file     pin.h
 * @brief    header File for pin definition
 * @version  V1.0
 * @date     02. June 2017
 ******************************************************************************/
#ifndef __PIN_H__
#define __PIN_H__

#include <stdint.h>
#include "pinmux.h"

#define CONSOLE_UART_IDX  0

#define PWM_CH0     PA4
#define PWM_CH1     PA5
#define PWM_CH2     PB0
#define PWM_CH3     PB1
#define PWM_CH4     PB2
#define PWM_CH5     PB3

/****Ethernet Drvier****/
#define EXAMPLE_GPIO_PIN            PA17
#define EXAMPLE_BOARD_GPIO_PIN_NAME "TX1"
#define EXAMPLE_GPIO_PIN_FUNC       PIN_FUNC_GPIO

#define CONSOLE_TXD                 PA10//PA2
#define CONSOLE_RXD                 PA11//PA3
#define CONSOLE_TXD_FUNC            PA10_UART0_TX
#define CONSOLE_RXD_FUNC            PA11_UART0_RX

/****AT Module ****/
#define AT_UART_IDX                 1
#define AT_PIN_USART_TX             PA17
#define AT_PIN_USART_RX             PA16
#define AT_TXD_FUNC                 PA17_UART1_TX
#define AT_RXD_FUNC                 PA16_UART1_RX

/****Netm Drvier****/
#define NETM_USART_IDX              2
#define NETM_PIN_USART_TX           PA24
#define NETM_PIN_USART_RX           PA25
#define NETM_PIN_USART_TX_FUNC      PA24_UART2_TX
#define NETM_PIN_USART_RX_FUNC      PA25_UART2_RX

#define WIFI_ESP8266_RESET          PA22
#define WIFI_ESP8266_SMARTCFG       PA5

#define NETM_GP101A_RESET           PA5

#define GPRS_SIM800_PIN_STATUS      PA18
#define GPRS_SIM800_PIN_PWR         PA19

/****Ethernet Drvier****/
#define ENC28J60_ETH_SPI_IDX        0
#define ENC28J60_ETH_SPI_MISO       PB3
#define ENC28J60_ETH_SPI_MOSI       PA6
#define ENC28J60_ETH_SPI_SCK        PB2
#define ENC28J60_ETH_SPI_CS         PA7
#define ENC28J60_ETH_PIN_INT        PA20
#define ENC28J60_ETH_PIN_RST        PA5
#define ENC28J60_ETH_SPI_MISO_FUNC  PB3_SPI0_MISO
#define ENC28J60_ETH_SPI_MOSI_FUNC  PA6_SPI0_MOSI
#define ENC28J60_ETH_SPI_SCK_FUNC   PB2_SPI0_SCK
#define ENC28J60_ETH_SPI_CS_FUNC    PIN_FUNC_GPIO
#define ENC28J60_ETH_PIN_RST_FUNC   PIN_FUNC_GPIO
#define ENC28J60_ETH_PIN_INT_FUNC   PIN_FUNC_GPIO

#define EXAMPLE_IIC_IDX             1
#define EXAMPLE_PIN_IIC_SDA         PC1
#define EXAMPLE_PIN_IIC_SCL         PC0
#define EXAMPLE_PIN_IIC_SDA_FUNC    PC1_I2C1_SDA
#define EXAMPLE_PIN_IIC_SCL_FUNC    PC0_I2C1_SCL

#if 0
#define EXAMPLE_PWM_CH              PA4
#define EXAMPLE_PWM_CH_FUNC         PA4_PWM_CH0
#endif

//adc
#define EXAMPLE_ADC_CH0             PA8
#define EXAMPLE_ADC_CH0_FUNC        PA8_ADC_A0
#define EXAMPLE_ADC_CH12            PA26
#define EXAMPLE_ADC_CH12_FUNC       PA26_ADC_A12

/****Sensor Drvier****/
#define EXAMPLE_DHT11_PIN            PA4
#define EXAMPLE_DHT11_PIN_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_DHT22_PIN            PA4
#define EXAMPLE_DHT22_PIN_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED1_PIN1            PA12
#define EXAMPLE_LED1_PIN1_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED1_PIN2            PA13
#define EXAMPLE_LED1_PIN2_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED2_PIN1            PA14
#define EXAMPLE_LED2_PIN1_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED2_PIN2            PA15
#define EXAMPLE_LED2_PIN2_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_BATTERY_PIN          PA4
#define EXAMPLE_BATTERY_PIN_FUNC     PIN_FUNC_GPIO

#define EXAMPLE_LED_R_PIN            PA13
#define EXAMPLE_LED_R_PIN_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED_G_PIN            PA12
#define EXAMPLE_LED_G_PIN_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_LED_B_PIN            LED_PIN_NOT_SET
#define EXAMPLE_LED_B_PIN_FUNC       PIN_FUNC_GPIO

#define EXAMPLE_PUSH_BUTTON_PIN      PA27
#define EXAMPLE_PUSH_BUTTON_PIN_FUNC PIN_FUNC_GPIO

#define SENSOR_IIC_IDX               1

#define PIN_ETH_RST PA5_RTS0_PWM1_SPI0SSN_TRIG1



#define CONSOLE_TXD         PA10
#define CONSOLE_RXD         PA11
#define CONSOLE_TXD_FUNC    PA10_UART0_TX
#define CONSOLE_RXD_FUNC    PA11_UART0_RX
#define CONSOLE_IDX         0

/* example pin manager */
#define WAKEUP_PIN              PA8
#define WAKEUP_PIN_FUNC         PA8_SYS_WKUP
#define EXAMPLE_BOARD_WAKEUP_PIN_NAME   "PA8"
#define EXAMPLE_WAKEUP_NUM      14

#define EXAMPLE_USART_IDX       0
#define EXAMPLE_PIN_USART_TX    PA10
#define EXAMPLE_PIN_USART_RX    PA11
#define EXAMPLE_PIN_USART_TX_FUNC   PA10_UART0_TX
#define EXAMPLE_PIN_USART_RX_FUNC   PA11_UART0_RX

#define EXAMPLE_USART_BD_IDX       1
#define EXAMPLE_PIN_USART_BD_TX    PA17
#define EXAMPLE_PIN_USART_BD_RX    PA16
#define EXAMPLE_PIN_USART_BD_TX_FUNC   PA17_UART1_TX
#define EXAMPLE_PIN_USART_BD_RX_FUNC   PA16_UART1_RX

#define EXAMPLE_SPI_IDX         1
#define EXAMPLE_PIN_SPI_MOSI    PA23
#define EXAMPLE_PIN_SPI_MISO    PA22
#define EXAMPLE_PIN_SPI_CS      PA18
#define EXAMPLE_PIN_SPI_SCK     PA21
#define EXAMPLE_PIN_SPI_MOSI_FUNC   PA23_SPI1_MOSI
#define EXAMPLE_PIN_SPI_MISO_FUNC   PA22_SPI1_MISO
#define EXAMPLE_PIN_SPI_CS_FUNC     PA18_SPI1_CS0
#define EXAMPLE_PIN_SPI_SCK_FUNC    PA21_SPI1_SCK

#define EXAMPLE_SPI_SLAVE_IDX         0
#define EXAMPLE_PIN_SPI_SLAVE_MOSI    PA6
#define EXAMPLE_PIN_SPI_SLAVE_MISO    PB3
#define EXAMPLE_PIN_SPI_SLAVE_CS      PA7
#define EXAMPLE_PIN_SPI_SLAVE_SCK     PB2
#define EXAMPLE_PIN_SPI_SLAVE_MOSI_FUNC   PA6_SPI0_MOSI
#define EXAMPLE_PIN_SPI_SLAVE_MISO_FUNC   PB3_SPI0_MISO
#define EXAMPLE_PIN_SPI_SLAVE_CS_FUNC     PA7_SPI0_CS
#define EXAMPLE_PIN_SPI_SLAVE_SCK_FUNC    PB2_SPI0_SCK

#define EXAMPLE_IIC_IDX         1
#define EXAMPLE_PIN_IIC_SDA     PC1
#define EXAMPLE_PIN_IIC_SCL     PC0
#define EXAMPLE_PIN_IIC_SDA_FUNC    PC1_I2C1_SDA
#define EXAMPLE_PIN_IIC_SCL_FUNC    PC0_I2C1_SCL

#define EXAMPLE_IIC_SLAVE_IDX             0
#define EXAMPLE_PIN_IIC_SLAVE_SDA         PB1
#define EXAMPLE_PIN_IIC_SLAVE_SCL         PB0
#define EXAMPLE_PIN_IIC_SLAVE_SDA_FUNC    PB1_I2C0_SDA
#define EXAMPLE_PIN_IIC_SLAVE_SCL_FUNC    PB0_I2C0_SCL

#define EXAMPLE_GPIO_PIN    PA17
#define EXAMPLE_BOARD_GPIO_PIN_NAME "TX1"
#define EXAMPLE_GPIO_PIN_FUNC   PIN_FUNC_GPIO

#define EXAMPLE_ETH_SPI_IDX 0
#define EXAMPLE_ETH_SPI_MISO    PB3
#define EXAMPLE_ETH_SPI_MOSI    PA6
#define EXAMPLE_ETH_SPI_SCK     PB2
#define EXAMPLE_ETH_SPI_CS      PA7
#define EXAMPLE_ETH_PIN_INT     PA20
#define EXAMPLE_ETH_PIN_RST     PA5
#define EXAMPLE_ETH_SPI_MISO_FUNC    PB3_SPI0_MISO
#define EXAMPLE_ETH_SPI_MOSI_FUNC    PA6_SPI0_MOSI
#define EXAMPLE_ETH_SPI_SCK_FUNC     PB2_SPI0_SCK
#define EXAMPLE_ETH_SPI_CS_FUNC      PIN_FUNC_GPIO
#define EXAMPLE_ETH_PIN_RST_FUNC     PIN_FUNC_GPIO
#define EXAMPLE_ETH_PIN_INT_FUNC     PIN_FUNC_GPIO

#define EXAMPLE_I2S_IDX 0
#define EXAMPLE_I2S_MCLK        PA24
#define EXAMPLE_I2S_SCLK        PA25
#define EXAMPLE_I2S_WSCLK       PA26
#define EXAMPLE_I2S_SDA         PA27
#define EXAMPLE_I2S_MCLK_FUNC   PA24_I2S_MCLK
#define EXAMPLE_I2S_SCLK_FUNC   PA25_I2S_SCLK
#define EXAMPLE_I2S_WSCLK_FUNC  PA26_I2S_WSCLK
#define EXAMPLE_I2S_SDA_FUNC    PA27_I2S_SDA

#define EXAMPLE_ADC_CHANNEL     0

#define EXAMPLE_ADC_CH0     PA8
#define EXAMPLE_ADC_CH0_FUNC    PA8_ADC_A0
#define EXAMPLE_ADC_CH1     PA9
#define EXAMPLE_ADC_CH1_FUNC    PA9_ADC_A1
#define EXAMPLE_ADC_CH2     PA10
#define EXAMPLE_ADC_CH2_FUNC    PA10_ADC_A2
#define EXAMPLE_ADC_CH3     PA11
#define EXAMPLE_ADC_CH3_FUNC    PA11_ADC_A3
#define EXAMPLE_ADC_CH4     PA12
#define EXAMPLE_ADC_CH4_FUNC    PA12_ADC_A4
#define EXAMPLE_ADC_CH5     PA13
#define EXAMPLE_ADC_CH5_FUNC    PA13_ADC_A5
#define EXAMPLE_ADC_CH6     PA14
#define EXAMPLE_ADC_CH6_FUNC    PA14_ADC_A6
#define EXAMPLE_ADC_CH7     PA15
#define EXAMPLE_ADC_CH7_FUNC    PA15_ADC_A7
#define EXAMPLE_ADC_CH8     PA16
#define EXAMPLE_ADC_CH8_FUNC    PA16_ADC_A8
#define EXAMPLE_ADC_CH9     PA17
#define EXAMPLE_ADC_CH9_FUNC    PA17_ADC_A9
#define EXAMPLE_ADC_CH10    PA22
#define EXAMPLE_ADC_CH10_FUNC   PA22_ADC_A10
#define EXAMPLE_ADC_CH11    PA23
#define EXAMPLE_ADC_CH11_FUNC   PA23_ADC_A11
#define EXAMPLE_ADC_CH12    PA26
#define EXAMPLE_ADC_CH12_FUNC   PA26_ADC_A12
#define EXAMPLE_ADC_CH13    PA27
#define EXAMPLE_ADC_CH13_FUNC   PA27_ADC_A13
#define EXAMPLE_ADC_CH14    PC0
#define EXAMPLE_ADC_CH14_FUNC   PC0_ADC_A14
#define EXAMPLE_ADC_CH15    PC1
#define EXAMPLE_ADC_CH15_FUNC   PC1_ADC_A15

#define EXAMPLE_ACMP_IDX            0
#define EXAMPLE_PIN_ACMP_P          PA8
#define EXAMPLE_PIN_ACMP_N          PA11
#define EXAMPLE_PIN_ACMP_O          PA18
#define EXAMPLE_PIN_ACMP_P_FUNC     PA8_ACMP_P0
#define EXAMPLE_PIN_ACMP_N_FUNC     PA11_ACMP_N0
#define EXAMPLE_PIN_ACMP_O_FUNC     PA18_ACMP_O0

#define EXAMPLE_PWM_IDX         0
#define EXAMPLE_PWM_CH_IDX      8
#define EXAMPLE_PWM_CH          PA12
#define EXAMPLE_PWM_CH_FUNC     PA12_PWM_CH8

#define EXAMPLE_PWM_TIMER_CH_IDX 0

#define EXAMPLE_PWM_CAPTURE_CH_IDX        0
#define EXAMPLE_PWM_CAPTURE_CH            PA4
#define EXAMPLE_PWM_CAPTURE_CH_FUNC       PA4_PWM_CH0
#define EXAMPLE_PWM_CAPTURE_GPIO_PIN      PA11
#define EXAMPLE_PWM_CAPTURE_GPIO_PIN_FUNC PIN_FUNC_GPIO

/* tests pin manager */
#define TEST_USART_IDX       1
#define TEST_PIN_USART_TX    PA17
#define TEST_PIN_USART_RX    PA16
#define TEST_PIN_USART_TX_FUNC   PA17_UART1_TX
#define TEST_PIN_USART_RX_FUNC   PA16_UART1_RX

#define TEST_SPI_IDX         1
#define TEST_PIN_SPI_MOSI    PA23
#define TEST_PIN_SPI_MISO    PA22
#define TEST_PIN_SPI_CS      PA18
#define TEST_PIN_SPI_SCK     PA21
#define TEST_PIN_SPI_MOSI_FUNC   PA23_SPI1_MOSI
#define TEST_PIN_SPI_MISO_FUNC   PA22_SPI1_MISO
#define TEST_PIN_SPI_CS_FUNC     PIN_FUNC_GPIO
#define TEST_PIN_SPI_SCK_FUNC    PA21_SPI1_SCK

#define TEST_IIC_IDX         1
#define TEST_PIN_IIC_SDA     PC1
#define TEST_PIN_IIC_SCL     PC0
#define TEST_PIN_IIC_SDA_FUNC    PC1_I2C1_SDA
#define TEST_PIN_IIC_SCL_FUNC    PC0_I2C1_SCL

#define TEST_GPIO_PIN    PA18
#define TEST_BOARD_GPIO_PIN_NAME "PA18"
#define TEST_GPIO_PIN_FUNC   PIN_FUNC_GPIO

#define TEST_PWM_IDX      0
#define TEST_PWM_CH       0
#define TEST_PWM_CH0      PA4
#define TEST_PWM_CH0_FUNC PA4_PWM_CH0
#define TEST_PWM_CH1      PA5
#define TEST_PWM_CH1_FUNC PA5_PWM_CH1
#define TEST_PWM_CH2      PB0
#define TEST_PWM_CH2_FUNC PB0_PWM_CH2
#define TEST_PWM_CH3      PB1
#define TEST_PWM_CH3_FUNC PB1_PWM_CH3
#define TEST_PWM_CH4      PB2
#define TEST_PWM_CH4_FUNC PB2_PWM_CH4
#define TEST_PWM_CH5      PB3
#define TEST_PWM_CH5_FUNC PB3_PWM_CH5

/* FIXME: for CDK */
#define PORTA_PIN0  PA0
#define PORTA_PIN1  PA1
#define PORTA_PIN2  PA2
#define PORTA_PIN3  PA3
#define PORTA_PIN4  PA4
#define PORTA_PIN5  PA5
#define PORTB_PIN0  PB0
#define PORTB_PIN1  PB1
#define PORTB_PIN2  PB2
#define PORTB_PIN3  PB3
#define PORTA_PIN6  PA6
#define PORTA_PIN7  PA7
#define PORTA_PIN8  PA8
#define PORTA_PIN9  PA9
#define PORTA_PIN10 PA10
#define PORTA_PIN11 PA11
#define PORTA_PIN12 PA12
#define PORTA_PIN13 PA13
#define PORTA_PIN14 PA14
#define PORTA_PIN15 PA15
#define PORTA_PIN16 PA16
#define PORTA_PIN17 PA17
#define PORTA_PIN18 PA18
#define PORTA_PIN19 PA19
#define PORTA_PIN20 PA20
#define PORTA_PIN21 PA21
#define PORTA_PIN22 PA22
#define PORTA_PIN23 PA23
#define PORTA_PIN24 PA24
#define PORTA_PIN25 PA25
#define PORTA_PIN26 PA26
#define PORTA_PIN27 PA27
#define PORTC_PIN0  PC0
#define PORTC_PIN1  PC1

#define TEST_I2S_IDX 0
#define TEST_I2S_MCLK        PA24
#define TEST_I2S_SCLK        PA25
#define TEST_I2S_WSCLK       PA26
#define TEST_I2S_SDA         PA27
#define TEST_I2S_MCLK_FUNC   PA24_I2S_MCLK
#define TEST_I2S_SCLK_FUNC   PA25_I2S_SCLK
#define TEST_I2S_WSCLK_FUNC  PA26_I2S_WSCLK
#define TEST_I2S_SDA_FUNC    PA27_I2S_SDA


/*
 * CSI TEST DEFINE 
*/

#define CONSOLE_TXD         PA10
#define CONSOLE_RXD         PA11
#define CONSOLE_TXD_FUNC    PA10_UART0_TX
#define CONSOLE_RXD_FUNC    PA11_UART0_RX
#define CONSOLE_IDX         0

/* example pin manager */
#define WAKEUP_PIN              PA8
#define WAKEUP_PIN_FUNC         PA8_SYS_WKUP
#define EXAMPLE_BOARD_WAKEUP_PIN_NAME   "PA8"
#define EXAMPLE_WAKEUP_NUM      14

#define EXAMPLE_USART_IDX       0
#define EXAMPLE_PIN_USART_TX    PA10
#define EXAMPLE_PIN_USART_RX    PA11
#define EXAMPLE_PIN_USART_TX_FUNC   PA10_UART0_TX
#define EXAMPLE_PIN_USART_RX_FUNC   PA11_UART0_RX

#define EXAMPLE_USART_BD_IDX       1
#define EXAMPLE_PIN_USART_BD_TX    PA17
#define EXAMPLE_PIN_USART_BD_RX    PA16
#define EXAMPLE_PIN_USART_BD_TX_FUNC   PA17_UART1_TX
#define EXAMPLE_PIN_USART_BD_RX_FUNC   PA16_UART1_RX

#define EXAMPLE_SPI_IDX         1
#define EXAMPLE_PIN_SPI_MOSI    PA23
#define EXAMPLE_PIN_SPI_MISO    PA22
#define EXAMPLE_PIN_SPI_CS      PA18
#define EXAMPLE_PIN_SPI_SCK     PA21
#define EXAMPLE_PIN_SPI_MOSI_FUNC   PA23_SPI1_MOSI
#define EXAMPLE_PIN_SPI_MISO_FUNC   PA22_SPI1_MISO
#define EXAMPLE_PIN_SPI_CS_FUNC     PA18_SPI1_CS0
#define EXAMPLE_PIN_SPI_SCK_FUNC    PA21_SPI1_SCK

#define EXAMPLE_SPI_SLAVE_IDX         0
#define EXAMPLE_PIN_SPI_SLAVE_MOSI    PA6
#define EXAMPLE_PIN_SPI_SLAVE_MISO    PB3
#define EXAMPLE_PIN_SPI_SLAVE_CS      PA7
#define EXAMPLE_PIN_SPI_SLAVE_SCK     PB2
#define EXAMPLE_PIN_SPI_SLAVE_MOSI_FUNC   PA6_SPI0_MOSI
#define EXAMPLE_PIN_SPI_SLAVE_MISO_FUNC   PB3_SPI0_MISO
#define EXAMPLE_PIN_SPI_SLAVE_CS_FUNC     PA7_SPI0_CS
#define EXAMPLE_PIN_SPI_SLAVE_SCK_FUNC    PB2_SPI0_SCK

#define EXAMPLE_IIC_IDX         1
#define EXAMPLE_PIN_IIC_SDA     PC1
#define EXAMPLE_PIN_IIC_SCL     PC0
#define EXAMPLE_PIN_IIC_SDA_FUNC    PC1_I2C1_SDA
#define EXAMPLE_PIN_IIC_SCL_FUNC    PC0_I2C1_SCL

#define EXAMPLE_IIC_SLAVE_IDX             0
#define EXAMPLE_PIN_IIC_SLAVE_SDA         PB1
#define EXAMPLE_PIN_IIC_SLAVE_SCL         PB0
#define EXAMPLE_PIN_IIC_SLAVE_SDA_FUNC    PB1_I2C0_SDA
#define EXAMPLE_PIN_IIC_SLAVE_SCL_FUNC    PB0_I2C0_SCL

#define EXAMPLE_GPIO_PIN    PA17
#define EXAMPLE_BOARD_GPIO_PIN_NAME "TX1"
#define EXAMPLE_GPIO_PIN_FUNC   PIN_FUNC_GPIO

#define EXAMPLE_ETH_SPI_IDX 0
#define EXAMPLE_ETH_SPI_MISO    PB3
#define EXAMPLE_ETH_SPI_MOSI    PA6
#define EXAMPLE_ETH_SPI_SCK     PB2
#define EXAMPLE_ETH_SPI_CS      PA7
#define EXAMPLE_ETH_PIN_INT     PA20
#define EXAMPLE_ETH_PIN_RST     PA5
#define EXAMPLE_ETH_SPI_MISO_FUNC    PB3_SPI0_MISO
#define EXAMPLE_ETH_SPI_MOSI_FUNC    PA6_SPI0_MOSI
#define EXAMPLE_ETH_SPI_SCK_FUNC     PB2_SPI0_SCK
#define EXAMPLE_ETH_SPI_CS_FUNC      PIN_FUNC_GPIO
#define EXAMPLE_ETH_PIN_RST_FUNC     PIN_FUNC_GPIO
#define EXAMPLE_ETH_PIN_INT_FUNC     PIN_FUNC_GPIO

#define EXAMPLE_I2S_IDX 0
#define EXAMPLE_I2S_MCLK        PA24
#define EXAMPLE_I2S_SCLK        PA25
#define EXAMPLE_I2S_WSCLK       PA26
#define EXAMPLE_I2S_SDA         PA27
#define EXAMPLE_I2S_MCLK_FUNC   PA24_I2S_MCLK
#define EXAMPLE_I2S_SCLK_FUNC   PA25_I2S_SCLK
#define EXAMPLE_I2S_WSCLK_FUNC  PA26_I2S_WSCLK
#define EXAMPLE_I2S_SDA_FUNC    PA27_I2S_SDA

#define EXAMPLE_ADC_CHANNEL     0

#define EXAMPLE_ADC_CH0     PA8
#define EXAMPLE_ADC_CH0_FUNC    PA8_ADC_A0
#define EXAMPLE_ADC_CH1     PA9
#define EXAMPLE_ADC_CH1_FUNC    PA9_ADC_A1
#define EXAMPLE_ADC_CH2     PA10
#define EXAMPLE_ADC_CH2_FUNC    PA10_ADC_A2
#define EXAMPLE_ADC_CH3     PA11
#define EXAMPLE_ADC_CH3_FUNC    PA11_ADC_A3
#define EXAMPLE_ADC_CH4     PA12
#define EXAMPLE_ADC_CH4_FUNC    PA12_ADC_A4
#define EXAMPLE_ADC_CH5     PA13
#define EXAMPLE_ADC_CH5_FUNC    PA13_ADC_A5
#define EXAMPLE_ADC_CH6     PA14
#define EXAMPLE_ADC_CH6_FUNC    PA14_ADC_A6
#define EXAMPLE_ADC_CH7     PA15
#define EXAMPLE_ADC_CH7_FUNC    PA15_ADC_A7
#define EXAMPLE_ADC_CH8     PA16
#define EXAMPLE_ADC_CH8_FUNC    PA16_ADC_A8
#define EXAMPLE_ADC_CH9     PA17
#define EXAMPLE_ADC_CH9_FUNC    PA17_ADC_A9
#define EXAMPLE_ADC_CH10    PA22
#define EXAMPLE_ADC_CH10_FUNC   PA22_ADC_A10
#define EXAMPLE_ADC_CH11    PA23
#define EXAMPLE_ADC_CH11_FUNC   PA23_ADC_A11
#define EXAMPLE_ADC_CH12    PA26
#define EXAMPLE_ADC_CH12_FUNC   PA26_ADC_A12
#define EXAMPLE_ADC_CH13    PA27
#define EXAMPLE_ADC_CH13_FUNC   PA27_ADC_A13
#define EXAMPLE_ADC_CH14    PC0
#define EXAMPLE_ADC_CH14_FUNC   PC0_ADC_A14
#define EXAMPLE_ADC_CH15    PC1
#define EXAMPLE_ADC_CH15_FUNC   PC1_ADC_A15

#define EXAMPLE_ACMP_IDX            0
#define EXAMPLE_PIN_ACMP_P          PA8
#define EXAMPLE_PIN_ACMP_N          PA11
#define EXAMPLE_PIN_ACMP_O          PA18
#define EXAMPLE_PIN_ACMP_P_FUNC     PA8_ACMP_P0
#define EXAMPLE_PIN_ACMP_N_FUNC     PA11_ACMP_N0
#define EXAMPLE_PIN_ACMP_O_FUNC     PA18_ACMP_O0

#define EXAMPLE_PWM_IDX         0
#define EXAMPLE_PWM_CH_IDX      8
#define EXAMPLE_PWM_CH          PA12
#define EXAMPLE_PWM_CH_FUNC     PA12_PWM_CH8

#define EXAMPLE_PWM_TIMER_CH_IDX 0

#define EXAMPLE_PWM_CAPTURE_CH_IDX        0
#define EXAMPLE_PWM_CAPTURE_CH            PA4
#define EXAMPLE_PWM_CAPTURE_CH_FUNC       PA4_PWM_CH0
#define EXAMPLE_PWM_CAPTURE_GPIO_PIN      PA11
#define EXAMPLE_PWM_CAPTURE_GPIO_PIN_FUNC PIN_FUNC_GPIO

/* tests pin manager */
#define TEST_USART_IDX       1
#define TEST_PIN_USART_TX    PA17
#define TEST_PIN_USART_RX    PA16
#define TEST_PIN_USART_TX_FUNC   PA17_UART1_TX
#define TEST_PIN_USART_RX_FUNC   PA16_UART1_RX

#define TEST_SPI_IDX         1
#define TEST_PIN_SPI_MOSI    PA23
#define TEST_PIN_SPI_MISO    PA22
#define TEST_PIN_SPI_CS      PA18
#define TEST_PIN_SPI_SCK     PA21
#define TEST_PIN_SPI_MOSI_FUNC   PA23_SPI1_MOSI
#define TEST_PIN_SPI_MISO_FUNC   PA22_SPI1_MISO
#define TEST_PIN_SPI_CS_FUNC     PIN_FUNC_GPIO
#define TEST_PIN_SPI_SCK_FUNC    PA21_SPI1_SCK

#define TEST_IIC_IDX         1
#define TEST_PIN_IIC_SDA     PC1
#define TEST_PIN_IIC_SCL     PC0
#define TEST_PIN_IIC_SDA_FUNC    PC1_I2C1_SDA
#define TEST_PIN_IIC_SCL_FUNC    PC0_I2C1_SCL

#define TEST_GPIO_PIN    PA18
#define TEST_BOARD_GPIO_PIN_NAME "PA18"
#define TEST_GPIO_PIN_FUNC   PIN_FUNC_GPIO

#define TEST_PWM_IDX      0
#define TEST_PWM_CH       0
#define TEST_PWM_CH0      PA4
#define TEST_PWM_CH0_FUNC PA4_PWM_CH0
#define TEST_PWM_CH1      PA5
#define TEST_PWM_CH1_FUNC PA5_PWM_CH1
#define TEST_PWM_CH2      PB0
#define TEST_PWM_CH2_FUNC PB0_PWM_CH2
#define TEST_PWM_CH3      PB1
#define TEST_PWM_CH3_FUNC PB1_PWM_CH3
#define TEST_PWM_CH4      PB2
#define TEST_PWM_CH4_FUNC PB2_PWM_CH4
#define TEST_PWM_CH5      PB3
#define TEST_PWM_CH5_FUNC PB3_PWM_CH5

/* FIXME: for CDK */
#define PORTA_PIN0  PA0
#define PORTA_PIN1  PA1
#define PORTA_PIN2  PA2
#define PORTA_PIN3  PA3
#define PORTA_PIN4  PA4
#define PORTA_PIN5  PA5
#define PORTB_PIN0  PB0
#define PORTB_PIN1  PB1
#define PORTB_PIN2  PB2
#define PORTB_PIN3  PB3
#define PORTA_PIN6  PA6
#define PORTA_PIN7  PA7
#define PORTA_PIN8  PA8
#define PORTA_PIN9  PA9
#define PORTA_PIN10 PA10
#define PORTA_PIN11 PA11
#define PORTA_PIN12 PA12
#define PORTA_PIN13 PA13
#define PORTA_PIN14 PA14
#define PORTA_PIN15 PA15
#define PORTA_PIN16 PA16
#define PORTA_PIN17 PA17
#define PORTA_PIN18 PA18
#define PORTA_PIN19 PA19
#define PORTA_PIN20 PA20
#define PORTA_PIN21 PA21
#define PORTA_PIN22 PA22
#define PORTA_PIN23 PA23
#define PORTA_PIN24 PA24
#define PORTA_PIN25 PA25
#define PORTA_PIN26 PA26
#define PORTA_PIN27 PA27
#define PORTC_PIN0  PC0
#define PORTC_PIN1  PC1

#define TEST_I2S_IDX 0
#define TEST_I2S_MCLK        PA24
#define TEST_I2S_SCLK        PA25
#define TEST_I2S_WSCLK       PA26
#define TEST_I2S_SDA         PA27
#define TEST_I2S_MCLK_FUNC   PA24_I2S_MCLK
#define TEST_I2S_SCLK_FUNC   PA25_I2S_SCLK
#define TEST_I2S_WSCLK_FUNC  PA26_I2S_WSCLK
#define TEST_I2S_SDA_FUNC    PA27_I2S_SDA

#endif /* CH2201_PIN_H */
