fix(nimble) Add VSC for Set Scan Channel Bitmap for esp32c2

This commit is contained in:
Rahul Tank
2025-07-31 11:38:53 +05:30
parent b45dcedcaf
commit d59bb2debc
3 changed files with 32 additions and 0 deletions
+17
View File
@@ -262,6 +262,23 @@ int ble_gap_clear_legacy_adv(void);
*/
int ble_gap_set_chan_select(uint8_t select);
/**
* This API is used to Set scan channel bitmap for scan/init.
*
* Currently supported only for ESP32C2 chipset.
*
* @param state 0:Scanning
* 1:Initiating
*
* @param bitmap[5] Represents 5 byte channel bitmap. Bit 37,38 and 39 set to
* represent primary channels, enabled by default.
*
* Bit 39 refers to MSb of MSB of 5-byte bitmap
*
* @return status, 0 on success; nonzero on failure.
*/
int ble_gap_set_scan_chan(uint8_t state, uint8_t *bitmap);
#endif
/**
+12
View File
@@ -9403,6 +9403,18 @@ int ble_gap_set_chan_select(uint8_t select)
return ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_SET_CHAN_SELECT,
&select, 1, NULL, 0);
}
int ble_gap_set_scan_chan(uint8_t state, uint8_t *bitmap)
{
uint8_t vs_cmd[6];
memset(vs_cmd, 0x0, sizeof(vs_cmd));
vs_cmd[0] = state;
memcpy(&vs_cmd[1], bitmap, 5);
return ble_hs_hci_send_vs_cmd(BLE_HCI_OCF_VS_SET_SCAN_CHAN,
&vs_cmd, sizeof(vs_cmd), NULL, 0);
}
#endif
int
+3
View File
@@ -1384,6 +1384,9 @@ struct ble_hci_vs_duplicate_exception_list_cp {
#define BLE_HCI_OCF_VS_SET_CHAN_SELECT (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0112))
#define BLE_HCI_OCF_VS_SET_EVT_MASK (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0116))
#define BLE_HCI_OCF_VS_SET_SCAN_CHAN (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0119))
struct ble_hci_vs_set_event_mask_cp {
uint32_t event_mask;
} __attribute__((packed));