本文整理汇总了C++中HalLcdWriteString函数的典型用法代码示例。如果您正苦于以下问题:C++ HalLcdWriteString函数的具体用法?C++ HalLcdWriteString怎么用?C++ HalLcdWriteString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HalLcdWriteString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HalLcdDisplayPercentBar
/**************************************************************************************************
z-stack代码,未修改
**************************************************************************************************/
void HalLcdDisplayPercentBar( char *title, uint8 value )
{
#if (HAL_LCD == TRUE)
uint8 percent;
uint8 leftOver;
uint8 buf[17];
uint32 err;
uint8 x;
/* Write the title: */
HalLcdWriteString( title, HAL_LCD_LINE_1 );
if ( value > 100 )
value = 100;
/* convert to blocks */
percent = (uint8)(value / 10);
leftOver = (uint8)(value % 10);
/* Make window */
osal_memcpy( buf, "[ ] ", 15 );
for ( x = 0; x < percent; x ++ )
{
buf[1+x] = '>';
}
if ( leftOver >= 5 )
buf[1+x] = '+';
err = (uint32)value;
_ltoa( err, (uint8*)&buf[13], 10 );
HalLcdWriteString( (char*)buf, HAL_LCD_LINE_2 );
#endif
}
示例2: peripheralStateNotificationCB
/*********************************************************************
* @fn peripheralStateNotificationCB
*
* @brief Notification from the profile of a state change.
*
* @param newState - new state
*
* @return none
*/
static void peripheralStateNotificationCB( gaprole_States_t newState )
{
switch ( newState )
{
case GAPROLE_STARTED:
{
uint8 ownAddress[B_ADDR_LEN];
GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
// Display device address
HalLcdWriteString( bdAddr2Str( ownAddress ), HAL_LCD_LINE_2 );
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
break;
case GAPROLE_ADVERTISING:
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
break;
case GAPROLE_WAITING:
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
break;
case GAPROLE_ERROR:
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
break;
default:
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
break;
}
}
示例3: pulseAfMsgRx
/**************************************************************************************************
* @fn pulseAfMsgRx
*
* @brief This function is called by pulseSysEvtMsg() to process an incoming AF message.
*
* input parameters
*
* @param msg - A pointer to the afIncomingMSGPacket_t packet.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
static void pulseAfMsgRx(afIncomingMSGPacket_t *msg)
{
uint8 *buf = msg->cmd.Data;
if(PanEstablishedwithRouter == FALSE & devState == DEV_ZB_COORD){
if(zap_set_logicalType(ZG_DEVICETYPE_ROUTER)){
HalLcdWriteString("Should be Router",HAL_LCD_LINE_7);
}
PanEstablishedwithRouter = TRUE;
if (ZSuccess != osal_start_timerEx(pulseTaskId, PULSE_EVT_ANN, PULSE_DLY_ANN))
{
(void)osal_set_event(pulseTaskId, PULSE_EVT_ANN);
}
}
else{
switch (buf[PULSE_CMD_IDX])
{
case PULSE_CMD_DAT: //Nodes will send this by default
pulseDataRx(msg);
break;
case PULSE_CMD_BEG:
if (INVALID_NODE_ADDR == pulseAddr)
{
NLME_SetPollRate(0);
if(PulseEvtDat_sync == FALSE){
(void)osal_set_event(pulseTaskId, PULSE_EVT_DAT); //Sync Pulsedat event operation
}
}
pulseAddr = msg->srcAddr.addr.shortAddr; // BUILD_UINT16(buf[PULSE_ADR_LSB], buf[PULSE_ADR_MSB]);
break;
case PULSE_CMD_END:
NLME_SetPollRate(POLL_RATE);
pulseAddr = INVALID_NODE_ADDR;
break;
case PULSE_CMD_DAT_TEST: //This is used for testing different payload sizes. Not used in normal operation
pulseTestingDataRx(msg);
break;
default:
break;
}
} //end else
}
示例4: zclSampleSw_Init
/*********************************************************************
* @fn zclSampleSw_Init
*
* @brief Initialization function for the zclGeneral layer.
*
* @param none
*
* @return none
*/
void zclSampleSw_Init( byte task_id )
{
zclSampleSw_TaskID = task_id;
#ifdef ZCL_ON_OFF
// Set destination address to indirect
zclSampleSw_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleSw_DstAddr.endPoint = 0;
zclSampleSw_DstAddr.addr.shortAddr = 0;
#endif
// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleSw_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLESW_ENDPOINT, &zclSampleSw_CmdCallbacks );
// Register the application's attribute list
zcl_registerAttrList( SAMPLESW_ENDPOINT, SAMPLESW_MAX_ATTRIBUTES, zclSampleSw_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleSw_TaskID );
#ifdef ZCL_EZMODE
// Register EZ-Mode
zcl_RegisterEZMode( &zclSampleSw_RegisterEZModeData );
// Register with the ZDO to receive Match Descriptor Responses
ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp);
#endif
// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleSw_TaskID );
// Register for a test endpoint
afRegister( &sampleSw_TestEp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( zclSampleSw_TaskID, Match_Desc_rsp );
#ifdef LCD_SUPPORTED
HalLcdWriteString ( (char *)sDeviceName, HAL_LCD_LINE_3 );
#endif
#if defined (OTA_CLIENT) && (OTA_CLIENT == TRUE)
// Register for callback events from the ZCL OTA
zclOTA_Register(zclSampleSw_TaskID);
#endif
}
示例5: dBCommand_Service
// << Wayne >> << dBCmd Service >> ++
void dBCommand_Service(uint8 *pCmd)
{
if(osal_memcmp( pCmd, DBCMD_COMFIRM_TICKET, DBCMD_COMFIRM_TICKET_LEN))
{
repeatCmdSendData("s,et,01,cfm,0005,e",18);
// << Wayne >> << Exchanging Take >> ++
dbExchangeCounter++;
// << Wayne >> << Exchanging Take >> --
UART_SEND_STRING(pCmd,19);
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
HalLcdWriteString( "Confirm", HAL_LCD_LINE_6 );
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
}
else if(osal_memcmp( pCmd, DBCMD_READ_EXCHANGE_NUMBER, DBCMD_READ_EXCHANGE_NUMBER_LEN))
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
HalLcdWriteString( "ReadCounter", HAL_LCD_LINE_6 );
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
num2Str_Max4L( &pCmd[12], dbExchangeCounter, 4);
UART_SEND_DEBUG_MSG( pCmd, 18 );
repeatCmdSendData(pCmd,18);
}
}
示例6: HalLcdWriteStringValue
/**************************************************************************************************
* @fn HalLcdWriteStringValue
*
* @brief Write a string followed by a value to the LCD
*
* @param title - Title that will be displayed before the value
* value - value
* format - redix
* line - line number
*
* @return None
**************************************************************************************************/
void HalLcdWriteStringValue( char *title, uint16 value, uint8 format, uint8 line )
{
#if (HAL_LCD == TRUE)
uint8 tmpLen;
uint8 buf[LCD_MAX_BUF];
uint32 err;
tmpLen = (uint8)osal_strlen( (char*)title );
osal_memcpy( buf, title, tmpLen );
buf[tmpLen] = ' ';
err = (uint32)(value);
_ltoa( err, &buf[tmpLen+1], format );
HalLcdWriteString( (char*)buf, line );
#endif
}
示例7: zb_StartConfirm
/******************************************************************************
* @fn zb_StartConfirm
*
* @brief The zb_StartConfirm callback is called by the ZigBee stack
* after a start request operation completes
*
* @param status - The status of the start operation. Status of
* ZB_SUCCESS indicates the start operation completed
* successfully. Else the status is an error code.
*
* @return none
*/
void zb_StartConfirm( uint8 status )
{
// If the device sucessfully started, change state to running
if ( status == ZB_SUCCESS )
{
// Change application state
appState = APP_START;
// Set LED 1 to indicate that node is operational on the network
HalLedSet( HAL_LED_1, HAL_LED_MODE_ON );
// Update the display
#if defined ( LCD_SUPPORTED )
HalLcdWriteString( "SensorDemo", HAL_LCD_LINE_1 );
HalLcdWriteString( "Sensor", HAL_LCD_LINE_2 );
#endif
// Store parent short address
zb_GetDeviceInfo(ZB_INFO_PARENT_SHORT_ADDR, &parentShortAddr);
// Set event to bind to a collector
osal_set_event( sapi_TaskID, MY_FIND_COLLECTOR_EVT );
}
}
示例8: ipd_PublishPriceCB
/*********************************************************************
* @fn ipd_PublishPriceCB
*
* @brief Callback from the ZCL SE Profile Pricing Cluster Library when
* it received a Publish Price for this application.
*
* @param pCmd - pointer to structure for Publish Price command
* @param srcAddr - source address
* @param seqNum - sequence number for this command
*
* @return none
*/
static void ipd_PublishPriceCB( zclCCPublishPrice_t *pCmd,
afAddrType_t *srcAddr, uint8 seqNum )
{
if ( pCmd )
{
// display Provider ID field
HalLcdWriteString("Provider ID", HAL_LCD_LINE_1);
HalLcdWriteValue( pCmd->providerId, 10, HAL_LCD_LINE_2 );
}
#if defined ( INTER_PAN )
ZMacSetReq( ZMacRxOnIdle, &rxOnIdle ); // set receiver on when idle flag to false
// after getting publish price command via INTER-PAN
#endif
}
示例9: zclSampleSw_LcdDisplayMainMode
/*********************************************************************
* @fn zclSampleSw_LcdDisplayMainMode
*
* @brief Called to display the main screen on the LCD.
*
* @param none
*
* @return none
*/
void zclSampleSw_LcdDisplayMainMode(void)
{
if ( zclSampleSw_NwkState == DEV_ZB_COORD )
{
zclHA_LcdStatusLine1(0);
}
else if ( zclSampleSw_NwkState == DEV_ROUTER )
{
zclHA_LcdStatusLine1(1);
}
else if ( zclSampleSw_NwkState == DEV_END_DEVICE )
{
zclHA_LcdStatusLine1(2);
}
#ifdef LCD_SUPPORTED
if ( ( zclSampleSw_NwkState == DEV_ZB_COORD ) ||
( zclSampleSw_NwkState == DEV_ROUTER ) )
{
// display help key with permit join status
if ( gPermitDuration )
{
HalLcdWriteString("SW5: Help *", HAL_LCD_LINE_3);
}
else
{
HalLcdWriteString("SW5: Help ", HAL_LCD_LINE_3);
}
}
else
{
// display help key
HalLcdWriteString((char *)sSwHelp, HAL_LCD_LINE_3);
}
#endif
}
示例10: SerialApp_Init
/*********************************************************************
* @fn SerialApp_Init
*
* @brief This is called during OSAL tasks' initialization.
*
* @param task_id - the Task ID assigned by OSAL.
*
* @return none
*/
void SerialApp_Init( uint8 task_id )
{
halUARTCfg_t uartConfig;
SerialApp_MsgID = 0x00;
SerialApp_SeqRx = 0xC3;
SerialApp_TaskID = task_id;
SerialApp_DstAddr.endPoint = 0;
SerialApp_DstAddr.addr.shortAddr = 0;
SerialApp_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
SerialApp_RspDstAddr.endPoint = 0;
SerialApp_RspDstAddr.addr.shortAddr = 0;
SerialApp_RspDstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
afRegister( (endPointDesc_t *)&SerialApp_epDesc );
RegisterForKeys( task_id );
uartConfig.configured = TRUE; // 2430 don't care.
uartConfig.baudRate = SERIAL_APP_BAUD;
uartConfig.flowControl = TRUE;
uartConfig.flowControlThreshold = SERIAL_APP_THRESH;
uartConfig.rx.maxBufSize = SERIAL_APP_RX_MAX;
uartConfig.tx.maxBufSize = SERIAL_APP_TX_MAX;
uartConfig.idleTimeout = SERIAL_APP_IDLE; // 2430 don't care.
uartConfig.intEnable = TRUE; // 2430 don't care.
#if SERIAL_APP_LOOPBACK
uartConfig.callBackFunc = rxCB_Loopback;
#else
uartConfig.callBackFunc = rxCB;
#endif
HalUARTOpen (SERIAL_APP_PORT, &uartConfig);
#if defined ( LCD_SUPPORTED )
HalLcdWriteString( "SerialApp2", HAL_LCD_LINE_2 );
#endif
HalLedSet(HAL_LED_1,HAL_LED_MODE_OFF);
HalLedSet(HAL_LED_2,HAL_LED_MODE_OFF);
HalLedSet(HAL_LED_3,HAL_LED_MODE_OFF);
ZDO_RegisterForZDOMsg( SerialApp_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( SerialApp_TaskID, Match_Desc_rsp );
osal_start_timerEx(SerialApp_TaskID,SERIALAPP_MSG_AUTOMATCH,2000);
}
示例11: GenericApp_Init
/*********************************************************************
* @fn GenericApp_Init
*
* @brief Initialization function for the Generic App Task.
* This is called during initialization and should contain
* any application specific initialization (ie. hardware
* initialization/setup, table initialization, power up
* notificaiton ... ).
*
* @param task_id - the ID assigned by OSAL. This ID should be
* used to send messages and set timers.
*
* @return none
*/
void GenericApp_Init( byte task_id )
{
GenericApp_TaskID = task_id;
GenericApp_NwkState = DEV_INIT;
GenericApp_TransID = 0;
// Device hardware initialization can be added here or in main() (Zmain.c).
// If the hardware is application specific - add it here.
// If the hardware is other parts of the device add it in main().
GenericApp_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
GenericApp_DstAddr.endPoint = 0;
GenericApp_DstAddr.addr.shortAddr = 0;
// Fill out the endpoint description.
GenericApp_epDesc.endPoint = GENERICAPP_ENDPOINT;
GenericApp_epDesc.task_id = &GenericApp_TaskID;
GenericApp_epDesc.simpleDesc
= (SimpleDescriptionFormat_t *)&GenericApp_SimpleDesc;
GenericApp_epDesc.latencyReq = noLatencyReqs;
// Register the endpoint description with the AF
afRegister( &GenericApp_epDesc );
// Register for all key events - This app will handle all key events
RegisterForKeys( GenericApp_TaskID );
// Update the display
#if defined ( LCD_SUPPORTED )
HalLcdWriteString( "GenericApp", HAL_LCD_LINE_1 );
#endif
ZDO_RegisterForZDOMsg( GenericApp_TaskID, End_Device_Bind_rsp );
ZDO_RegisterForZDOMsg( GenericApp_TaskID, Match_Desc_rsp );
ZDO_RegisterForZDOMsg( GenericApp_TaskID, SPI_INCOMING_ZAPP_DATA );
/*****for SHP *************begin******************/{
//extern void shp_example_init_called_by_system(void);
//shp_example_init_called_by_system();
/*****for SHP *************end********************/}
//QBing
MT_UartRegisterTaskID(GenericApp_TaskID);
MT_UartZAppBufferLengthRegister(100);
osal_start_timerEx(GenericApp_TaskID,GENERICAPP_TIMER_EVT,1000);
}
示例12: ipd_DisplayMessageCB
/*********************************************************************
* @fn ipd_DisplayMessageCB
*
* @brief Callback from the ZCL SE Profile Message Cluster Library when
* it received a Display Message Command for
* this application.
*
* @param pCmd - pointer to structure for Display Message command
* @param srcAddr - source address
* @param seqNum - sequence number for this command
*
* @return none
*/
static void ipd_DisplayMessageCB( zclCCDisplayMessage_t *pCmd,
afAddrType_t *srcAddr, uint8 seqNum )
{
// Upon receipt of the Display Message Command, the device shall
// display the message. If the Message Confirmation bit indicates
// the message originator require a confirmation of receipt from
// a Utility Customer, the device should display the message or
// alert the user until it is either confirmed via a button or by
// selecting a confirmation option on the device. Confirmation is
// typically used when the Utility is sending down information
// such as a disconnection notice, or prepaid billing information.
// Message duration is ignored when confirmation is requested and
// the message is displayed until confirmed.
#if defined ( LCD_SUPPORTED )
HalLcdWriteString( (char*)pCmd->msgString.pStr, HAL_LCD_LINE_3 );
#endif // LCD_SUPPORTED
}
示例13: simpleBLEPeripheral_HandleKeys
static void simpleBLEPeripheral_HandleKeys(uint8 shift, uint8 keys) {
if (keys & HAL_KEY_UP) {
u_state = IR_DATA_STUDY_CMD_START_BEGIN_STATE;
SbpHalUARTWrite(&SBP_UART_STUDY_CMD, SBP_UART_STUDY_CMD_LEN);
}
if (keys & HAL_KEY_LEFT) {
}
if (keys & HAL_KEY_DOWN) {
HalLcdWriteString("send after 3s...", HAL_LCD_LINE_4);
osal_start_timerEx(simpleBLEPeripheral_TaskID, SBP_SEND_IRDATA_EVT, 3000);
}
if (keys & HAL_KEY_RIGHT) {
HalLcdWriteStringValue("data_len:", data_len, 10, HAL_LCD_LINE_2);
}
}
示例14: sendUartMessage
/**
* @brief Envía un mensaje por UART según el protocolo implementado. Este se
* crea a partir de un mensaje y otros datos (genéricos) pasados como
* argumento. Para el mensaje de tipo REPORT, los otros datos
* corresponden a los flags de alarmas, y son añadidos al mensaje antes
* de los parámetros eléctricos.
* Los mensajes tienen el siguiente formato:
* HEADER DATA
* SOF | DATA LENGTH | COMMAND | SENSOR MAC | DATA[DATA LENGTH]
* Donde SOF=0xFE es el delimitador del inicio del frame; DATA LENGTH
* es la cantidad de bytes de datos envíados luego del HEADER; COMMAND
* es el comando enviado a la PC (REPORT, etc.); SENSOR MAC es la
* dirección MAC de 64 bytes del nodo al cual se refiere la información;
* y DATA corresponde a los datos enviados en formato Little Endian.
*
* @param msg Mensaje que se desea retransmitir por UART.
* @param other Otros datos para añadir al mensaje.
*/
static void sendUartMessage(struct message_t *msg, void *other)
{
uint8 pFrame[UART_FRAME_MAX_LENGTH];
// start of frame
pFrame[UART_FRAME_SOF_OFFSET] = CPT_SOP;
// tipo de mensaje
pFrame[UART_FRAME_CMD_OFFSET] = msg->msgType;
// MAC
memcpy(&(pFrame[UART_FRAME_MAC_OFFSET]), &(msg->mac), sizeof(msg->mac));
if (msg->msgType == MSG_TYPE_REPORT)
{
// length
pFrame[UART_FRAME_LENGTH_OFFSET] = UART_FRAME_REPORT_LENGTH;
// secuencia
pFrame[UART_FRAME_DATA_OFFSET] = LO_UINT16(msg->sequence);
pFrame[UART_FRAME_DATA_OFFSET+1] = HI_UINT16(msg->sequence);
// flags alarmas
uint16 flags = *((uint16*)other);
pFrame[UART_FRAME_DATA_OFFSET+2] = LO_UINT16(flags);
pFrame[UART_FRAME_DATA_OFFSET+3] = HI_UINT16(flags);
// parámetros eléctricos
memcpy(&(pFrame[UART_FRAME_DATA_OFFSET+4]), &(msg->data), msg->lenData);
}
else
{
// otros tipos de mensaje
pFrame[UART_FRAME_LENGTH_OFFSET] = 0;
}
// escribe mensaje en UART
uint16 b = HalUARTWrite(HAL_UART_PORT_0, pFrame,
UART_FRAME_HEADER_LENGTH+pFrame[UART_FRAME_LENGTH_OFFSET]);
if (b > 0)
HalLcdWriteStringValue("UART", b, 10, 3);
else
HalLcdWriteString("", HAL_LCD_LINE_3);
}
示例15: zclSampleTemperatureSensor_Init
/*********************************************************************
* @fn zclSampleTemperatureSensor_Init
*
* @brief Initialization function for the zclGeneral layer.
*
* @param none
*
* @return none
*/
void zclSampleTemperatureSensor_Init( byte task_id )
{
zclSampleTemperatureSensor_TaskID = task_id;
// Set destination address to indirect
zclSampleTemperatureSensor_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;
zclSampleTemperatureSensor_DstAddr.endPoint = 0;
zclSampleTemperatureSensor_DstAddr.addr.shortAddr = 0;
// This app is part of the Home Automation Profile
zclHA_Init( &zclSampleTemperatureSensor_SimpleDesc );
// Register the ZCL General Cluster Library callback functions
zclGeneral_RegisterCmdCallbacks( SAMPLETEMPERATURESENSOR_ENDPOINT, &zclSampleTemperatureSensor_CmdCallbacks );
// Register the application's attribute list
zcl_registerAttrList( SAMPLETEMPERATURESENSOR_ENDPOINT, SAMPLETEMPERATURESENSOR_MAX_ATTRIBUTES, zclSampleTemperatureSensor_Attrs );
// Register the Application to receive the unprocessed Foundation command/response messages
zcl_registerForMsg( zclSampleTemperatureSensor_TaskID );
#ifdef ZCL_EZMODE
// Register EZ-Mode
zcl_RegisterEZMode( &zclSampleTemperatureSensor_RegisterEZModeData );
// Register with the ZDO to receive Match Descriptor Responses
ZDO_RegisterForZDOMsg(task_id, Match_Desc_rsp);
#endif
// Register for all key events - This app will handle all key events
RegisterForKeys( zclSampleTemperatureSensor_TaskID );
// Register for a test endpoint
afRegister( &sampleTemperatureSensor_TestEp );
#ifdef LCD_SUPPORTED
// display the device name
HalLcdWriteString( (char *)sDeviceName, HAL_LCD_LINE_3 );
#endif
}