Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2650
Hi Team,
The HID project does not have the part of BLE LED initiation,so how to get BLE status in this project?
A customer added the initiation part from simple_peripheral into HID, but still could not read the status or send the BLE command. Please check the following codes.
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, &syncEvent);
// Create an RTOS queue for message from profile to be sent to app.
appMsgQueue = Util_constructQueue(&appMsg);
// Setup the GAP
//@brief Minimum time upon connection establishment before the peripheral starts a connection update procedure (seconds)
VOID 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 TRUE
uint16_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 Parameters
GAPRole_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 Characteristics
GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN,
(void *)attDeviceName);
// Setup the GAP Bond Manager
{
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_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 service
HidKbdCC_AddService();
// Register for HID Dev callback
HidDev_Register(&hidEmuKbdCfg, &hidEmuKbdHidCBs);
// Start the GAP Role and Register the Bond Manager.
HidDev_StartDevice();
// Initialize keys on SmartRF06EB.
Board_initKeys(HidEmuKbd_keyPressHandler);
#if !defined (USE_LL_CONN_PARAM_UPDATE)
// Get the currently set local supported LE features
// The HCI will generate an HCI event that will get received in the main
// loop
HCI_LE_ReadLocalSupportedFeaturesCmd();
#endif // !defined (USE_LL_CONN_PARAM_UPDATE)
// Use default data Tx / Rx data length and times
HCI_EXT_SetMaxDataLenCmd(LL_MIN_LINK_DATA_LEN, LL_MIN_LINK_DATA_TIME, LL_MIN_LINK_DATA_LEN, LL_MIN_LINK_DATA_TIME);
/**********************Custom Initiation*********************/
GUA_Led_Set( GUA_LED_NO_1, GUA_LED_MODE_ON);
GUA_Led_Set( GUA_LED_NO_2, GUA_LED_MODE_ON);
GUA_Led_Set( GUA_LED_NO_1, GUA_LED_MODE_OFF);
GUA_Led_Set( GUA_LED_NO_2, GUA_LED_MODE_OFF);
VOID GAPRole_StartDevice(&SimpleBLEPeripheral_gapRoleCBs);
Util_constructClock(&GUA_periodicClock, SimpleBLECentral_GUAHandler, SBP_GUA_PERIODIC_EVT_PERIOD, 0, false, SBP_GUA_PERIODIC_EVT);
Util_startClock(&GUA_periodicClock);//Start timer
}
BR
Viki Shi