SimpleBLEPeripheral_taskFxn()中调用的Power_shutdown()
if (events & SBP_PERIODIC_EVT)
{
events &= ~SBP_PERIODIC_EVT;
// Perform periodic application task
// SimpleBLEPeripheral_performPeriodicTask();
Util_stopClock(&periodicClock);
Power_shutdown(NULL);
}
Yue TANG:
协议栈自带power management. 不需要主动调用电源管理相关的API. 基于RTOS, 是否睡眠需要和其他任务协同。
xiaxiaofei:
回复 Yue TANG:
你好,我想通过调用进入Power_shutdown,然后可以通过 外部中断唤醒,请问有没有这方面的资料和例程
Yue TANG:
回复 xiaxiaofei:
参考C:\ti\simplelink\ble_cc26xx_2_01_01_44627\Projects\ble\C:\ti\simplelink\ble_cc26xx_2_01_01_44627\Projects\ble\HIDEmuKbd.
这个例子就是在没有操作时,进入超低功耗,按键则唤醒。可基于此开发。
xiaxiaofei:
回复 Yue TANG:
刚测了一下,用HIDEmuKbd例程电流在几十微安(还是有点高),但是如果让他处于待机状态(1μA)该怎么配置。
young ytsau:
回复 Yue TANG:
这个例子没有Power_shutdown()以及唤醒的代码啊!/*******************************************************************************Filename:hidemukbd.cRevised:$Date: 2015-07-20 11:31:07 -0700 (Mon, 20 Jul 2015) $Revision:$Revision: 44370 $Description:This file contains the HID emulated keyboard sampleapplication for use with the CC2650 Bluetooth Low EnergyProtocol Stack.Copyright 2011 - 2015 Texas Instruments Incorporated. All rights reserved.IMPORTANT: Your use of this Software is limited to those specific rightsgranted under the terms of a software license agreement between the userwho downloaded the software, his/her employer (which must be your employer)and Texas Instruments Incorporated (the "License").You may not use thisSoftware unless you agree to abide by the terms of the License. The Licenselimits your use, and you acknowledge, that the Software may not be modified,copied or distributed unless embedded on a Texas Instruments microcontrolleror used solely and exclusively in conjunction with a Texas Instruments radiofrequency transceiver, which is integrated into your product.Other than forthe foregoing purpose, you may not use, reproduce, copy, prepare derivativeworks of, modify, distribute, perform, display or sell this Software and/orits documentation for any purpose.YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION AREPROVIDED 揂S IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALLTEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHERLEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSESINCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVEOR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENTOF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.Should you have any questions regarding your right to use this Software,contact Texas Instruments Incorporated at www.TI.com. *******************************************************************************//********************************************************************** INCLUDES*/#include <ti/sysbios/knl/Task.h> #include <ti/sysbios/knl/Clock.h> #include <ti/sysbios/knl/Semaphore.h> #include <ti/sysbios/knl/Queue.h>#include "gatt.h" #include "gapgattserver.h" #include "gattservapp.h" #include "gatt_profile_uuid.h" #include "devinfoservice.h" #include "battservice.h" #include "hidkbdservice.h" #include "hiddev.h"#include "peripheral.h" #include "gapbondmgr.h"#include "osal_snv.h" #include "ICallBleAPIMSG.h"#include "util.h" #include "board_key.h" #include "Board.h"#include "hidemukbd.h"/********************************************************************** MACROS*/#define KEY_NONE0x00// Selected HID LED bitmaps #define LED_NUM_LOCK0x01 #define LED_CAPS_LOCK0x02// Selected HID mouse button values #define MOUSE_BUTTON_10x01 #define MOUSE_BUTTON_NONE0x00// HID keyboard input report length #define HID_KEYBOARD_IN_RPT_LEN8// HID LED output report length #define HID_LED_OUT_RPT_LEN1// HID mouse input report length #define HID_MOUSE_IN_RPT_LEN5/********************************************************************** CONSTANTS*/// HID idle timeout in msec; set to zero to disable timeout #define DEFAULT_HID_IDLE_TIMEOUT60000// Minimum connection interval (units of 1.25ms) if automatic parameter update// request is enabled. #define DEFAULT_DESIRED_MIN_CONN_INTERVAL8// Maximum connection interval (units of 1.25ms) if automatic parameter update// request is enabled. #define DEFAULT_DESIRED_MAX_CONN_INTERVAL8// Slave latency to use if automatic parameter update request is enabled #define DEFAULT_DESIRED_SLAVE_LATENCY50// Supervision timeout value (units of 10ms) if automatic parameter update// request is enabled. #define DEFAULT_DESIRED_CONN_TIMEOUT500// Whether to enable automatic parameter update request when a connection is// formed. #define DEFAULT_ENABLE_UPDATE_REQUESTTRUE// Connection Pause Peripheral time value (in seconds) #define DEFAULT_CONN_PAUSE_PERIPHERAL10// Default passcode #define DEFAULT_PASSCODE0// Default GAP pairing mode #define DEFAULT_PAIRING_MODEGAPBOND_PAIRING_MODE_INITIATE// Default MITM mode (TRUE to require passcode or OOB when pairing) #define DEFAULT_MITM_MODEFALSE// Default bonding mode, TRUE to bond #define DEFAULT_BONDING_MODETRUE// Default GAP bonding I/O capabilities #define DEFAULT_IO_CAPABILITIESGAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT// Battery level is critical when it is less than this % #define DEFAULT_BATT_CRITICAL_LEVEL6// Task configuration #define HIDEMUKBD_TASK_PRIORITY1#ifndef HIDEMUKBD_TASK_STACK_SIZE #define HIDEMUKBD_TASK_STACK_SIZE644 #endif// Task Events #define HIDEMUKBD_KEY_CHANGE_EVT0x0001/********************************************************************** TYPEDEFS*/// App event passed from profiles. typedef struct {appEvtHdr_t hdr; // Event header } hidEmuKbdEvt_t;/********************************************************************** GLOBAL VARIABLES*//********************************************************************** EXTERNAL VARIABLES*//********************************************************************** EXTERNAL FUNCTIONS*//********************************************************************** LOCAL VARIABLES*/// Entity ID globally used to check for source and/or destination of messages static ICall_EntityID selfEntity;// Semaphore globally used to post events to the application thread static ICall_Semaphore sem;// Queue object used for app messages static Queue_Struct appMsg; static Queue_Handle appMsgQueue;// Task configuration Task_Struct hidEmuKbdTask; Char hidEmuKbdTaskStack[HIDEMUKBD_TASK_STACK_SIZE];// GAP Profile - Name attribute for SCAN RSP data static uint8_t scanData[] = {0x0D,// length of this dataGAP_ADTYPE_LOCAL_NAME_COMPLETE,// AD Type = Complete local name'H','I','D',' ','K','e','y','b','o','a','r','d' };// Advertising data static uint8_t advData[] = {// flags0x02,// length of this dataGAP_ADTYPE_FLAGS,GAP_ADTYPE_FLAGS_LIMITED | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,// appearance0x03,// length of this dataGAP_ADTYPE_APPEARANCE,LO_UINT16(GAP_APPEARE_HID_KEYBOARD),HI_UINT16(GAP_APPEARE_HID_KEYBOARD),// service UUIDs0x05,// length of this dataGAP_ADTYPE_16BIT_MORE,LO_UINT16(HID_SERV_UUID),HI_UINT16(HID_SERV_UUID),LO_UINT16(BATT_SERV_UUID),HI_UINT16(BATT_SERV_UUID) };// Device name attribute value static CONST uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "HID Keyboard";// HID Dev configuration static hidDevCfg_t hidEmuKbdCfg = {DEFAULT_HID_IDLE_TIMEOUT,// Idle timeoutHID_KBD_FLAGS// HID feature flags };// TRUE if boot mouse enabled static uint8_t hidBootMouseEnabled = FALSE;/********************************************************************** LOCAL FUNCTIONS*/// Application task and event processing. static void HidEmuKbd_init(void); static void HidEmuKbd_taskFxn(UArg a0, UArg a1); static void HidEmuKbd_processAppMsg(hidEmuKbdEvt_t *pMsg); static void HidEmuKbd_processStackMsg(ICall_Hdr *pMsg); static void HidEmuKbd_processGattMsg(gattMsgEvent_t *pMsg); static uint8_t HidEmuKbd_enqueueMsg(uint16_t event, uint8_t state);// Key press. static void HidEmuKbd_keyPressHandler(uint8_t keys); static void HidEmuKbd_handleKeys(uint8_t shift, uint8_t keys);// HID reports. static void HidEmuKbd_sendReport(uint8_t keycode); static void HidEmuKbd_sendMouseReport(uint8_t buttons); static uint8_t HidEmuKbd_receiveReport(uint8_t len, uint8_t *pData); static uint8_t HidEmuKbd_reportCB(uint8_t id, uint8_t type, uint16_t uuid,uint8_t oper, uint16_t *pLen, uint8_t *pData); static void HidEmuKbd_hidEventCB(uint8_t evt);/********************************************************************** PROFILE CALLBACKS*/static hidDevCB_t hidEmuKbdHidCBs = {HidEmuKbd_reportCB,HidEmuKbd_hidEventCB,NULL };/********************************************************************** PUBLIC FUNCTIONS*//********************************************************************** @fnHidEmuKbd_createTask** @briefTask creation function for the HID emulated keyboard.** @paramnone** @returnnone*/ void HidEmuKbd_createTask(void) {Task_Params taskParams;// Configure taskTask_Params_init(&taskParams);taskParams.stack = hidEmuKbdTaskStack;taskParams.stackSize = HIDEMUKBD_TASK_STACK_SIZE;taskParams.priority = HIDEMUKBD_TASK_PRIORITY;Task_construct(&hidEmuKbdTask, HidEmuKbd_taskFxn, &taskParams, NULL); }/********************************************************************** @fnHidEmuKbd_init** @briefInitialization function for the HidEmuKbd App Task.*This is called during initialization and should contain*any application specific initialization (ie. hardware*initialization/setup, table initialization, power up*notification ...).** @paramnone** @returnnone*/ void HidEmuKbd_init(void) {// ******************************************************************// N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp// ******************************************************************// Register the current thread as an ICall dispatcher application// so that the application can send and receive messages.ICall_registerApp(&selfEntity, &sem);// Hard code the DB Address till CC2650 board gets its own IEEE address//uint8 bdAddress[B_ADDR_LEN] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x5A };//HCI_EXT_SetBDADDRCmd(bdAddress);// Set device's Sleep Clock Accuracy//HCI_EXT_SetSCACmd(40);// Create an RTOS queue for message from profile to be sent to app.appMsgQueue = Util_constructQueue(&appMsg);// Setup the GAPVOID GAP_SetParamValue(TGAP_CONN_PAUSE_PERIPHERAL,DEFAULT_CONN_PAUSE_PERIPHERAL);// Setup the GAP Peripheral Role Profile{uint8_t initial_advertising_enable = TRUE;// By setting this to zero, the device will go into the waiting state after// being discoverable for 30.72 second, and will not being advertising again// until the enabler is set back to TRUEuint16_t gapRole_AdvertOffTime = 0;uint8_t enable_update_request = DEFAULT_ENABLE_UPDATE_REQUEST;uint16_t desired_min_interval = DEFAULT_DESIRED_MIN_CONN_INTERVAL;uint16_t desired_max_interval = DEFAULT_DESIRED_MAX_CONN_INTERVAL;uint16_t desired_slave_latency = DEFAULT_DESIRED_SLAVE_LATENCY;uint16_t desired_conn_timeout = DEFAULT_DESIRED_CONN_TIMEOUT;// Set the GAP Role ParametersGAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),&initial_advertising_enable);GAPRole_SetParameter(GAPROLE_ADVERT_OFF_TIME, sizeof(uint16_t),&gapRole_AdvertOffTime);GAPRole_SetParameter(GAPROLE_ADVERT_DATA, sizeof(advData), advData);GAPRole_SetParameter(GAPROLE_SCAN_RSP_DATA, sizeof(scanData), scanData);GAPRole_SetParameter(GAPROLE_PARAM_UPDATE_ENABLE, sizeof(uint8_t),&enable_update_request);GAPRole_SetParameter(GAPROLE_MIN_CONN_INTERVAL, sizeof(uint16_t),&desired_min_interval);GAPRole_SetParameter(GAPROLE_MAX_CONN_INTERVAL, sizeof(uint16_t),&desired_max_interval);GAPRole_SetParameter(GAPROLE_SLAVE_LATENCY, sizeof(uint16_t),&desired_slave_latency);GAPRole_SetParameter(GAPROLE_TIMEOUT_MULTIPLIER, sizeof(uint16_t),&desired_conn_timeout);}// Set the GAP CharacteristicsGGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN,(void *)attDeviceName);// Setup the GAP Bond Manager{uint32_t passkey = DEFAULT_PASSCODE;uint8_t pairMode = DEFAULT_PAIRING_MODE;uint8_t mitm = DEFAULT_MITM_MODE;uint8_t ioCap = DEFAULT_IO_CAPABILITIES;uint8_t bonding = DEFAULT_BONDING_MODE;GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t),&passkey);GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);}// Setup Battery Characteristic Values{uint8_t critical = DEFAULT_BATT_CRITICAL_LEVEL;Batt_SetParameter(BATT_PARAM_CRITICAL_LEVEL, sizeof (uint8_t), &critical);}// Set up HID keyboard serviceHidKbd_AddService();// Register for HID Dev callbackHidDev_Register(&hidEmuKbdCfg, &hidEmuKbdHidCBs);// Start the GAP Role and Register the Bond Manager.HidDev_StartDevice();// Initialize keys on SmartRF06EB.Board_initKeys(HidEmuKbd_keyPressHandler); }/********************************************************************** @fnHidEmuKbd_taskFxn** @briefHidEmuKbd Application Task event processor.This function*is called to process all events for the task.Events*include timers, messages and any other user defined events.** @parama0, a1 - not used.** @returnnone*/ void HidEmuKbd_taskFxn(UArg a0, UArg a1) {// Initialize the application.HidEmuKbd_init();// Application main loop.for (;;){// Waits for a signal to the semaphore associated with the calling thread.// Note that the semaphore associated with a thread is signaled when a// message is queued to the message receive queue of the thread or when// ICall_signal() function is called onto the semaphore.ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);if (errno == ICALL_ERRNO_SUCCESS){ICall_EntityID dest;ICall_ServiceEnum src;ICall_HciExtEvt *pMsg = NULL;if (ICall_fetchServiceMsg(&src, &dest,(void **)&pMsg) == ICALL_ERRNO_SUCCESS){if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity)){// Process inter-task messageHidEmuKbd_processStackMsg((ICall_Hdr *)pMsg);}if (pMsg){ICall_freeMsg(pMsg);}}// If RTOS queue is not empty, process app message.while (!Queue_empty(appMsgQueue)){hidEmuKbdEvt_t *pMsg = (hidEmuKbdEvt_t *)Util_dequeueMsg(appMsgQueue);if (pMsg){// Process message.HidEmuKbd_processAppMsg(pMsg);// Free the space from the message.ICall_free(pMsg);}}}} }/********************************************************************** @fnHidEmuKbd_processStackMsg** @briefProcess an incoming stack message.** @parampMsg - message to process** @returnnone*/ static void HidEmuKbd_processStackMsg(ICall_Hdr *pMsg) {switch (pMsg->event){case GATT_MSG_EVENT:HidEmuKbd_processGattMsg((gattMsgEvent_t *) pMsg);break;default:// Do nothingbreak;} }/********************************************************************** @fnHidEmuKbd_processGattMsg** @briefProcess GATT messages** @returnnone*/ static void HidEmuKbd_processGattMsg(gattMsgEvent_t *pMsg) {GATT_bm_free(&pMsg->msg, pMsg->method); }/********************************************************************** @fnHidEmuKbd_processAppMsg** @briefProcess an incoming task message.** @parampMsg - message to process** @returnnone*/ static void HidEmuKbd_processAppMsg(hidEmuKbdEvt_t *pMsg) {switch (pMsg->hdr.event){case HIDEMUKBD_KEY_CHANGE_EVT:HidEmuKbd_handleKeys(0, pMsg->hdr.state);break;default://Do nothing.break;} }/********************************************************************** @fnHidKEmukbd_keyPressHandler** @briefKey event handler function.** @parama0 - ignored** @returnnone*/ static void HidEmuKbd_keyPressHandler(uint8_t keys) {// Enqueue the event.HidEmuKbd_enqueueMsg(HIDEMUKBD_KEY_CHANGE_EVT, keys); }/********************************************************************** @fnHidEmuKbd_handleKeys** @briefHandles all key events for this device.** @paramshift - true if in shift/alt.* @paramkeys - bit field for key events. Valid entries:*KEY_UP*KEY_RIGHT** @returnnone*/ static void HidEmuKbd_handleKeys(uint8_t shift, uint8_t keys) {(void)shift;// Intentionally unreferenced parameterif (keys & KEY_UP){// Key Press.HidEmuKbd_sendReport(HID_KEYBOARD_UP_ARROW);// Key Release.// NB: releasing a key press will not propagate a signal to this function,// so a "key release" is reported immediately afterwards here.HidEmuKbd_sendReport(KEY_NONE);}if (keys & KEY_DOWN){// Key Press.HidEmuKbd_sendReport(HID_KEYBOARD_DOWN_ARROW);// Key Release.// NB: releasing a key press will not propagate a signal to this function,// so a "key release" is reported immediately afterwards here.HidEmuKbd_sendReport(KEY_NONE);}if (keys & KEY_LEFT){// Key Press.HidEmuKbd_sendReport(HID_KEYBOARD_LEFT_ARROW);// Key Release.// NB: releasing a key press will not propagate a signal to this function,// so a "key release" is reported immediately afterwards here.HidEmuKbd_sendReport(KEY_NONE);}if (keys & KEY_RIGHT){// Key Press.HidEmuKbd_sendReport(HID_KEYBOARD_RIGHT_ARROW);// Key Release// NB: releasing a key press will not propagate a signal to this function,// so a "key release" is reported immediately afterwards here.HidEmuKbd_sendReport(KEY_NONE);}if (keys & KEY_SELECT){if (hidBootMouseEnabled){// Key Press.HidEmuKbd_sendMouseReport(MOUSE_BUTTON_1);// Key Release.// NB: releasing a key press will not propagate a signal to this function,// so a "key release" is reported immediately afterwards here.HidEmuKbd_sendMouseReport (MOUSE_BUTTON_NONE);}} }/********************************************************************** @fnHidEmuKbd_sendReport** @briefBuild and send a HID keyboard report.** @paramkeycode - HID keycode.** @returnnone*/ static void HidEmuKbd_sendReport(uint8_t keycode) {uint8_t buf[HID_KEYBOARD_IN_RPT_LEN];buf[0] = 0;// Modifier keysbuf[1] = 0;// Reservedbuf[2] = keycode;// Keycode 1buf[3] = 0;// Keycode 2buf[4] = 0;// Keycode 3buf[5] = 0;// Keycode 4buf[6] = 0;// Keycode 5buf[7] = 0;// Keycode 6HidDev_Report(HID_RPT_ID_KEY_IN, HID_REPORT_TYPE_INPUT,HID_KEYBOARD_IN_RPT_LEN, buf); }/********************************************************************** @fnHidEmuKbd_sendMouseReport** @briefBuild and send a HID mouse report.** @parambuttons - Mouse button code** @returnnone*/ static void HidEmuKbd_sendMouseReport(uint8_t buttons) {uint8_t buf[HID_MOUSE_IN_RPT_LEN];buf[0] = buttons;// Buttonsbuf[1] = 0;// Xbuf[2] = 0;// Ybuf[3] = 0;// Wheelbuf[4] = 0;// AC PanHidDev_Report(HID_RPT_ID_MOUSE_IN, HID_REPORT_TYPE_INPUT,HID_MOUSE_IN_RPT_LEN, buf); }/********************************************************************** @fnHidEmuKbd_receiveReport** @briefProcess an incoming HID keyboard report.** @paramlen - Length of report.* @parampData - Report data.** @returnstatus*/ static uint8_t HidEmuKbd_receiveReport(uint8_t len, uint8_t *pData) {// Verify data lengthif (len == HID_LED_OUT_RPT_LEN){// Set keyfob LEDs//HalLedSet(HAL_LED_1, ((*pData & LED_CAPS_LOCK) == LED_CAPS_LOCK));//HalLedSet(HAL_LED_2, ((*pData & LED_NUM_LOCK) == LED_NUM_LOCK));return SUCCESS;}else{return ATT_ERR_INVALID_VALUE_SIZE;} }/********************************************************************** @fnHidEmuKbd_reportCB** @briefHID Dev report callback.** @paramid - HID report ID.* @paramtype - HID report type.* @paramuuid - attribute uuid.* @paramoper - operation:read, write, etc.* @paramlen - Length of report.* @parampData - Report data.** @returnGATT status code.*/ static uint8_t HidEmuKbd_reportCB(uint8_t id, uint8_t type, uint16_t uuid,uint8_t oper, uint16_t *pLen, uint8_t *pData) {uint8_t status = SUCCESS;// Writeif (oper == HID_DEV_OPER_WRITE){if (uuid == REPORT_UUID){// Process write to LED output report; ignore othersif (type == HID_REPORT_TYPE_OUTPUT){status = HidEmuKbd_receiveReport(*pLen, pData);}}if (status == SUCCESS){status = HidKbd_SetParameter(id, type, uuid, *pLen, pData);}}// Readelse if (oper == HID_DEV_OPER_READ){uint8_t len;status = HidKbd_GetParameter(id, type, uuid, &len, pData);if (status == SUCCESS){*pLen = len;}}// Notifications enabledelse if (oper == HID_DEV_OPER_ENABLE){if (id == HID_RPT_ID_MOUSE_IN && type == HID_REPORT_TYPE_INPUT){hidBootMouseEnabled = TRUE;}}// Notifications disabledelse if (oper == HID_DEV_OPER_DISABLE){if (id == HID_RPT_ID_MOUSE_IN && type == HID_REPORT_TYPE_INPUT){hidBootMouseEnabled = FALSE;}}return status; }/********************************************************************** @fnHidEmuKbd_hidEventCB** @briefHID Dev event callback.** @paramevt - event ID.** @returnHID response code.*/ static void HidEmuKbd_hidEventCB(uint8_t evt) {// Process enter/exit suspend or enter/exit boot modereturn; }/********************************************************************** @fnHidEmuKbd_enqueueMsg** @briefCreates a message and puts the message in RTOS queue.** @paramevent- message event.* @paramstate- message state.** @returnTRUE or FALSE*/ static uint8_t HidEmuKbd_enqueueMsg(uint16_t event, uint8_t state) {hidEmuKbdEvt_t *pMsg;// Create dynamic pointer to message.if (pMsg = ICall_malloc(sizeof(hidEmuKbdEvt_t))){pMsg->hdr.event = event;pMsg->hdr.state = state;// Enqueue the message.return Util_enqueueMsg(appMsgQueue, sem, (uint8_t *)pMsg);}return FALSE; }/********************************************************************* *********************************************************************/
TI中文支持网



