/**
 *  @fileOverview Grace
 */

/* need to use the CSL module to generate the CSL code */
var CSL = xdc.useModule('ti.mcu.msp430.csl.CSL');
var USCI_A0 = xdc.useModule('ti.mcu.msp430.csl.communication.USCI_A0');
var USCI_B0 = xdc.useModule('ti.mcu.msp430.csl.communication.USCI_B0');
CSL.configApiVersion = "1.00.00";

/* these modules should be part of every project */
var WDTplus = xdc.useModule('ti.mcu.msp430.csl.watchdog.WDTplus');
var GPIO = xdc.useModule('ti.mcu.msp430.csl.gpio.GPIO');
var BCSplus = xdc.useModule('ti.mcu.msp430.csl.clock.BCSplus');
var System = xdc.useModule('ti.mcu.msp430.csl.system.System');

/* set stack and heap sizes as appropriate for MSP430 */
Program.sysStack = 0;
Program.stack = 64;
Program.heap = 0;
Program.argSize = 0;

/* Enable global interrupt */
System.srRegs.SR.GIE = System.srDefs.GIE;
CSL.device.vcc = 3.3;
USCI_A0.toggleButtonUART = true;
USCI_A0.showSelectionPage = false;
USCI_A0.uartRegs.UCA0CTL1.UCSSEL = USCI_A0.uartDefs.UCSSEL_2;
USCI_A0.usciUartPin[0] = 1;
GPIO.regs.P1SEL.Bit1 = GPIO.defs.BIT1;
GPIO.regs.P1SEL2.Bit1 = GPIO.defs.BIT1;
USCI_A0.txIntHandlerOperatingModeOnExit = USCI_A0.ACTIVE;
USCI_A0.rxIntHandlerOperatingModeOnExit = USCI_A0.ACTIVE;
System.ie2Regs.IE2.UCA0TXIE = System.ie2Defs.UCA0TXIE_OFF;
System.ie2Regs.IE2.UCA0RXIE = System.ie2Defs.UCA0RXIE_OFF;
USCI_A0.standardBaudRatesBasicViewUART = USCI_A0.BaudRate_4;
USCI_A0.standardBaudRatesPowerViewUART = USCI_A0.BaudRate_4;
USCI_A0.uartRegs.UCA0BR0 = 104;
USCI_A0.uartRegs.UCA0MCTL.UCBRS = USCI_A0.uartDefs.UCBRS_1;
USCI_A0.usciUartPin[1] = 1;
GPIO.regs.P1SEL.Bit2 = GPIO.defs.BIT2;
GPIO.regs.P1SEL2.Bit2 = GPIO.defs.BIT2;
USCI_B0.toggleButtonSPI = true;
USCI_B0.showSelectionPage = false;
USCI_B0.spiRegs.UCB0CTL1.UCSSEL = USCI_B0.spiDefs.UCSSEL_2;
USCI_B0.spiRegs.UCB0CTL0.UCMST = USCI_B0.spiDefs.UCMST;
USCI_B0.usciSpiPin[0] = 1;
GPIO.regs.P1SEL.Bit5 = GPIO.defs.BIT5;
GPIO.regs.P1SEL2.Bit5 = GPIO.defs.BIT5;
USCI_B0.usciSpiPin[1] = 1;
GPIO.regs.P1SEL.Bit6 = GPIO.defs.BIT6;
GPIO.regs.P1SEL2.Bit6 = GPIO.defs.BIT6;
USCI_B0.usciSpiPin[2] = 1;
GPIO.regs.P1SEL.Bit7 = GPIO.defs.BIT7;
GPIO.regs.P1SEL2.Bit7 = GPIO.defs.BIT7;
USCI_B0.standardSPIBitRatesBasicView = USCI_B0.SPIBitRate_3;
USCI_B0.standardSPIBitRatesPowerView = USCI_B0.SPIBitRate_3;
USCI_B0.spiRegs.UCB0CTL0.UCMSB = USCI_B0.spiDefs.UCMSB;
USCI_B0.spiRegs.UCB0BR0 = 20;
System.ie2Regs.IE2.UCB0TXIE = System.ie2Defs.UCB0TXIE_OFF;
GPIO.regs.P2DIR.Bit0 = GPIO.defs.BIT0;
GPIO.regs.P2DIR.Bit2 = GPIO.defs.BIT2;
GPIO.regs.P2DIR.Bit1 = GPIO.defs.BIT1;
GPIO.regs.P1DIR.Bit0 = GPIO.defs.BIT0;
GPIO.regs.P1DIR.Bit3 = GPIO.defs.BIT3;
GPIO.regs.P1DIR.Bit4 = GPIO.defs.BIT4;
GPIO.regs.P2DIR.Bit3 = GPIO.defs.BIT3;
GPIO.regs.P2DIR.Bit4 = GPIO.defs.BIT4;
GPIO.regs.P2DIR.Bit5 = GPIO.defs.BIT5;
GPIO.regs.P2DIR.Bit6 = GPIO.defs.BIT6;
GPIO.regs.P2SEL.Bit6 = GPIO.defs.BIT6_OFF;
GPIO.regs.P2DIR.Bit7 = GPIO.defs.BIT7;
GPIO.regs.P2SEL.Bit7 = GPIO.defs.BIT7_OFF;
