Example #1
0
void SetupVibrationMotorTimerAndPwm(void)
{
  // Start with P7.3 as an output
  P7OUT &= ~BIT3;   // Low when a digital output
  P7SEL &= ~BIT3;   // P7 option select = false
  P7DIR |=  BIT3;   // P7 outputs

  STOP_VIBE_PWM_TIMER();
  
  // No expansion divide
  TA1EX0 = 0;       

  // do a PWM with 64 total steps.  This gives a count up of 32 and
  // a count down of 32
  TA1CCR0 =  31;

  // Compare channel 2 is used as output
  TA1CCTL2 = OUTMOD_6;         // PWM output mode: 6 - toggle/set
  TA1CCR2 = 10;                // 10 is a 2/3 duty cycle
  
  START_VIBE_PWM_TIMER();
}
void DisableVibratorPwm(void)
{
  STOP_VIBE_PWM_TIMER();
}