ID(task_id); //注册串口任务 P0SEL &= ~0X20; P0DIR |= 0X20; P0SEL &= ~0X10; P0DIR &= ~0X10; } 3.2 按键函数 void SampleApp_HandleKeys( uint8 shift, uint8 keys ) { (void)shift; // Intentionally unreferenced parameter if( keys & HAL_KEY_SW_6 ){ #if defined(ZDO_COORDINATOR) SampleApp_SendPeriodicMessage(); #else #endif } if( keys & HAL_KEY_SW_1 ){ /* The mand is sent to Group 1. * This key toggles this device in and out of group 1. * If this device doesn't belong to group 1, this application * will not receive the mand sent to group 1. */ aps_Group_t *grp; grp = aps_FindGroup( SAMPLEAPP_ENDPOINT, SAMPLEAPP_FLASH_GROUP ); if( grp ){ // Remove from the group aps_RemoveGroup( SAMPLEAPP_ENDPOINT, SAMPLEAPP_FLASH_GROUP ); } else { // Add to the flash group aps_AddGroup( SAMPLEAPP_ENDPOINT, &SampleApp_Group );