392
#define DELAY 4000
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void sleep(unsigned int time);
#pragma vector = TIMER0_A0_VECTOR
__interrupt void ISR_Timer0_A0(void)
{
TA0CTL &= ~MC_1;
TA0CCTL0 &= ~(CCIE);
__bic_SR_register_on_exit(LPM3_bits + GIE);
}
#pragma vector = PORT2_VECTOR, \
PORT1_VECTOR, \
TIMER0_A1_VECTOR, \
USI_VECTOR, \
NMI_VECTOR,COMPARATORA_VECTOR, \
ADC10_VECTOR
__interrupt void ISR_trap(void)
{
// the following will cause an access violation which results in a PUC reset
WDTCTL = 0;
}
// Main Function
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
GPIO_graceInit();
BCSplus_graceInit();
TI_CAPT_Init_Baseline(&one_button);
TI_CAPT_Update_Baseline(&one_button, 6);
while (1)
{
if(TI_CAPT_Button(&one_button))
{
P1OUT ^= BIT0;
P1OUT |= BIT6;
}
else
{
P1OUT &= ~BIT6;
}
sleep(DELAY);
}