void led_off(Ledno) { if(Ledno=="LED_RED")halLedClear(1); elseif(Ledno=="LED_YELLOW")halLedClear(2); elseif(Ledno=="LED_GREEN")halLedClear(3); end if }
/*********************************************************************************** * @fn main * * @brief This is the main entry of the "Light Switch" application. * After the application modes are chosen the switch can * send toggle commands to a light device. * * @param basicRfConfig - file scope variable. Basic RF configuration * data * appState - file scope variable. Holds application state * * @return none */ void main(void) { uint8 appMode = NONE; // Config basicRF basicRfConfig.panId = PAN_ID; basicRfConfig.channel = RF_CHANNEL; basicRfConfig.ackRequest = TRUE; #ifdef SECURITY_CCM basicRfConfig.securityKey = key; #endif // Initalise board peripherals halBoardInit(); // halJoystickInit(); // Initalise hal_rf if(halRfInit()==FAILED) { HAL_ASSERT(FALSE); } // Indicate that device is powered halLedSet(2);//*****************by boo LED2(P1_1=1) halLedClear(1);//***************by boo LED1(P1_0=0) /************Select one and shield to another***********by boo*/ appSwitch(); //½ÚµãΪ°´¼üS1 P0_4 // Role is undefined. This code should not be reached HAL_ASSERT(FALSE); }
/****************************************************************************** * @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); } }