本文整理汇总了C++中HalLedSet函数的典型用法代码示例。如果您正苦于以下问题:C++ HalLedSet函数的具体用法?C++ HalLedSet怎么用?C++ HalLedSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HalLedSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zb_HandleOsalEvent
/**
* @brief Esta función es llamada por el SO cuando se debe atender un
* evento de la tarea.
* @param event Mascara de bits conteniendo los eventos a atender
*/
void zb_HandleOsalEvent(uint16 event)
{
uint8 logicalType;
if (event & SYS_EVENT_MSG)
{
}
if (event & ZB_ENTRY_EVENT)
{
// inicializa UART
initUart(uartRxCB);
// blick LED 1 para indicar que se está uniendo a la red
HalLedBlink(HAL_LED_1, 0, 50, 500 );
HalLedSet(HAL_LED_2, HAL_LED_MODE_OFF);
// lee tipo de logical device desde la memoria NV
zb_ReadConfiguration(ZCD_NV_LOGICAL_TYPE, sizeof(uint8), &logicalType);
// inicia la red
zb_StartRequest();
}
if (event & MY_START_EVT)
{
// inicia la red
zb_StartRequest();
}
if (event & SEND_UART_MSG)
{
// envia mensaje por UART a la PC
//HalLcdWriteString("UART_EVT", HAL_LCD_LINE_1);
sendUartMessage(&msgReport, &alarmFlags);
}
if (event & MY_TEST_EVT)
{
// crea mensaje de prueba
msgReport.msgType = MSG_TYPE_REPORT;
msgReport.sequence++;
msgReport.lenData = MSG_LEN_DATA_REPORT;
for (uint8 i = 0; i < 8; i++)
msgReport.mac[i] = i;
// datos de prueba
static double d[10] = {220.5, 0.354, 85.12, 88.33, 85.06, 0.98, 1.23, 3.25, 0.97, 4.55};
for (int i = 0; i < 10; i++)
memcpy(&(msgReport.data[i*4]), &(d[i]), sizeof(double));
// flags de prueba
uint16 flags = 0;
// imprime info en LCD
HalLcdWriteString("TEST_EVT", HAL_LCD_LINE_1);
HalLcdWriteStringValue("#", msgReport.sequence, 10, HAL_LCD_LINE_2);
// envia mensaje por UART
sendUartMessage(&msgReport, &flags);
// crea evento nuevamente
osal_start_timerEx(sapi_TaskID, MY_TEST_EVT, 5000);
}
}
示例2: zclSampleTemperatureSensor_ProcessIdentifyTimeChange
/*********************************************************************
* @fn zclSampleTemperatureSensor_ProcessIdentifyTimeChange
*
* @brief Called to process any change to the IdentifyTime attribute.
*
* @param none
*
* @return none
*/
static void zclSampleTemperatureSensor_ProcessIdentifyTimeChange( void )
{
if ( zclSampleTemperatureSensor_IdentifyTime > 0 )
{
osal_start_timerEx( zclSampleTemperatureSensor_TaskID, SAMPLETEMPERATURESENSOR_IDENTIFY_TIMEOUT_EVT, 1000 );
HalLedBlink ( HAL_LED_4, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
}
else
{
if ( zclSampleTemperatureSensor_OnOff )
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_ON );
}
else
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
}
osal_stop_timerEx( zclSampleTemperatureSensor_TaskID, SAMPLETEMPERATURESENSOR_IDENTIFY_TIMEOUT_EVT );
}
}
示例3: zclSampleTemperatureSensor_LcdDisplayUpdate
/*********************************************************************
* @fn zclSampleTemperatureSensor_LcdDisplayUpdate
*
* @brief Called to update the LCD display.
*
* @param none
*
* @return none
*/
void zclSampleTemperatureSensor_LcdDisplayUpdate( void )
{
// turn on red LED for temperatures >= 24.00C
if ( zclSampleTemperatureSensor_MeasuredValue >= 2400 )
{
HalLedSet ( HAL_LED_1, HAL_LED_MODE_OFF );
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON );
}
// turn on green LED for temperatures <= 20.00C
else if ( zclSampleTemperatureSensor_MeasuredValue <= 2000 )
{
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON );
HalLedSet ( HAL_LED_2, HAL_LED_MODE_OFF );
}
// turn on both red and green LEDs for temperatures between 20.00C and 24.00C
else
{
HalLedSet ( HAL_LED_1, HAL_LED_MODE_ON );
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON );
}
if ( giTemperatureSensorScreenMode == TEMPSENSE_HELPMODE )
{
zclSampleTemperatureSensor_LcdDisplayHelpMode();
}
else
{
zclSampleTemperatureSensor_LcdDisplayMainMode();
}
}
示例4: zclSampleSw_ProcessZDOMsgs
/*********************************************************************
* @fn zclSampleSw_ProcessZDOMsgs()
*
* @brief Process response messages
*
* @param none
*
* @return none
*/
void zclSampleSw_ProcessZDOMsgs( zdoIncomingMsg_t *inMsg )
{
switch ( inMsg->clusterID )
{
case End_Device_Bind_rsp:
if ( ZDO_ParseBindRsp( inMsg ) == ZSuccess )
{
// Light LED
HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
}
#if defined(BLINK_LEDS)
else
{
// Flash LED to show failure
HalLedSet ( HAL_LED_4, HAL_LED_MODE_FLASH );
}
#endif
break;
case Match_Desc_rsp:
{
ZDO_ActiveEndpointRsp_t *pRsp = ZDO_ParseEPListRsp( inMsg );
if ( pRsp )
{
if ( pRsp->status == ZSuccess && pRsp->cnt )
{
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
zclSampleSw_DstAddr.addr.shortAddr = pRsp->nwkAddr;
// Take the first endpoint, Can be changed to search through endpoints
zclSampleSw_DstAddr.endPoint = pRsp->epList[0];
// Light LED
HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
}
osal_mem_free( pRsp );
}
}
break;
}
}
示例5: SimpleBLECentral_Init
/*********************************************************************
* @fn SimpleBLECentral_Init
*
* @brief Initialization function for the Simple BLE Central App Task.
* This is called during initialization and should contain
* any application specific initialization (ie. hardware
* initialization/setup, table initialization, power up
* notification).
*
* @param task_id - the ID assigned by OSAL. This ID should be
* used to send messages and set timers.
*
* @return none
*/
void SimpleBLECentral_Init( uint8 task_id )
{
simpleBLETaskId = task_id;
// 串口初始化
NPI_InitTransport(uart_NpiSerialCallback);
//NPI_WriteTransport("SimpleBLECentral_Init\r\n", 23);
// Setup Central Profile
{
uint8 scanRes = DEFAULT_MAX_SCAN_RES;
GAPCentralRole_SetParameter ( GAPCENTRALROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
}
// Setup GAP
GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (uint8 *) simpleBLEDeviceName );
// Setup the GAP Bond Manager
{
uint32 passkey = DEFAULT_PASSCODE;
uint8 pairMode = DEFAULT_PAIRING_MODE;
uint8 mitm = DEFAULT_MITM_MODE;
uint8 ioCap = DEFAULT_IO_CAPABILITIES;
uint8 bonding = DEFAULT_BONDING_MODE;
GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof( uint32 ), &passkey );
GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof( uint8 ), &pairMode );
GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof( uint8 ), &mitm );
GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof( uint8 ), &ioCap );
GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof( uint8 ), &bonding );
}
// Initialize GATT Client
VOID GATT_InitClient();
// Register to receive incoming ATT Indications/Notifications
GATT_RegisterForInd( simpleBLETaskId );
// Initialize GATT attributes
GGS_AddService( GATT_ALL_SERVICES ); // GAP
GATTServApp_AddService( GATT_ALL_SERVICES ); // GATT attributes
// Register for all key events - This app will handle all key events
RegisterForKeys( simpleBLETaskId );
// makes sure LEDs are off
HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
// Setup a delayed profile startup
osal_set_event( simpleBLETaskId, START_DEVICE_EVT );
}
示例6: SampleApp_MessageMSGCB
/*********************************************************************
* @fn SampleApp_MessageMSGCB
*
* @brief Data message processor callback. This function processes
* any incoming data - probably from other devices. So, based
* on cluster ID, perform the intended action.
*
* @param none
*
* @return none
*/
void SampleApp_MessageMSGCB( afIncomingMSGPacket_t *pkt ) //接收數據
{
// uint16 flashTime;
switch ( pkt->clusterId )
{
case SAMPLEAPP_P2P_CLUSTERID:
osal_memcpy(periodicData, pkt->cmd.Data, 27);
LedState=LedState+1;
if(LedState == 1)
HalLedSet(HAL_LED_3, HAL_LED_MODE_ON);
else if(LedState == 2)
{HalLedSet(HAL_LED_3, HAL_LED_MODE_OFF);
LedState=0;}
break;
case SAMPLEAPP_PERIODIC_CLUSTERID:
// osal_memset(periodicData, 0 , 15);
osal_memcpy(periodicData, pkt->cmd.Data, 27);
LedState=LedState+1;
// HalUARTWrite(0, "Rx:", 3); //提示信息
// HalUARTWrite(0, pkt->cmd.Data, pkt->cmd.DataLength); //輸出接收到的數據
// HalUARTWrite(0, "\n", 1); //迴車換行
if(LedState == 1)
HalLedSet(HAL_LED_3, HAL_LED_MODE_ON);
else if(LedState == 2)
{HalLedSet(HAL_LED_3, HAL_LED_MODE_OFF);
LedState=0;}
break;
case SAMPLEAPP_FLASH_CLUSTERID: //此實驗沒有使用,到後面實驗詳解
// flashTime = BUILD_UINT16(pkt->cmd.Data[1], pkt->cmd.Data[2] );
HalLedBlink( HAL_LED_3, 2, 25 ,100 );
break;
}
}
示例7: rangeext_ProcessIdentifyTimeChange
/*********************************************************************
* @fn rangeext_ProcessIdentifyTimeChange
*
* @brief Called to blink led for specified IdentifyTime attribute value
*
* @param none
*
* @return none
*/
static void rangeext_ProcessIdentifyTimeChange( void )
{
if ( rangeExtIdentifyTime > 0 )
{
osal_start_timerEx( rangeExtTaskID, RANGEEXT_IDENTIFY_TIMEOUT_EVT, 1000 );
HalLedBlink ( HAL_LED_4, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
}
else
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
osal_stop_timerEx( rangeExtTaskID, RANGEEXT_IDENTIFY_TIMEOUT_EVT );
}
}
示例8: zclSampleLight_ProcessIdentifyTimeChange
/*********************************************************************
* @fn zclSampleLight_ProcessIdentifyTimeChange
*
* @brief Called to process any change to the IdentifyTime attribute.
*
* @param none
*
* @return none
*/
static void zclSampleLight_ProcessIdentifyTimeChange( void )
{
if ( zclSampleLight_IdentifyTime > 0 )
{
osal_start_timerEx( zclSampleLight_TaskID, SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT, 1000 );
HalLedBlink ( HAL_LED_1, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
}
else
{
if ( zclSampleLight_OnOff )
{
HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON );
}
else
{
HalLedSet ( HAL_LED_2, HAL_LED_MODE_OFF );
osal_stop_timerEx( zclSampleLight_TaskID, SAMPLELIGHT_IDENTIFY_TIMEOUT_EVT );
}
}
}
示例9: loadcontrol_ProcessIdentifyTimeChange
/*********************************************************************
* @fn loadcontrol_ProcessIdentifyTimeChange
*
* @brief Called to blink led for specified IdentifyTime attribute value
*
* @param none
*
* @return none
*/
static void loadcontrol_ProcessIdentifyTimeChange( void )
{
if ( loadControlIdentifyTime > 0 )
{
osal_start_timerEx( loadControlTaskID, LOADCONTROL_IDENTIFY_TIMEOUT_EVT, 1000 );
HalLedBlink ( HAL_LED_4, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
}
else
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
osal_stop_timerEx( loadControlTaskID, LOADCONTROL_IDENTIFY_TIMEOUT_EVT );
}
}
示例10: keyfobapp_StopAlert
/*********************************************************************
* @fn keyfobapp_StopAlert
*
* @brief Stops an alert
*
* @param none
*
* @return none
*/
void keyfobapp_StopAlert( void )
{
keyfobAlertState = ALERT_STATE_OFF;
buzzerStop();
buzzer_state = BUZZER_OFF;
HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
#if defined ( POWER_SAVING )
osal_pwrmgr_device( PWRMGR_BATTERY );
#endif
}
示例11: MT_UtilLedControl
/***************************************************************************************************
* @fn MT_UtilLedControl
*
* @brief Process the LED Control Message
*
* @param pBuf - pointer to the received data
*
* @return None
***************************************************************************************************/
void MT_UtilLedControl(uint8 *pBuf)
{
uint8 iLed, Led, iMode, Mode, cmdId;
uint8 retValue = ZFailure;
/* parse header */
cmdId = pBuf[MT_RPC_POS_CMD1];
pBuf += MT_RPC_FRAME_HDR_SZ;
/* LED and Mode */
iLed = *pBuf++;
iMode = *pBuf;
if ( iLed == 1 )
Led = HAL_LED_1;
else if ( iLed == 2 )
Led = HAL_LED_2;
else if ( iLed == 3 )
Led = HAL_LED_3;
else if ( iLed == 4 )
Led = HAL_LED_4;
else if ( iLed == 0xFF )
Led = HAL_LED_ALL;
else
Led = 0;
if ( iMode == 0 )
Mode = HAL_LED_MODE_OFF;
else if ( iMode == 1 )
Mode = HAL_LED_MODE_ON;
else if ( iMode == 2 )
Mode = HAL_LED_MODE_BLINK;
else if ( iMode == 3 )
Mode = HAL_LED_MODE_FLASH;
else if ( iMode == 4 )
Mode = HAL_LED_MODE_TOGGLE;
else
Led = 0;
if ( Led != 0 )
{
HalLedSet (Led, Mode);
retValue = ZSuccess;
}
/* Build and send back the response */
MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_UTIL), cmdId, 1, &retValue );
}
示例12: zclSampleLight_OnOffCB
/*********************************************************************
* @fn zclSampleLight_OnOffCB
*
* @brief Callback from the ZCL General Cluster Library when
* it received an On/Off Command for this application.
*
* @param cmd - COMMAND_ON, COMMAND_OFF or COMMAND_TOGGLE
*
* @return none
*/
static void zclSampleLight_OnOffCB( uint8 cmd )
{
if ( cmd == COMMAND_ON )// Turn on the light
zclSampleLight_OnOff = LIGHT_ON;
else if ( cmd == COMMAND_OFF )// Turn off the light
zclSampleLight_OnOff = LIGHT_OFF;
else // Toggle the light
{
if ( zclSampleLight_OnOff == LIGHT_OFF )
zclSampleLight_OnOff = LIGHT_ON;
else
zclSampleLight_OnOff = LIGHT_OFF;
}
// In this sample app, we use LED4 to simulate the Light
if ( zclSampleLight_OnOff == LIGHT_ON )
{
HalLedSet( HAL_LED_2, HAL_LED_MODE_ON ); // setting the LED_1 on
}
else
HalLedSet( HAL_LED_2, HAL_LED_MODE_OFF ); // setting the LED_1 off
}
示例13: HalLedInit
/***************************************************************************************************
* @fn HalLedInit
*
* @brief Initialize LED Service
*
* @param init - pointer to void that contains the initialized value
*
* @return None
***************************************************************************************************/
void HalLedInit (void)
{
#if (HAL_LED == TRUE)
HAL_TURN_OFF_LED1();
LED1_DDR |= LED1_BV;
HAL_TURN_OFF_LED2();
LED2_DDR |= LED2_BV;
/* Initialize all LEDs to OFF */
HalLedSet (HAL_LED_ALL, HAL_LED_MODE_OFF);
#endif /* HAL_LED */
#ifdef BLINK_LEDS
/* Initialize sleepActive to FALSE */
HalLedStatusControl.sleepActive = FALSE;
#endif
}
示例14: zllSampleBridge_ProcessIdentifyTimeChange
/*********************************************************************
* @fn zllSampleBridge_ProcessIdentifyTimeChange
*
* @brief Called to process any change to the IdentifyTime attribute.
*
* @param none
*
* @return none
*/
static void zllSampleBridge_ProcessIdentifyTimeChange( void )
{
if ( zllSampleBridge_IdentifyTime > 0 )
{
osal_start_timerEx( zllSampleBridge_TaskID, SAMPLEBRIDGE_IDENTIFY_TIMEOUT_EVT, 1000 );
#if ( HAL_LED == TRUE )
HalLedBlink ( HAL_LED_4, 0xFF, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
#endif
}
else
{
#if ( HAL_LED == TRUE )
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );
#endif
osal_stop_timerEx( zllSampleBridge_TaskID, SAMPLEBRIDGE_IDENTIFY_TIMEOUT_EVT );
}
}
示例15: InitBoard
/*********************************************************************
* @fn InitBoard()
* @brief Initialize the CC2540DB Board Peripherals
* @param level: COLD,WARM,READY
* @return None
*/
void InitBoard( uint8 level )
{
if ( level == OB_COLD )
{
// Interrupts off
osal_int_disable( INTS_ALL );
// Turn all LEDs off
HalLedSet( HAL_LED_ALL, HAL_LED_MODE_OFF );
// Check for Brown-Out reset
// ChkReset();
}
else // !OB_COLD
{
/* Initialize Key stuff */
OnboardKeyIntEnable = HAL_KEY_INTERRUPT_ENABLE;
HalKeyConfig( OnboardKeyIntEnable, OnBoard_KeyCallback);
}
}