#ifndef __SWM220_PORT_H__
#define __SWM220_PORT_H__

void PORT_Init(PORT_TypeDef * PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en);


#define PORTA_PIN0_GPIO		 	0
#define PORTA_PIN0_HALL_A		1
#define PORTA_PIN0_TIMR3_IN		2
#define PORTA_PIN0_TIMR3_OUT	3

#define PORTA_PIN1_GPIO			0
#define PORTA_PIN1_HALL_B		1
#define PORTA_PIN1_UART3_TX		2

#define PORTA_PIN2_GPIO			0
#define PORTA_PIN2_HALL_C		1
#define PORTA_PIN2_UART3_RX		2
#define PORTA_PIN2_SPI0_SSEL	3

#define PORTA_PIN3_GPIO			0
#define PORTA_PIN3_PWM0A		1
#define PORTA_PIN3_TIMR3_IN		2
#define PORTA_PIN3_TIMR3_OUT	3

#define PORTA_PIN4_GPIO			0
#define PORTA_PIN4_TIMR2_IN		1
#define PORTA_PIN4_TIMR2_OUT	2

#define PORTA_PIN5_GPIO			0
#define PORTA_PIN5_UART0_TX		1
#define PORTA_PIN5_UART0_RX		2

#define PORTA_PIN6_GPIO			0

#define PORTA_PIN7_GPIO			0
#define PORTA_PIN7_ADC_IN7		1

#define PORTA_PIN8_GPIO		 	0
#define PORTA_PIN8_ADC_IN6		1

#define PORTA_PIN9_GPIO			0
#define PORTA_PIN9_ADC_IN5		1
#define PORTA_PIN9_PWM1B		2

#define PORTA_PIN10_GPIO		0
#define PORTA_PIN10_ADC_IN4		1
#define PORTA_PIN10_SWD_CLK		2

#define PORTA_PIN11_GPIO		0
#define PORTA_PIN11_ADC_IN3		1
#define PORTA_PIN11_SWD_DAT		2

#define PORTA_PIN12_GPIO		0
#define PORTA_PIN12_ADC_IN2		1

#define PORTA_PIN13_GPIO		0
#define PORTA_PIN13_ADC_IN1		1

#define PORTA_PIN14_GPIO		0
#define PORTA_PIN14_ADC_IN0		1

#define PORTA_PIN15_GPIO		0


#define PORTB_PIN0_GPIO		 	0
#define PORTB_PIN0_CAN_RX		1
#define PORTB_PIN0_SPI1_MISO	2

#define PORTB_PIN1_GPIO			0
#define PORTB_PIN1_CAN_TX		1
#define PORTB_PIN1_SPI1_SSEL	2

#define PORTB_PIN2_GPIO			0
#define PORTB_PIN2_PWM0B		1
#define PORTB_PIN2_SPI1_SSEL	2

#define PORTB_PIN3_GPIO			0
#define PORTB_PIN3_UART3_RX		1
#define PORTB_PIN3_I2C0_SDA		2
#define PORTB_PIN3_SPI1_MISO	3

#define PORTB_PIN4_GPIO			0
#define PORTB_PIN4_UART3_TX		1
#define PORTB_PIN4_SPI1_MOSI	2

#define PORTB_PIN5_GPIO			0
#define PORTB_PIN5_UART2_TX		1
#define PORTB_PIN5_SWD_CLK		2

#define PORTB_PIN6_GPIO			0
#define PORTB_PIN6_UART2_RX		1
#define PORTB_PIN6_SWD_DAT		2

#define PORTB_PIN7_GPIO			0
#define PORTB_PIN7_TIMR0_IN		1
#define PORTB_PIN7_TIMR0_OUT	2
#define PORTB_PIN7_SPI1_SCLK	3

#define PORTB_PIN8_GPIO		 	0
#define PORTB_PIN8_UART1_TX		1
#define PORTB_PIN8_XTAL_OUT		2

#define PORTB_PIN9_GPIO			0
#define PORTB_PIN9_UART1_RX		1
#define PORTB_PIN9_XTAL_IN		2

#define PORTB_PIN10_GPIO		0
#define PORTB_PIN10_I2C1_SCL	1
#define PORTB_PIN10_SPI0_SCLK	2

#define PORTB_PIN11_GPIO		0
#define PORTB_PIN11_I2C1_SDA	1
#define PORTB_PIN11_SPI0_MISO	2
#define PORTB_PIN11_UART0_RX	3

#define PORTB_PIN12_GPIO		0
#define PORTB_PIN12_SWD_CLK		1
#define PORTB_PIN12_SPI0_MOSI	2
#define PORTB_PIN12_UART0_TX	3

#define PORTB_PIN13_GPIO		0
#define PORTB_PIN13_I2C0_SCL	1
#define PORTB_PIN13_SPI0_SSEL	2
#define PORTB_PIN13_PWM1B		3

#define PORTB_PIN14_GPIO		0

#define PORTB_PIN15_GPIO		0


#define PORTC_PIN0_GPIO		 	0
#define PORTC_PIN0_I2C1_SCL		1
#define PORTC_PIN0_SPI0_SCLK	2

#define PORTC_PIN1_GPIO			0
#define PORTC_PIN1_I2C1_SDA		1
#define PORTC_PIN1_SPI0_MISO	2

#define PORTC_PIN2_GPIO			0
#define PORTC_PIN2_SPI0_MOSI	2

#define PORTC_PIN3_GPIO			0
#define PORTC_PIN3_PWM1A		1

#define PORTC_PIN4_GPIO			0
#define PORTC_PIN4_TIMR2_IN		1
#define PORTC_PIN4_TIMR2_OUT	2

#define PORTC_PIN5_GPIO			0
#define PORTC_PIN5_TIMR1_IN		1
#define PORTC_PIN5_TIMR1_OUT	2

#define PORTC_PIN6_GPIO			0
#define PORTC_PIN6_PWM1A		1
#define PORTC_PIN6_SPI1_SCLK	2

#define PORTC_PIN7_GPIO			0
#define PORTC_PIN7_SPI1_MOSI	1

#define PORTC_PIN8_GPIO			0

#define PORTC_PIN9_GPIO			0

#define PORTC_PIN10_GPIO		0
#define PORTC_PIN10_TIMR1_IN	1
#define PORTC_PIN10_TIMR1_OUT	2
#define PORTC_PIN10_UART2_RX	3

#define PORTC_PIN11_GPIO		0
#define PORTC_PIN11_PWM2A		1
#define PORTC_PIN11_UART2_TX	3

#define PORTC_PIN12_GPIO		0
#define PORTC_PIN12_I2C0_SCL	1
#define PORTC_PIN12_SPI1_SCLK	2

#define PORTC_PIN13_GPIO		0
#define PORTC_PIN13_I2C0_SDA	1
#define PORTC_PIN13_TIMR0_IN	2
#define PORTC_PIN13_TIMR0_OUT	3

#define PORTC_PIN14_GPIO		0
#define PORTC_PIN14_PWM0A		1

#define PORTC_PIN15_GPIO		0
#define PORTC_PIN15_PWM2B		1
#define PORTC_PIN15_SWD_DAT		2
#define PORTC_PIN15_I2C0_SCL	3


#define PORTD_PIN0_GPIO		 	0

#define PORTD_PIN1_GPIO			0

#define PORTD_PIN2_GPIO			0
#define PORTD_PIN2_XTAL_OUT		1

#define PORTD_PIN3_GPIO			0
#define PORTD_PIN3_XTAL_IN		1

#define PORTD_PIN4_GPIO			0
#define PORTD_PIN4_I2C0_SCL		1

#define PORTD_PIN5_GPIO			0
#define PORTD_PIN5_I2C0_SDA		1

#define PORTD_PIN6_GPIO			0
#define PORTD_PIN6_PWM_BREAK	1

#define PORTD_PIN7_GPIO			0

#define PORTD_PIN8_GPIO			0

#define PORTD_PIN9_GPIO			0


#endif //__SWM220_PORT_H__
