You are here: Forum Home → ANT Developers Forums → ANT General Questions → Thread
sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI | ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
const ant_channel_config_t bs_channel_config = {
.channel_number = 0,
.channel_type = CHANNEL_TYPE_SLAVE_RX_ONLY,
.ext_assign = EXT_PARAM_ALWAYS_SEARCH,
.rf_freq = 57,
.transmission_type = 0, // Wild card
.device_type = 0x78,
.device_number = 0x00, // Wild card
.channel_period = 0x00, // This is not taken into account.
.network_number = 0,
};
const ant_search_config_t bs_search_config = {
.channel_number = 0,
.low_priority_timeout = ANT_LOW_PRIORITY_TIMEOUT_DISABLE,
.high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
.search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE,
.search_priority = ANT_SEARCH_PRIORITY_DEFAULT,
.waveform = ANT_WAVEFORM_DEFAULT, // must be set to the default for high duty search
};
const ANT_HIGH_DUTY_SEARCH_CONFIG hconfig = {HIGH_DUTY_SEARCH_ENABLE, HIGH_DUTY_SEARCH_SUPPRESSION_NONE,
HIGH_DUTY_SEARCH_RESTART_INTERVAL_DEFAULT};
sd_ant_high_duty_search_config_set(&hconfig;);
ant_channel_init(&bs;_channel_config);
ant_search_init(&bs;_search_config);
sd_ant_channel_open(0);
sd_ant_lib_config_set(ANT_LIB_CONFIG_MESG_OUT_INC_RSSI | ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
ant_channel_config_t channel_config = {
.channel_number = 0,
.channel_type = CHANNEL_TYPE_SLAVE_RX_ONLY,
.ext_assign = 0x00,
.rf_freq = 57,
.transmission_type = 0, // wildcard
.device_type = 0x78, // 0x78 = heart rate monitor
.device_number = 0x00, // wildcard
.channel_period = 0x00, // Not used, since this is going to be scanning
.network_number = 0,
};
ant_channel_init(&channel;_config);
sd_ant_rx_scan_mode_start(0);
static uint8_t cnt = 0;
static void ant_evt_handler(ant_evt_t *p_ant_evt, void *p_context) {
if (p_ant_evt->channel == 0) {
switch (p_ant_evt->event) {
case EVENT_RX:
cnt++;
break;
default:
break;
}
}
}
NRF_SDH_ANT_OBSERVER(m_ant_observer, APP_ANT_OBSERVER_PRIO, ant_evt_handler, NULL);
* Configuration structure is as follows:
* Byte0 = Configuration enable bitfield
* bit0 - enable/disable tx/rx channel keep alive config (Byte4/5 & Byte6/7)
* bit1 - enable/disable tx/rx channel fixed interval priority config (Byte1)
* bit2 - enable/disable transfer keep alive config (Byte2)
* bit3 - enable/disable search channel fixed interval priority config (Byte3)
* else - reserved
* Byte1 = tx/rx channel fixed interval priority configuration
* Byte2 = transfer keep alive configuration
* Byte3 = search channel fixed interval priority configuration
* Byte4(LSB)/Byte5(MSB) = tx channel keep alive configuration
* Byte6(LSB)/Byte7(MSB) = rx channel keep alive configuration
* Byte8 = ANT counts/16 spent in high priority mode during search scan.
* Byte9 = ANT counts/16 spent in low priority mode during search scan.
*
* Advanced configuration structure is as follows:
* Byte0 = Configuration enable bitfield
* bit0 - enable/disable priority override config (Byte1)
* bit1-7 - reserved
* Byte1 = ANT priority override. 0 = low, 1 = normal(default), 2 = high, 3 = critical
* Byte2 = Reserved
* Byte3 = Reserved
* Byte4 = Reserved
* Byte5 = Reserved
* Byte6 = Reserved
* Byte7 = Reserved