DA14580 advertises to a specify channel

Volcano 2018-05-17 11:00

For BLE, Channels 37, 38, and 39 are used only for sending advertisement packets. DA14580 advertises at channel 37, 38 and 39 in the example project from Dialog. But sometimes we need it advertises to a specify channel.

Here are the channel define In the file co_bt.h

///Advertising channels enables
enum adv_channel_map
{
  ///Byte value for advertising channel map for channel 37 enable
  ADV_CHNL_37_EN = 0x01,
  ///Byte value for advertising channel map for channel 38 enable
  ADV_CHNL_38_EN,
  ///Byte value for advertising channel map for channel 39 enable
  ADV_CHNL_39_EN = 0x04,
  ///Byte value for advertising channel map for channel 37, 38 and 39 enable
  ADV_ALL_CHNLS_EN = 0x07,
  ///Enumeration end value for advertising channels enable value check
  ADV_CHNL_END
};

Here’s the code to let DA14580 advertises to channel 37

#define APP_ADV_CHMAP ADV_CHNL_37_EN

....

struct gapm_start_advertise_cmd *cmd;
....
cmd->channel_map = APP_ADV_CHMAP;

[返回] [原文链接]