Пример #1
0
void main ()
{
  WDTCTL = WDTPW | WDTHOLD;

#if BSP430_LED - 0
  vBSP430ledInitialize_ni();
  {
    int i;

    vBSP430ledSet(0, 1);
    for (i = 0; i < 20; ++i) {
      vBSP430ledSet(0, -1);
      vBSP430ledSet(1, -1);
      __delay_cycles(BSP430_CLOCK_PUC_MCLK_HZ / 10);
    }
    /* The subsequent vBSP430lpmConfigurePortsForLPM_ni() call should
     * turn off the LED that's still lit. */
  }
#endif

  vBSP430lpmConfigurePortsForLPM_ni();

  __delay_cycles(BSP430_CLOCK_PUC_MCLK_HZ);
  while (1) {
#if (0 <= APP_LPM) && (APP_LPM <= 4)
    BSP430_CORE_LPM_ENTER_NI(lpm_bits[APP_LPM]);
    /* For this application it doesn't matter that GIE is now set */
#endif
  }
}
Пример #2
0
void
vBSP430platformSpinForJumper_ni (void)
{
  /* P1.2 input with pullup */
  P1SEL &= ~BIT2;
  P1DIR &= ~BIT2;
  P1REN |= BIT2;
  P1OUT |= BIT2;
#if BSP430_LED
  vBSP430ledInitialize_ni();
#else /* BSP430_LED */
  P1DIR |= (BIT0 | BIT1);
  P1SEL &= ~(BIT0 | BIT1);
#endif /* BSP430_LED */
  P1OUT |= BIT0;
  while (! (P1IN & BIT2)) {
    BSP430_CORE_WATCHDOG_CLEAR();
    BSP430_CORE_DELAY_CYCLES(BSP430_CLOCK_NOMINAL_MCLK_HZ / 10);
    P1OUT ^= BIT0 | BIT1;
  }
  /* Restore P1.2 */
  P1OUT &= ~(BIT0 | BIT1 | BIT2);
  P1DIR |= BIT2;
  P1REN &= ~BIT2;
}
Пример #3
0
void vBSP430platformInitialize_ni (void)
{
  int crystal_ok = 0;
  (void)crystal_ok;

#if BSP430_PLATFORM_BOOT_DISABLE_WATCHDOG - 0
  /* Hold off watchdog */
  WDTCTL = WDTPW | WDTHOLD;
#endif /* configBSP430_CORE_SUPPORT_WATCHDOG */

#if (BSP430_PLATFORM_BOOT_CONFIGURE_LEDS - 0) && (BSP430_LED - 0)
  vBSP430ledInitialize_ni();
#endif /* BSP430_PLATFORM_BOOT_CONFIGURE_LEDS */

#if BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 - 0
  /* Enable XT1 functions and clock */
  crystal_ok = iBSP430clockConfigureLFXT1_ni(1, (BSP430_PLATFORM_BOOT_LFXT1_DELAY_SEC * BSP430_CLOCK_PUC_MCLK_HZ) / BSP430_CLOCK_LFXT1_STABILIZATION_DELAY_CYCLES);
#endif /* BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 */

#if BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS - 0
  iBSP430clockConfigureACLK_ni(BSP430_PLATFORM_BOOT_ACLKSRC);
  ulBSP430clockConfigureMCLK_ni(BSP430_CLOCK_NOMINAL_MCLK_HZ);
  iBSP430clockConfigureSMCLKDividingShift_ni(BSP430_CLOCK_NOMINAL_SMCLK_DIVIDING_SHIFT);
#if configBSP430_CORE_DISABLE_FLL - 0
  __bis_status_register(SCG0);
#endif /* configBSP430_CORE_DISABLE_FLL */
#endif /* BSP430_PLATFORM_BOOT_CONFIGURE_CLOCKS */

#if BSP430_UPTIME - 0
  vBSP430uptimeStart_ni();
#endif /* BSP430_UPTIME */
}
Пример #4
0
void
vBSP430platformSpinForJumper_ni (void)
{
  const unsigned char led_bits = BIT1 | BIT2 | BIT3 | BIT4 | BIT5;
  /* P7.7 input configured with pullup */
  P7DIR &= ~BIT7;
  P7REN |= BIT7;
  P7OUT |= BIT7;

  /* Flash LEDs alternately while waiting */
#if BSP430_LED
  vBSP430ledInitialize_ni();
#else /* BSP430_LED */
  P1DIR |= led_bits;
  P1SEL &= ~led_bits;
#endif /* BSP430_LED */
  P1OUT &= ~(BIT2 | BIT4);
  P1OUT |= BIT1 | BIT3 | BIT5;
  while (! (P7IN & BIT7)) {
    BSP430_CORE_WATCHDOG_CLEAR();
    BSP430_CORE_DELAY_CYCLES(BSP430_CLOCK_NOMINAL_MCLK_HZ / 10);
    P1OUT ^= led_bits;
  }

  /* Restore P1.0 and LEDs */
  P1OUT &= ~led_bits;
  P7OUT &= ~BIT7;
  P7DIR |= BIT7;
  P7REN &= ~BIT7;
}