Example #1
0
/******************************************************************************
 * @fn          main
 *
 * @brief       Main handles all applications attached to the menu system
 *
 * input parameters
 *
 * output parameters
 *
 *@return
 */
void main( void )
{
  /* Stop watchdog timer to prevent time out reset */
  WDTCTL = WDTPW + WDTHOLD;

  /* Settingcapacitor values for XT1, 32768 Hz */
  halMcuStartXT1();

  /* Clocks:
   * mclk  = mclkFrequency
   * smclk = mclkFrequency
   * aclk  = 32768 Hz
   */
  mclkFrequency = HAL_MCU_SYSCLK_16MHZ;
  halMcuSetSystemClock(mclkFrequency);

  /* Care must be taken when handling power modes
   * - Peripheral units can request clocks and have them granted even if
   *   the system is in a power mode. Peripheral clock request is enabled
   *   as default.
   * - Per test only needs ACLK to be enabled to timers
   *   during power mode operation
   */
  halMcuDisablePeripheralClockRequest((MCLKREQEN+SMCLKREQEN));


  /* SPI flash uses same SPI interface as LCD -- we'll disable the SPI flash */
 P8SEL &= BIT6; /*ioflash_csn = gp.      */
 P8DIR |= BIT6; /*tpflash_csn = ouut.    */
 P8OUT |= BIT6; /*flash_csn = 1.         */

  /* Init leds and turn them on */
  halLedInit();

  /* Init Buttons */
  halButtonsInit();
  halButtonsInterruptEnable();

  /* Instantiate tranceiver RF spi interface to SCLK = 1 MHz */
  trxRfSpiInterfaceInit(0x10);

  halLedSet(LED_1);

  initSimpleLink();

  halLedSet(LED_2);

  simpleLinkMaster();

  while(1)
  {
	  halLedSet(LED_3);
	  halTimer32kMcuSleepTicks(3276);
	  halLedClear(LED_3);
	  halTimer32kMcuSleepTicks(3276);
  }
}
Example #2
0
void configureAIR()
{
	  //init MCU
	  halInitMCU();
	  //init LEDs
	  halLedInit();
	  //init button
	  halButtonInit();
	  halButtonInterruptEnable();
	  // init spi
	  exp430RfSpiInit();
	  // write radio registers
	  registerConfig();
}