/*--------------------------------------------------------------------------*/
/* UART3 Configuration                                                      */
/*--------------------------------------------------------------------------*/
#define NUCODEGEN_UART3_FUNCSEL_UART		0
#define NUCODEGEN_UART3_FUNCSEL_IrDA		2
#define NUCODEGEN_UART3_FUNCSEL_RS485		3
#define NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE	4

#define UART3_MATCH_ADDRSS1     0xC0
#define UART3_MATCH_ADDRSS2     0xA2
#define UART3_UNMATCH_ADDRSS1   0xB1
#define UART3_UNMATCH_ADDRSS2   0xD3

#define NUCODEGEN_UART3_CTS_HIGH_LEVEL_ACT   0
#define NUCODEGEN_UART3_CTS_LOW_LEVEL_ACT    1

#define NUCODEGEN_UART3_RTS_HIGH_LEVEL_ACT   0
#define NUCODEGEN_UART3_RTS_LOW_LEVEL_ACT    1

#define NUCODEGEN_UART3_RS485_ADD_MODE       0
#define NUCODEGEN_UART3_RS485_NMM_MODE       1

<! clock:  {"ALL" : "UART3" }; !>

		  
<! pin:   {"UART3FunctionRadio":{ "NUCODEGEN_UART3_FUNCSEL_UART":        ["UART3_TXD","UART3_RXD"],
								  "NUCODEGEN_UART3_FUNCSEL_IrDA":        ["UART3_TXD","UART3_RXD"],
								  "NUCODEGEN_UART3_FUNCSEL_RS485":       ["UART3_TXD","UART3_RXD","UART3_nRTS"],
								  "NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE": ["UART3_RXD"]
								 },
								 
           "UART3AutoflowControlCheckbox":{"1":["UART3_nCTS","UART3_nRTS"]
		   }							 
        }; !>


#define NUCODEGEN_UART3_FUNCSEL			<!id:UART3FunctionRadio;
										type:radio;
										label:UART3 Function Select;
										data:NUCODEGEN_UART3_FUNCSEL_UART;
										default:NUCODEGEN_UART3_FUNCSEL_UART;
										helper:;
										sort:false;
										enum:[NUCODEGEN_UART3_FUNCSEL_UART, NUCODEGEN_UART3_FUNCSEL_IrDA, NUCODEGEN_UART3_FUNCSEL_RS485, NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE];
										optionLabels:[UART, IrDA, RS485, Single Wire];
										vertical:false;
										dependencies:none;
										dependenciesOption:none;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#if (NUCODEGEN_UART3_FUNCSEL == NUCODEGEN_UART3_FUNCSEL_UART)
#define UART3_BAUD						<!id:UART3Baudrateinteger;
										type:integer;
										label:UART3 Baud Rate ( 2400 bps ~ 1000000 bps );
										data:115200;
										default:115200;
										helper:Enter your UART3 baud rate.;
										sort:false;
										minimum:2400;
										maximum:1000000;
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_LINE_CONFIG		<!id:UART3SetLineConfigCheckbox;
										type:checkbox;
										label:Config UART3 Line Setting;
										data:0;
										default:0;
										sort:false;
										enum:[1];
										optionLabels:[Enable Config UART3 Line Setting];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_WORD_LEN	    <!id:UART3WordLengthSelect;
										type:select;
										label:UART3 Word Length;
										data:UART_WORD_LEN_8;
										default:UART_WORD_LEN_8;
										helper:;
										sort:false;
										enum:[UART_WORD_LEN_5, UART_WORD_LEN_6, UART_WORD_LEN_7, UART_WORD_LEN_8];
										optionLabels:[5 bits, 6 bits, 7 bits, 8 bits];
										dependencies:UART3SetLineConfigCheckbox;
										dependenciesOption:1;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_PARITY		    <!id:UART3ParityBitSelect;
										type:select;
										label:UART3 Parity Bit;
										data:UART_PARITY_NONE;
										default:UART_PARITY_NONE;
										helper:;
										sort:false;
										enum:[UART_PARITY_NONE, UART_PARITY_ODD, UART_PARITY_EVEN, UART_PARITY_MARK, UART_PARITY_SPACE];
										optionLabels:[None, Odd, Even, Mark, Space];
										dependencies:UART3SetLineConfigCheckbox;
										dependenciesOption:1;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_STOP_BIT	    <!id:UART3StopBitSelect;
										type:select;
										label:UART3 Stop Bits;
										data:UART_STOP_BIT_1;
										default:UART_STOP_BIT_1;
										helper:;
										sort:false;
										enum:[UART_STOP_BIT_1, UART_STOP_BIT_1_5, UART_STOP_BIT_2];
										optionLabels:[1, 1.5 (for Word Lenght 5bits), 2 (for Word Lenght 6-8bits)];
										dependencies:UART3SetLineConfigCheckbox;
										dependenciesOption:1;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_AUTOFLOW		<!id:UART3AutoflowControlCheckbox;
										type:checkbox;
										label:UART3 Auto-flow Control;
										data:0;
										default:0;
										sort:false;
										enum:[1];
										optionLabels:[Enable UART3 Auto-flow Control];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>
										
#define NUCODEGEN_UART3_RTSACTLV_LOW	<!id:UART3RTSACTLVLevelSelect;
										type:select;
										label:nRTS pin input active level;
										data:NUCODEGEN_UART3_RTS_LOW_LEVEL_ACT;
										default:NUCODEGEN_UART3_RTS_LOW_LEVEL_ACT;
										enum:[NUCODEGEN_UART3_RTS_HIGH_LEVEL_ACT,NUCODEGEN_UART3_RTS_LOW_LEVEL_ACT];
										optionLabels:[High level,Low level];
										dependencies:UART3AutoflowControlCheckbox;
										dependenciesOption:1;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>

#define NUCODEGEN_UART3_CTSACTLV_LOW	<!id:UART3CTSACTLVLevelSelect;
										type:select;
										label:nCTS pin input active level;
										data:NUCODEGEN_UART3_CTS_LOW_LEVEL_ACT;
										default:NUCODEGEN_UART3_CTS_LOW_LEVEL_ACT;
										enum:[NUCODEGEN_UART3_CTS_HIGH_LEVEL_ACT,NUCODEGEN_UART3_CTS_LOW_LEVEL_ACT];
										optionLabels:[High level,Low level];
										dependencies:UART3AutoflowControlCheckbox;
										dependenciesOption:1;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>

#define NUCODEGEN_UART3_PDMAEN		   <!id:UART3PDMACheckbox;
										type:checkbox;
										label:PDMA Channel Control;
										data:0;
										default:0;
										sort:false;
										enum:[1];
										optionLabels:[Enable PDMA Channel];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
										groupId:UART3PDMA;    
										groupName:PDMA Configuration;!>
										
#define NUCODEGEN_UART3_PDMAEN_Msk		<!id:UART3PDMASelectCheckbox;
										type:multipleselect;
										label:Channel Setting;
										data:0;
										default:0;
										sort:false;
                                        enum:[UART_INTEN_TXPDMAEN_Msk,UART_INTEN_RXPDMAEN_Msk];
										optionLabels:[Enable TX PDMA,Enable RX PDMA];
										dependencies:UART3PDMACheckbox;
								    	dependenciesOption:1;
										groupId:UART3PDMA;    
								        groupName:PDMA Configuration;!>					
										
										
#define NUCODEGEN_UART3_INTEN			<!id:UART3IntCheckbox;
										type:checkbox;
										label:UART3 Interrupt Control ;
										data:0;
										default:0;
										enum:[1];
										optionLabels:[Enable UART3 Interrupt];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>

#define NUCODEGEN_UART3_INT_MASK		<!id:UART3INTMASKMultipleSelect;
										type:multipleselect;
										label:Select Interrupts;
										size:7;
										data:0;
										default:0;
										helper:If you would like to use the ' Transmit Holding Register Empty ' or ' Transmitter Empty ' Interrupt function ,you can add in code.;
										sort:false;
										enum:[UART_INTEN_RDAIEN_Msk, UART_INTEN_RLSIEN_Msk, UART_INTEN_MODEMIEN_Msk, UART_INTEN_RXTOIEN_Msk, UART_INTEN_BUFERRIEN_Msk, UART_INTEN_WKIEN_Msk, UART_INTEN_ABRIEN_Msk];
										optionLabels:[Receive Data Available, Receive Line Status, Modem Status, RX Time-Out, Buffer Error, Wake-Up, Auto-baud Rate];
										dependencies:UART3IntCheckbox;
										dependenciesOption:1;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>
										
#elif (NUCODEGEN_UART3_FUNCSEL == NUCODEGEN_UART3_FUNCSEL_IrDA)
#define UART3_IRDA_BAUD					<!id:UART3IRDABaudrateinteger;
										type:integer;
										label:UART3 IrDA Baud Rate ( 2400 bps ~ 115200 bps );;
										data:115200;
										default:115200;
										helper:Enter your UART3 IRDA baud rate.;
										sort:false;
										minimum:2400;
										maximum:115200;
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_IrDA;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_IRDA_MODE		<!id:UART3IrDAModeRadio;
										type:radio;
										label:IrDA Receivr/Transmitter Selection;
										data:UART_IRDA_RXEN;
										default:UART_IRDA_RXEN;
										sort:false;
										enum:[UART_IRDA_RXEN, UART_IRDA_TXEN];
										optionLabels:[Rx mode, Tx mode];
										vertical:false;
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_IrDA;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_IRDA_INTEN		<!id:UART3IRDAIntCheckbox;
										type:checkbox;
										label:UART3 IrDA Interrupt Control;
										data:0;
										default:0;
										enum:[1];
										optionLabels:[Enable UART3 IrDA Interrupt];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_IrDA;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>

#define NUCODEGEN_UART3_IRDA_INT_MASK	<!id:UART3IRDAINTMASKMultipleSelect;
										type:multipleselect;
										label:Select Interrupts;
										size:2;
										data:0;
										default:0;
										helper:If you would like to use the ' Transmit Holding Register Empty ' or ' Transmitter Empty ' Interrupt function ,you can add in code.;
										sort:false;
										enum:[UART_INTEN_RDAIEN_Msk, UART_INTEN_RXTOIEN_Msk];
										optionLabels:[Receive Data Available, RX Time-Out];
										dependencies:UART3IRDAIntCheckbox;
										dependenciesOption:1;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>
										
#elif (NUCODEGEN_UART3_FUNCSEL == NUCODEGEN_UART3_FUNCSEL_RS485)
#define UART3_RS485_BAUD				<!id:UART3RS485Baudrateinteger;
										type:integer;
										label:UART3 RS485 Baud Rate ( 2400 bps ~ 1000000 bps );;
										data:115200;
										default:115200;
										helper:Enter your UART3 RS485 baud rate.;
										sort:false;
										minimum:2400;
										maximum:1000000;
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_RS485;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>

#define NUCODEGEN_UART3_RS485_MODE		<!id:UART3RS485CTLRadio;
										type:radio;
										label:RS485 Operation Mode;
										data:0;
										default:0;
										sort:false;
										enum:[NUCODEGEN_UART3_RS485_ADD_MODE, NUCODEGEN_UART3_RS485_NMM_MODE];
										optionLabels:[Auto Address Detection Operation Mode (AAD), Normal Multi-Drop Operation Mode (NMM) ];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_RS485;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>

#define UART3_RS485_ADDRMV				<!id:UART3RS485AddrMVInteger;
										type:integer;
										label:UART3 RS485 Address Match Value;
										data:0;
										default:0;
										helper:Enter your UART3 RS485 Address Match Value;
										minimum:0;
										maximum:255;
										dependencies:UART3RS485CTLRadio;
										dependenciesOption:NUCODEGEN_UART3_RS485_ADD_MODE;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>

#define NUCODEGEN_UART3_RS485_INTEN		<!id:UART3RS485IntCheckbox;
										type:checkbox;
										label:UART3 RS485 Interrupt Control;
										data:0;
										default:0;
										enum:[1];
										optionLabels:[Enable UART3 RS485 Interrupt];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_RS485;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!> 

#define NUCODEGEN_UART3_RS485_INT_MASK	<!id:UART3RS485INTMASKMultipleSelect;
										type:multipleselect;
										label:Select UART3 RS485 Interrupts;
										size:5;
										data:0;
										default:0;
										helper:If you would like to use the ' Transmit Holding Register Empty ' or ' Transmitter Empty ' Interrupt function ,you can add in code.;
										sort:false;
										enum:[UART_INTEN_RDAIEN_Msk, UART_INTEN_RLSIEN_Msk, UART_INTEN_RXTOIEN_Msk, UART_INTEN_BUFERRIEN_Msk];
										optionLabels:[Receive Data Available, Receive Line Status, RX Time-Out, Buffer Error];
										dependencies:UART3RS485IntCheckbox;
										dependenciesOption:1;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!> 

										
#elif (NUCODEGEN_UART3_FUNCSEL == NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE)

#define UART3_SW_BAUD					<!id:UART3SWBaudrateinteger;
										type:integer;
										label:UART3 Single-wire Baud Rate ( 2400 bps ~ 1000000 bps );
										data:115200;
										default:115200;
										helper:Enter your UART3 Single-wire baud rate.;
										sort:false;
										minimum:2400;
										maximum:1000000;
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE;
										groupId:UART3Basic;    
										groupName:Basic Configuration;!>
										
#define NUCODEGEN_UART3_PDMAEN		   <!id:UART3SWPDMACheckbox;
										type:checkbox;
										label:PDMA Channel Control;
										data:0;
										default:0;
										sort:false;
										enum:[1];
										optionLabels:[Enable PDMA Channel];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE;
										groupId:UART3PDMA;    
										groupName:PDMA Configuration;!>	
										
#define NUCODEGEN_UART3_PDMAEN_Msk		<!id:UART3SWPDMASelectCheckbox;
										type:select;
										label:Channel Select;
										data:0;
										default:0;
										sort:false;
										enum:[UART_INTEN_TXPDMAEN_Msk,UART_INTEN_RXPDMAEN_Msk];
										optionLabels:[Enable TX PDMA,Enable RX PDMA];
										dependencies:UART3SWPDMACheckbox;
										dependenciesOption:1;
										groupId:UART3PDMA;    
										groupName:PDMA Configuration;!>	
										
#define NUCODEGEN_UART3_SW_INTEN		<!id:UART3SWIntCheckbox;
										type:checkbox;
										label:UART3 Single-wire Interrupt Control;
										data:0;
										default:0;
										enum:[1];
										optionLabels:[Enable UART3 Single-wire Interrupt];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>

#define NUCODEGEN_UART3_SW_INT_MASK		<!id:UART3SWINTMASKMultipleSelect;
										type:multipleselect;
										label:Select Interrupts;
										size:7;
										data:0;
										default:0;
										helper:If you would like to use the ' Transmit Holding Register Empty ' or ' Transmitter Empty ' Interrupt function ,you can add in code.;
										sort:false;
										enum:[UART_INTEN_RDAIEN_Msk, UART_INTEN_RLSIEN_Msk, UART_INTEN_RXTOIEN_Msk, UART_INTEN_BUFERRIEN_Msk, UART_INTEN_WKIEN_Msk, UART_INTEN_ABRIEN_Msk, UART_INTEN_SWBEIEN_Msk];
										optionLabels:[Receive Data Available, Receive Line Status, RX Time-Out, Buffer Error, Wake-Up, Auto-baud Rate, Single-wire Bit Error Detection];
										dependencies:UART3SWIntCheckbox;
										dependenciesOption:1;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>
#endif

#define NUCODEGEN_UART3_ABRDEN			<!id:UART3AutobaudRateCheckbox;
										type:checkbox;
										label:Auto-baud Rate Detect;
										data:0;
										default:0;
										helper:Input pattern shall be 0x01;
										sort:false;
										enum:[1];
										optionLabels:[Enable Auto-baud Rate Detect];
										dependencies:UART3FunctionRadio;
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART|NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE;
										groupId:UART3Advanced;    
										groupName:Advanced Configuration;!>	

#define NUCODEGEN_UART3_TOCNTEN			<!id:UART3TimeoutCounterCheckbox;
										type:checkbox;
										label:Receive Buffer Time Out Control;
										data:0;
										default:0;
										sort:false;
										enum:[1];
										optionLabels:[Enable Receive Buffer Time Out];
										dependencies:UART3FunctionRadio;	
										dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART|NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE|NUCODEGEN_UART3_FUNCSEL_IrDA;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>

#if NUCODEGEN_UART3_TOCNTEN
#define UART3_TOCNT						<!id:UART3TimeoutCountInteger;
										type:integer;
										label:Time Out Interrupt Comparator;
										data:40;
										default:40;
										helper:Enter your UART3 Time-Out Interrupt Comparator(The counting clock = Baud rate);
										minimum:40;
										maximum:255;
										dependencies:UART3TimeoutCounterCheckbox;
										dependenciesOption:1;
										groupId:UART3Interrupt;    
										groupName:Interrupt Configuration;!>
#endif



#define NUCODEGEN_UART3_WKDATEN 	  <!id:UART3DataWakeupCheckbox;
								 	  type:checkbox;
									  label:Wake Up Source;
									  data:0;
									  default:0;
									  enum:[1];
									  optionLabels:[Enable Incoming Data Wake-up];
									  dependencies:UART3FunctionRadio;
									  dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART|NUCODEGEN_UART3_FUNCSEL_SINGLE_WIRE;
									  groupId:UART3Interrupt;    
						              groupName:Interrupt Configuration;!>				  
									
#define NUCODEGEN_UART3_WKCTSEN 	<!id:UART3nCTSWakeupCheckbox;
									type:checkbox;
									label:<br>;
									data:0;
									default:0;
									enum:[1];
									optionLabels:[Enable nCTS Wake-up];
									dependencies:UART3FunctionRadio;
									dependenciesOption:NUCODEGEN_UART3_FUNCSEL_UART;
									groupId:UART3Interrupt;    
						            groupName:Interrupt Configuration;!>


