/*--------------------------------------------------------------------------*/
/* USCI1_SPI Configuration                                                  */
/*--------------------------------------------------------------------------*/

 <!
 filter:{
          "USPI1_WAKEUP_FUNC":           "1",
          "USPI1_SS_EN":                 "1",
          "USPI1_AUTOSS_EN":             "1",
          "USPI1_SS_LEVEL_SET":          "1",
          "USPI1_3WIRE_FUNC":            "1",
          "USPI1_INT_SEL":               "1"                      
        };!>
                		
<! clock: {"ALL" : "USCI1" }; !>
<! pin:   {"USPI1_NormalPinConfigHidden":{"NUCODEGEN_USPI1_PIN_NORMAL":["USCI1_DAT0", "USCI1_DAT1", "USCI1_CTL0","USCI1_CLK"]},
           "USPI1_3WIREPinConfigHidden":{"NUCODEGEN_USPI1_PIN_3WIRE":["USCI1_DAT0", "USCI1_DAT1","USCI1_CLK"]},
           "USPI1_HalfduplexPinConfigHidden":{"NUCODEGEN_USPI1_PIN_HALFDUPLEX":["USCI1_DAT0", "USCI1_CTL0","USCI1_CLK"]}};
!>

#define NUCODEGEN_USPI1_MASTER_MODE   0
#define NUCODEGEN_USPI1_SLAVE_MODE    1 

#define NUCODEGEN_USPI1_MASTER_SLAVE             (<!id:USPI1MasterSlave;
                                                    type:radio;
                                                    label:Select master/slave mode;
                                                    data:NUCODEGEN_USPI1_MASTER_MODE;
                                                    default:NUCODEGEN_USPI1_MASTER_MODE;
                                                    enum:[NUCODEGEN_USPI1_MASTER_MODE, NUCODEGEN_USPI1_SLAVE_MODE];
                                                    optionLabels:[Master, Slave];
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>)
												
#define NUCODEGEN_USPI1_TIME_MODE               (<!id:USPI1Mode;
                                                    type:radio;
                                                    label:Select transfer timing;
                                                    data:USPI_MODE_0;
                                                    default:USPI_MODE_0;
                                                    enum:[  USPI_MODE_0, USPI_MODE_1, USPI_MODE_2, USPI_MODE_3];
                                                    optionLabels:[  Mode 0, Mode 1, Mode 2, Mode 3];
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>)   
												
#define NUCODEGEN_USPI1_DATAWIDTH               (<!id:USPI1DataWidth;
                                                    type:select;
                                                    label:Select data width;
                                                    data:16;
                                                    default:16;
                                                    enum:[4, 5 ,6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
                                                    optionLabels:[4-bits, 5-bits, 6-bits, 7-bits, 8-bits, 9-bits, 10-bits, 11-bits, 12-bits, 13-bits, 14-bits, 15-bits, 16-bits];
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>)
												
#define NUCODEGEN_USPI1_BUSCLOCK                (<!id:USPI1BusClock;
                                                    type:integer;
                                                    label:Set bus clock;
                                                    data:2000000;
                                                    default:2000000;
                                                    helper:Enter bus clock 2,000,000~24,000,000 Hz;
                                                    minimum:23438;
                                                    maximum:24000000;
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>) 
												
#define NUCODEGEN_USPI1_3WIRE_EN                (<!id:USPI13WireModeEn;
                                                    type:radio;
                                                    label:Enable 3 wire mode;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[ Disable, Enable];
                                                    dependencies:USPI1MasterSlave;
                                                    dependenciesOption:NUCODEGEN_USPI1_SLAVE_MODE;
                                                    filterExp:USPI1_3WIRE_FUNC>0;
                                                !>)                                     
                                                
#define NUCODEGEN_USPI1_HALF_DUPLEX_EN          (<!id:USPI1HalfDuplexEn;
                                                    type:radio;
                                                    label:Enable half duplex function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[ Disable, Enable];
                                                    dependencies:(USPI1MasterSlave|USPI13WireModeEn);
                                                    dependenciesOption:{"USPI1MasterSlave":"NUCODEGEN_USPI1_MASTER_MODE", "USPI13WireModeEn":"0"};
                                                !>)
												
#define NUCODEGEN_USPI1_DATA_DIR                (<!id:USPI1DataDirection;
                                                    type:radio;
                                                    label:Select data direction;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[ Input Mode, Output Mode];
                                                    dependencies:USPI1HalfDuplexEn;
                                                    dependenciesOption:1;
                                                !>) 
                                                
#define NUCODEGEN_USPI1_MASTER_SS_LEVEL         (<!id:USPI1MasterSSLevel;
                                                    type:radio;
                                                    label:Select SS active level;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Active High, Active Low];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:USPI1MasterSlave;
                                                    dependenciesOption:NUCODEGEN_USPI1_MASTER_MODE;
                                                    filterExp:USPI1_SS_LEVEL_SET>0;
                                                !>)
                                                
#define NUCODEGEN_USPI1_SLAVE_SS_LEVEL          (<!id:USPI1SlaveSSLevel;
                                                    type:radio;
                                                    label:Select SS active level;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Active High, Active Low];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:USPI13WireModeEn;
                                                    dependenciesOption:0;
                                                    filterExp:USPI1_SS_LEVEL_SET>0;
                                                !>)										
										        
#define NUCODEGEN_USPI1_AUTOSS_EN               (<!id:USPI1AutoSSEn;
                                                    type:radio;
                                                    label:Enable auto SS;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:USPI1MasterSlave;
                                                    dependenciesOption:NUCODEGEN_USPI1_MASTER_MODE;
                                                    filterExp:USPI1_AUTOSS_EN>0;
                                                !>)
												
#define NUCODEGEN_USPI1_SS_EN                   (<!id:USPI1SSEn;
                                                    type:radio;
                                                    label:Enable SS function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:USPI1AutoSSEn;
                                                    dependenciesOption:0;
                                                    filterExp:USPI1_SS_EN>0;
                                                !>)                                         
                                                
#define NUCODEGEN_USPI1_ORDER                   (<!id:USPI1Order;
                                                    type:radio;
                                                    label:Select transfer sequence with MSB/LSB;
                                                    data:1;
                                                    default:1;
                                                    enum:[1, 0];
                                                    optionLabels:[MSB, LSB];
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>) 
										        
#define NUCODEGEN_USPI1_TX_PDMA_EN              (<!id:USPI1TxPDMAEn;
                                                    type:radio;
                                                    label:Enable Tx PDMA function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>)
												
#define NUCODEGEN_USPI1_RX_PDMA_EN              (<!id:USPI1RxPDMAEn;
                                                    type:radio;
                                                    label:Enable Rx PDMA function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>)
												
#define NUCODEGEN_USPI1_WAKE_UP_EN              (<!id:USPI1WAKEUPEn;
                                                    type:radio;
                                                    label:Enable wake up function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                    filterExp:USPI1_WAKEUP_FUNC>0;
                                                !>)
												
#define NUCODEGEN_USPI1_INT_EN                  (<!id:USPI1INTEn;
                                                    type:radio;
                                                    label:Enable interrupt function;
                                                    data:0;
                                                    default:0;
                                                    enum:[0, 1];
                                                    optionLabels:[Disable, Enable];
                                                    vertical:false;
                                                    sort:false;
                                                    dependencies:none;
                                                    dependenciesOption:none;
                                                !>) 
												
#define NUCODEGEN_USPI1_INT_SEL                 <!id:USPI1INTSel;
                                                    type:multipleselect;
                                                    label:Select interrupts;
                                                    data:;
                                                    default:;
													helper:USPI_SLVTO_INT only act in Slave mode.;
                                                    enum:[USPI_SLVTO_INT_MASK, 
                                                            USPI_TXUDR_INT_MASK, USPI_RXOV_INT_MASK, USPI_TXST_INT_MASK, USPI_TXEND_INT_MASK,
                                                            USPI_RXST_INT_MASK, USPI_RXEND_INT_MASK];
                                                    optionLabels:[USPI_SLVTO_INT,
                                                            USPI_TXUDR_INT, USPI_RXOV_INT, USPI_TXST_INT, USPI_TXEND_INT,
                                                            USPI_RXST_INT, USPI_RXEND_INT];
                                                    dependencies:USPI1INTEn;
                                                    dependenciesOption:1;
                                                    filterExp:USPI1_INT_SEL==0;
                                                !><!id:USPI1INTSel;
                                                    type:multipleselect;
                                                    label:Select interrupts.;
                                                    data:;
                                                    default:;
													helper:USPI_SSINACT_INT, USPI_SSACT_INT, USPI_SLVTO_INT, USPI_SLVBE_INT only act in Slave mode.;
                                                    enum:[USPI_SSINACT_INT_MASK, USPI_SSACT_INT_MASK, USPI_SLVTO_INT_MASK, USPI_SLVBE_INT_MASK,
                                                            USPI_TXUDR_INT_MASK, USPI_RXOV_INT_MASK, USPI_TXST_INT_MASK, USPI_TXEND_INT_MASK,
                                                            USPI_RXST_INT_MASK, USPI_RXEND_INT_MASK];
                                                    optionLabels:[USPI_SSINACT_INT, USPI_SSACT_INT, USPI_SLVTO_INT, USPI_SLVBE_INT,
                                                            USPI_TXUDR_INT, USPI_RXOV_INT, USPI_TXST_INT, USPI_TXEND_INT,
                                                            USPI_RXST_INT, USPI_RXEND_INT];
                                                    dependencies:USPI1INTEn;
                                                    dependenciesOption:1;
                                                    filterExp:USPI1_INT_SEL==1;
                                                !> 
                                                
#define NUCODEGEN_USPI1_PIN_NORMAL                    0
#define NUCODEGEN_USPI1_PIN_HALFDUPLEX                1                                     
#define NUCODEGEN_USPI1_PIN_3WIRE                     2



#define NUCODEGEN_USPI1_PIN_CONFIG               <!id:USPI1_NormalPinConfigHidden; 
                                                    type:hidden;
                                                    data:NUCODEGEN_USPI1_PIN_NORMAL;
                                                    default:NUCODEGEN_USPI1_PIN_NORMAL; 
                                                    observable:USPI1MasterSlave;
                                                    listener:{"NUCODEGEN_USPI1_MASTER_MODE"  : "NUCODEGEN_USPI1_PIN_NORMAL",
                                                              "NUCODEGEN_USPI1_SLAVE_MODE"  : "NUCODEGEN_USPI1_PIN_NORMAL"};
                                                    dependencies:((USPI1MasterSlave&USPI13WireModeEn&USPI1HalfDuplexEn)| USPI1HalfDuplexEn);
                                                    dependenciesOption:{"USPI1MasterSlave":"NUCODEGEN_USPI1_SLAVE_MODE",
                                                                        "USPI13WireModeEn":"0",
                                                                        "USPI1HalfDuplexEn":"0",
                                                                        "USPI1HalfDuplexEn":"0"};
                                                    dependenciesDefault:false;
                                                !><!id:USPI1_3WIREPinConfigHidden; 
                                                    type:hidden;
                                                    data:NUCODEGEN_USPI1_PIN_3WIRE;
                                                    default:NUCODEGEN_USPI1_PIN_3WIRE; 
                                                    observable:USPI13WireModeEn;
                                                    listener:{"1"  : "NUCODEGEN_USPI1_PIN_3WIRE"};
                                                    dependencies:[USPI13WireModeEn];
                                                    dependenciesOption:{"USPI13WireModeEn":"1"};
                                                    dependenciesDefault:false;
                                                !><!id:USPI1_HalfduplexPinConfigHidden; 
                                                    type:hidden;
                                                    data:NUCODEGEN_USPI1_PIN_HALFDUPLEX;
                                                    default:NUCODEGEN_USPI1_PIN_HALFDUPLEX; 
                                                    observable:USPI1HalfDuplexEn;
                                                    listener:{"1"  : "NUCODEGEN_USPI1_PIN_HALFDUPLEX"};
                                                    dependencies:[USPI1HalfDuplexEn];
                                                    dependenciesOption:{"USPI1HalfDuplexEn":"1"};
                                                    dependenciesDefault:false;
                                                    !>         		