aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant')
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.c86
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.h98
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.c245
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.h241
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c185
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h140
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.c2379
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.h396
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.c98
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.h94
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/defines.h109
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.c67
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.h104
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/config/ant_key_manager_config.h69
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c490
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h377
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h89
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c99
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h99
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c286
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h136
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c117
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h111
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c77
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h89
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c77
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h89
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c113
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h106
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h69
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c201
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h123
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h74
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h86
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.c422
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.h359
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h83
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c129
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h99
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c111
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c94
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h93
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c96
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c94
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h97
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c104
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h113
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c97
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h69
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c280
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h120
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h128
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c224
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h157
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c141
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h135
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c110
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h120
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c117
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h111
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.c346
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.h292
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h75
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c116
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h99
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c102
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c106
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h97
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c103
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h99
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c107
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h97
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h67
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c148
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h130
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h69
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h111
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.c409
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.h331
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h81
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c104
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h103
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c144
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h101
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c104
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c128
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h129
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c127
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h106
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c92
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h93
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h70
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c159
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h139
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h71
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h112
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.c77
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.h129
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.c145
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.h95
106 files changed, 16673 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.c
new file mode 100644
index 0000000..41c2a5c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.c
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_CHANNEL_CONFIG)
+#include "nrf_error.h"
+#include "ant_channel_config.h"
+#include "ant_interface.h"
+#include "ant_parameters.h"
+
+uint32_t ant_channel_init(ant_channel_config_t const * p_config)
+{
+ uint32_t err_code;
+ // Set Channel Number.
+ err_code = sd_ant_channel_assign(p_config->channel_number,
+ p_config->channel_type,
+ p_config->network_number,
+ p_config->ext_assign);
+
+ VERIFY_SUCCESS(err_code);
+
+ // Set Channel ID.
+ err_code = sd_ant_channel_id_set(p_config->channel_number,
+ p_config->device_number,
+ p_config->device_type,
+ p_config->transmission_type);
+
+ VERIFY_SUCCESS(err_code);
+
+ // Set Channel RF frequency.
+ err_code = sd_ant_channel_radio_freq_set(p_config->channel_number, p_config->rf_freq);
+ VERIFY_SUCCESS(err_code);
+
+ // Set Channel period.
+ if (!(p_config->ext_assign & EXT_PARAM_ALWAYS_SEARCH) && (p_config->channel_period != 0))
+ {
+ err_code = sd_ant_channel_period_set(p_config->channel_number, p_config->channel_period);
+ }
+
+
+#if NRF_SDH_ANT_ENCRYPTED_CHANNELS > 0
+ VERIFY_SUCCESS(err_code);
+
+ err_code = ant_channel_encrypt_config(p_config->channel_type , p_config->channel_number, p_config->p_crypto_settings);
+#endif
+
+ return err_code;
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_CHANNEL_CONFIG)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.h
new file mode 100644
index 0000000..fea25c8
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_channel_config/ant_channel_config.h
@@ -0,0 +1,98 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_CHANNEL_CONFIG_H__
+#define ANT_CHANNEL_CONFIG_H__
+
+/** @file
+ *
+ * @defgroup ant_channel_config ANT channel configuration
+ * @{
+ * @ingroup ant_sdk_utils
+ * @brief ANT channel configuration module.
+ */
+
+#include <stdint.h>
+#include "sdk_config.h"
+
+
+#ifndef NRF_SDH_ANT_ENCRYPTED_CHANNELS
+ #error Undefined NRF_SDH_ANT_ENCRYPTED_CHANNELS. It should be defined in sdk_config.h file.
+#elif NRF_SDH_ANT_ENCRYPTED_CHANNELS > 0
+ #include "ant_encrypt_config.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief ANT channel configuration structure. */
+typedef struct
+{
+ uint8_t channel_number; ///< Assigned channel number.
+ uint8_t channel_type; ///< Channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+ uint8_t ext_assign; ///< Extended assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+ uint8_t rf_freq; ///< Radio frequency offset from 2400 MHz (for example, 2466 MHz, rf_freq = 66).
+ uint8_t transmission_type; ///< Transmission type.
+ uint8_t device_type; ///< Device type.
+ uint16_t device_number; ///< Device number.
+ uint16_t channel_period; ///< The period in 32 kHz counts.
+ uint8_t network_number; ///< Network number denoting the network key.
+
+#if NRF_SDH_ANT_ENCRYPTED_CHANNELS > 0
+ ant_encrypt_channel_settings_t * p_crypto_settings; ///< Pointer to cryptographic settings, NULL if this configuration have to be omitted.
+#endif
+
+} ant_channel_config_t;
+
+/**@brief Function for configuring the ANT channel.
+ *
+ * @param[in] p_config Pointer to the channel configuration structure.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned.
+ */
+uint32_t ant_channel_init(ant_channel_config_t const * p_config);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_CHANNEL_CONFIG_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.c
new file mode 100644
index 0000000..45e5614
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.c
@@ -0,0 +1,245 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_ENCRYPT_CONFIG)
+#include <stdlib.h>
+#include "ant_encrypt_config.h"
+#include "ant_interface.h"
+#include "ant_parameters.h"
+
+#ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ #include "ant_encrypt_negotiation_slave.h"
+#endif
+
+ /*lint -e551 -save*/
+/** Flag for checking if stack was configured for encryption. */
+static bool m_stack_encryption_configured = false;
+ /*lint -restore */
+
+ /** Pointer to handler of module's events. */
+static ant_encryp_user_handler_t m_ant_enc_evt_handler = NULL;
+
+static ret_code_t ant_enc_advance_burs_config_apply(
+ ant_encrypt_adv_burst_settings_t const * const p_adv_burst_set);
+
+ret_code_t ant_stack_encryption_config(ant_encrypt_stack_settings_t const * const p_crypto_set)
+{
+ ret_code_t err_code;
+
+ for ( uint32_t i = 0; i < p_crypto_set->key_number; i++)
+ {
+ err_code = sd_ant_crypto_key_set(i, p_crypto_set->pp_key[i]);
+ VERIFY_SUCCESS(err_code);
+ }
+
+ if (p_crypto_set->p_adv_burst_config != NULL)
+ {
+ err_code = ant_enc_advance_burs_config_apply(p_crypto_set->p_adv_burst_config);
+ VERIFY_SUCCESS(err_code);
+ }
+
+ // subcomands LUT for @ref sd_ant_crypto_info_set calls
+ const uint8_t set_enc_info_param_lut[] =
+ {
+ ENCRYPTION_INFO_SET_CRYPTO_ID,
+ ENCRYPTION_INFO_SET_CUSTOM_USER_DATA,
+ ENCRYPTION_INFO_SET_RNG_SEED
+ };
+
+ for ( uint32_t i = 0; i < sizeof(set_enc_info_param_lut); i++)
+ {
+ if ( p_crypto_set->info.pp_array[i] != NULL)
+ {
+ err_code = sd_ant_crypto_info_set(set_enc_info_param_lut[i],
+ p_crypto_set->info.pp_array[i]);
+
+ VERIFY_SUCCESS(err_code);
+ }
+ }
+
+ #ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ // all ANT channels have unsupported slave encryption tracking (even master's channel)
+ ant_channel_encryp_negotiation_slave_init();
+ #endif
+
+ m_ant_enc_evt_handler = NULL;
+
+ m_stack_encryption_configured = true;
+
+ return NRF_SUCCESS;
+}
+
+
+/**
+ * @brief Function for configuring advanced burst settings according to encryption requirements.
+ *
+ * @param p_adv_burst_set Pointer to ANT advanced burst settings.
+ *
+ * @retval Value returned by @ref sd_ant_adv_burst_config_set.
+ */
+static ret_code_t ant_enc_advance_burs_config_apply(
+ ant_encrypt_adv_burst_settings_t const * const p_adv_burst_set)
+{
+ uint8_t adv_burst_conf_str[ADV_BURST_CFG_MIN_SIZE] =
+ { ADV_BURST_MODE_ENABLE, 0, 0, 0, 0, 0, 0, 0 };
+
+ adv_burst_conf_str[ADV_BURST_CFG_PACKET_SIZE_INDEX] = p_adv_burst_set->packet_length;
+ adv_burst_conf_str[ADV_BURST_CFG_REQUIRED_FEATURES] = p_adv_burst_set->required_feature;
+ adv_burst_conf_str[ADV_BURST_CFG_OPTIONAL_FEATURES] = p_adv_burst_set->optional_feature;
+
+ return sd_ant_adv_burst_config_set(adv_burst_conf_str, sizeof(adv_burst_conf_str));
+}
+
+
+ret_code_t ant_channel_encrypt_config_perform(uint8_t channel_number,
+ ant_encrypt_channel_settings_t * p_crypto_config)
+{
+ return sd_ant_crypto_channel_enable(channel_number,
+ p_crypto_config->mode,
+ p_crypto_config->key_index,
+ p_crypto_config->decimation_rate);
+}
+
+
+ret_code_t ant_channel_encrypt_config(uint8_t channel_type,
+ uint8_t channel_number,
+ ant_encrypt_channel_settings_t * p_crypto_config)
+{
+ ret_code_t err_code;
+
+ if (p_crypto_config != NULL)
+ {
+ // encryption of the stack should be initialized previously
+ if (m_stack_encryption_configured == false)
+ {
+ return NRF_ERROR_MODULE_NOT_INITIALIZED;
+ }
+
+ switch (channel_type)
+ {
+ case CHANNEL_TYPE_MASTER:
+ err_code = ant_channel_encrypt_config_perform(channel_number, p_crypto_config);
+#ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ ant_channel_encryp_tracking_state_set(channel_number,
+ ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED);
+#endif
+ break;
+
+#ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ case CHANNEL_TYPE_SLAVE:
+ ant_slave_channel_encrypt_config(channel_number, p_crypto_config);
+
+ if (p_crypto_config->mode == ENCRYPTION_DISABLED_MODE)
+ {
+ err_code = ant_channel_encrypt_config_perform(channel_number, p_crypto_config);
+ ant_channel_encryp_tracking_state_set(channel_number,
+ ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED);
+ }
+ else
+ {
+ ant_channel_encryp_tracking_state_set(channel_number,
+ ANT_ENC_CHANNEL_STAT_NOT_TRACKING);
+ err_code = NRF_SUCCESS;
+ }
+ break;
+#endif
+
+ default:
+ err_code = NRF_ERROR_INVALID_PARAM;
+ break;
+ }
+ }
+ else
+ {
+#ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ ant_channel_encryp_tracking_state_set(channel_number,
+ ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED);
+#endif
+ err_code = NRF_SUCCESS;
+ }
+
+ return err_code;
+}
+
+/** @brief Function for calling the handler of module events.*/
+static void ant_encrypt_user_handler_try_to_run(uint8_t ant_channel, ant_encrypt_user_evt_t event)
+{
+ if (m_ant_enc_evt_handler != NULL)
+ {
+ m_ant_enc_evt_handler(ant_channel, event);
+ }
+}
+
+/**@brief Function for handling an ANT stack event.
+ * @param[in] p_ant_evt ANT stack event.
+ * @param[in] p_context Context.
+ */
+static void ant_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ uint8_t const ant_channel = p_ant_evt->channel;
+
+#ifdef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED
+ ant_slave_encrypt_negotiation(p_ant_evt);
+#endif
+
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX_FAIL_GO_TO_SEARCH:
+ ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_CHANNEL_LOST);
+ break;
+
+ case EVENT_ENCRYPT_NEGOTIATION_SUCCESS:
+ ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_NEGOTIATION_SUCCESS);
+ break;
+
+ case EVENT_ENCRYPT_NEGOTIATION_FAIL:
+ ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_NEGOTIATION_FAIL);
+ break;
+ }
+}
+
+NRF_SDH_ANT_OBSERVER(m_ant_observer, ANT_ENCRYPT_ANT_OBSERVER_PRIO, ant_evt_handler, NULL);
+
+void ant_enc_event_handler_register(ant_encryp_user_handler_t user_handler_func)
+{
+ m_ant_enc_evt_handler = user_handler_func;
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_ENCRYPT_CONFIG)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.h
new file mode 100644
index 0000000..53f0a8f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_config.h
@@ -0,0 +1,241 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_ENCRYPT_CONFIG__
+#define ANT_ENCRYPT_CONFIG__
+
+/**@file
+ *
+ * @defgroup ant_encrypt_config ANT encryption configuration
+ * @{
+ * @ingroup ant_sdk_utils
+ *
+ * @brief Encryption configuration for the ANT stack and channels.
+ *
+ */
+
+#include <stdint.h>
+
+#include "sdk_errors.h"
+#include "nrf_sdh_ant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @name Advanced burst configuration for encryption modules
+ * @{
+ */
+#define ADV_BURST_CFG_MIN_SIZE 8 ///< Minimum size of the advance burst configuration data.
+#define ADV_BURST_CFG_PACKET_SIZE_INDEX 1 ///< Index of the packet size field in the configuration data.
+#define ADV_BURST_CFG_REQUIRED_FEATURES 2 ///< Index of the required features field in the configuration data.
+#define ADV_BURST_CFG_OPTIONAL_FEATURES 5 ///< Index of the optional features field in the configuration data.
+/**@} */
+
+/** @brief ANT channel cryptographic configuration. */
+typedef struct
+{
+ uint8_t mode; ///< Encryption mode. See the encrypted channel defines in ant_parameters.h.
+ uint8_t key_index; ///< Index of encryption key.
+ uint8_t decimation_rate; ///< Division of the master channel rate by the slave’s tracking channel rate.
+} ant_encrypt_channel_settings_t;
+
+/** @brief ANT encryption information. */
+typedef union
+{
+ uint8_t * pp_array[3]; // For array access support.
+ struct
+ {
+ uint8_t * p_encryption_id; ///< Pointer to the encryption ID of the device (4 bytes).
+ uint8_t * p_user_info; ///< Pointer to the user information string (19 bytes).
+ uint8_t * p_random_num_seed; ///< Pointer to the random number seed (16 bytes).
+ } items;
+} ant_encrypt_info_settings_t;
+
+/** @brief Advanced burst settings used by the encrypted channel. */
+typedef struct
+{
+ uint8_t packet_length; ///< RF payload size. See the advanced burst configuration defines in ant_parameters.h.
+ uint8_t required_feature; ///< Required advanced burst modes. See the advanced burst configuration defines in ant_parameters.h.
+ uint8_t optional_feature; ///< Optional advanced burst modes. See the advanced burst configuration defines in ant_parameters.h.
+} ant_encrypt_adv_burst_settings_t;
+
+/**@brief ANT stack cryptographic configuration. */
+typedef struct
+{
+ ant_encrypt_info_settings_t info; ///< Pointer to the encryption information structure.
+ uint8_t * * pp_key; ///< Pointer to an array for pointers to encryption keys. Each key must have a length of 16 bytes.
+ uint8_t key_number; ///< Number of encryption keys.
+ ant_encrypt_adv_burst_settings_t * p_adv_burst_config; ///< Advanced burst configuration. If NULL, the advanced burst must be configured externally.
+} ant_encrypt_stack_settings_t;
+
+/**
+ * @brief ANT encryption negotiation events.
+ */
+typedef enum
+{
+ ANT_ENC_EVT_NEGOTIATION_SUCCESS, ///< Negotiation success.
+ ANT_ENC_EVT_NEGOTIATION_FAIL, ///< Negotiation failure.
+ ANT_ENC_EVT_CHANNEL_LOST ///< Lost a channel. It's relevant only for slave channels.
+} ant_encrypt_user_evt_t;
+
+/**
+ * @brief Event handler for ANT encryption user events.
+ */
+typedef void (* ant_encryp_user_handler_t)(uint8_t channel, ant_encrypt_user_evt_t event);
+
+/**
+ * @brief Macro for initializing an ANT encryption information structure.
+ *
+ * @param[in] P_ENC_ID Pointer to the encryption ID of the device (4 bytes).
+ * @param[in] P_USER_INFO Pointer to the user information string (19 bytes).
+ * @param[in] P_RAND_NUM_SEED Pointer to the random number seed (16 bytes).
+ */
+#define ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, P_USER_INFO, P_RAND_NUM_SEED) \
+ { \
+ .items = \
+ { \
+ .p_encryption_id = P_ENC_ID, \
+ .p_user_info = P_USER_INFO, \
+ .p_random_num_seed = P_RAND_NUM_SEED \
+ } \
+ }
+
+/**
+ * @brief Macro for declaring the basic cryptographic configuration for the ANT stack.
+ *
+ * This macro configures the following settings:
+ * - Cryptographic key
+ * - Encryption ID
+ * - Advanced burst mode with the maximum RF payload size
+ *
+ * Use @ref ANT_ENCRYPT_STACK_SETTINGS_BASE to access the created configuration instance.
+ *
+ * @param[in] NAME Name for the created data instance.
+ * @param[in] P_KEY Pointer to the cryptographic key (16 bytes).
+ * @param[in] P_ENC_ID Pointer to the encryption ID (4 bytes).
+ */
+#define ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF(NAME, P_KEY, P_ENC_ID) \
+ ant_encrypt_adv_burst_settings_t NAME##_ant_enc_adv_burst_set = \
+ { \
+ .packet_length = ADV_BURST_MODES_MAX_SIZE, \
+ .required_feature = 0, \
+ .optional_feature = 0 \
+ }; \
+ uint8_t * pp_##NAME##_key[1] = {P_KEY}; \
+ ant_encrypt_stack_settings_t NAME ## _ant_crypto_settings = \
+ { \
+ .info = ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, NULL, NULL), \
+ .pp_key = pp_##NAME##_key, \
+ .key_number = 1, \
+ .p_adv_burst_config = &NAME##_ant_enc_adv_burst_set \
+ }
+
+
+/** @brief Macro for accessing the configuration instance created
+ * by @ref ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF.
+ *
+ * @param[in] NAME Name of the settings instance.
+ */
+#define ANT_ENCRYPT_STACK_SETTINGS_BASE(NAME) (NAME##_ant_crypto_settings)
+
+/**
+ * @brief Function for applying an encryption configuration to a slave channel.
+ *
+ * This function enables encryption on a channel.
+ *
+ * This function should be used by the @ref ant_encrypt_negotiation_slave module and this module.
+ *
+ * @param[in] channel_number ANT channel number.
+ * @param[in] p_crypto_config Pointer to the encryption configuration.
+ *
+ * @return Value returned by @ref sd_ant_crypto_channel_enable (for example, NRF_SUCCESS if
+ * the configuration was successful).
+ */
+ret_code_t ant_channel_encrypt_config_perform(uint8_t channel_number,
+ ant_encrypt_channel_settings_t * p_crypto_config);
+
+/**
+ * @brief Function for applying an encryption configuration to a master or slave channel.
+ *
+ * When called for a master channel, this function enables encryption
+ * for that channel. When called for a slave channel, it saves
+ * the encryption configuration for future use.
+ *
+ * This function should be used by the @ref ant_channel_config module.
+ *
+ * @param[in] channel_type ANT channel type: CHANNEL_TYPE_SLAVE or CHANNEL_TYPE_MASTER.
+ * @param[in] channel_num ANT channel number.
+ * @param[in] p_crypto_config Pointer to the encryption configuration.
+ *
+ * @retval NRF_SUCCESS If the function completed successfully.
+ * @retval NRF_ERROR_INVALID_PARAM If the channel type is invalid.
+ * @retval NRF_ERROR_MODULE_NOT_INITIALIZED If the stack is not configured for encryption.
+ * @retval Other Otherwise, the error value returned by the @ref
+ * ant_channel_encrypt_config_perform function is returned.
+ */
+ret_code_t ant_channel_encrypt_config(uint8_t channel_type,
+ uint8_t channel_num,
+ ant_encrypt_channel_settings_t * p_crypto_config);
+
+/**
+ * @brief Function for configuring the cryptographic settings of the ANT stack.
+ *
+ * @param[in] p_crypto_info_set Pointer to the settings.
+ */
+ret_code_t ant_stack_encryption_config(ant_encrypt_stack_settings_t const * const p_crypto_info_set);
+
+/**
+ * @brief Function for registering an event handler for ANT encryption events.
+ *
+ * The event handler should support all of the events in @ref ant_encrypt_user_evt_t.
+ *
+ * @param[in] p_handler Pointer to a handler function.
+ */
+void ant_enc_event_handler_register(ant_encryp_user_handler_t p_handler);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_ENCRYPT_CONFIG__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c
new file mode 100644
index 0000000..715fe14
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c
@@ -0,0 +1,185 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_ENCRYPT_NEGOTIATION_SLAVE)
+#include <stdlib.h>
+#include <string.h>
+#include "ant_encrypt_config.h"
+#include "ant_interface.h"
+#include "ant_parameters.h"
+#include "nrf_error.h"
+#include "app_error.h"
+
+#include "ant_encrypt_negotiation_slave.h"
+
+/** Number of supported channels. */
+#define NUMBER_OF_CHANNELS (NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED)
+
+/** Flag to block other channels from attempting to enable encryption while
+ * another encryption is in the process.
+ */
+static volatile bool m_can_enable_crypto = true;
+
+/** Array to keep track of which channels are currently tracking. */
+static ant_encrypt_tracking_state_t m_encrypt_channel_states[NUMBER_OF_CHANNELS];
+
+/** Array for the slave channels' encryption settings. */
+static ant_encrypt_channel_settings_t m_slave_channel_conf[MAX_ANT_CHANNELS];
+
+
+
+void ant_channel_encryp_tracking_state_set(uint8_t channel_number,
+ ant_encrypt_tracking_state_t state)
+{
+ m_encrypt_channel_states[channel_number] = state;
+}
+
+
+void ant_channel_encryp_negotiation_slave_init(void)
+{
+ for (uint32_t channel = 0; channel < NUMBER_OF_CHANNELS; channel++)
+ {
+ ant_channel_encryp_tracking_state_set(channel, ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED);
+ }
+
+ m_can_enable_crypto = true;
+}
+
+
+ant_encrypt_tracking_state_t ant_channel_encryp_tracking_state_get(uint8_t channel_number)
+{
+ return m_encrypt_channel_states[channel_number];
+}
+
+
+void ant_slave_channel_encrypt_config(uint8_t channel_number,
+ ant_encrypt_channel_settings_t const * const p_crypto_config)
+{
+ memcpy(&m_slave_channel_conf[channel_number], p_crypto_config,
+ sizeof(ant_encrypt_channel_settings_t));
+}
+
+
+/**@brief Function for handling ANT RX channel events.
+ *
+ * @param[in] p_event_message_buffer The ANT event message buffer.
+ */
+static void ant_slave_encrypt_try_enable(uint8_t ant_channel,
+ uint8_t ant_message_id)
+{
+ uint32_t err_code;
+ ant_encrypt_tracking_state_t track_stat;
+
+
+ switch (ant_message_id)
+ {
+ // Broadcast data received.
+ case MESG_BROADCAST_DATA_ID:
+
+ track_stat = ant_channel_encryp_tracking_state_get(ant_channel);
+ // If the encryption has not yet been negotiated for this channel and another channel
+ // is not currently trying to enable encryption, enable encryption
+ if ((track_stat != ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED)
+ && (track_stat != ANT_ENC_CHANNEL_STAT_NEGOTIATING)
+ && m_can_enable_crypto)
+ {
+ // Block other channels from trying to enable encryption until this channel
+ // is finished
+ m_can_enable_crypto = false;
+ ant_channel_encryp_tracking_state_set(ant_channel,
+ ANT_ENC_CHANNEL_STAT_NEGOTIATING);
+
+ // Enable encryption on ant_channel
+ err_code =
+ ant_channel_encrypt_config_perform(ant_channel,
+ &m_slave_channel_conf[ant_channel]);
+ APP_ERROR_CHECK(err_code);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void ant_slave_encrypt_negotiation(ant_evt_t * p_ant_evt)
+{
+ ant_encrypt_tracking_state_t track_state =
+ ant_channel_encryp_tracking_state_get(p_ant_evt->channel);
+
+ if (track_state == ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED)
+ return;
+
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX_FAIL_GO_TO_SEARCH:
+ if (track_state == ANT_ENC_CHANNEL_STAT_NEGOTIATING)
+ {
+ m_can_enable_crypto = true;
+ }
+
+ ant_channel_encryp_tracking_state_set(p_ant_evt->channel,
+ ANT_ENC_CHANNEL_STAT_NOT_TRACKING);
+ break;
+
+ case EVENT_RX:
+ ant_slave_encrypt_try_enable(p_ant_evt->channel,
+ p_ant_evt->message.ANT_MESSAGE_ucMesgID);
+ break;
+
+ case EVENT_ENCRYPT_NEGOTIATION_SUCCESS:
+ m_can_enable_crypto = true;
+ ant_channel_encryp_tracking_state_set(p_ant_evt->channel,
+ ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED);
+ break;
+
+ case EVENT_ENCRYPT_NEGOTIATION_FAIL:
+ m_can_enable_crypto = true;
+ ant_channel_encryp_tracking_state_set(p_ant_evt->channel,
+ ANT_ENC_CHANNEL_STAT_TRACKING_ENCRYPTED);
+ break;
+
+ default:
+ break;
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_ENCRYPT_NEGOTIATION_SLAVE)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h
new file mode 100644
index 0000000..253517d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_ENCRYPT_NEGOTIATION_SLAVE_H__
+#define ANT_ENCRYPT_NEGOTIATION_SLAVE_H__
+
+/**@file
+ *
+ * @defgroup ant_encrypt_negotiation_slave ANT encryption negotiation
+ * @{
+ * @ingroup ant_sdk_utils
+ *
+ * @brief Encryption negotiation for encrypted ANT slave channels.
+ *
+ * After pairing, the slave starts negotiating the encryption with the master. After
+ * successful negotiation, the slave can decrypt messages from the master, and all
+ * future messages are sent encrypted.
+ *
+ */
+
+#include <stdint.h>
+#include "nrf_sdh_ant.h"
+#include "ant_encrypt_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Encryption negotiation states for a slave channel. */
+typedef enum
+{
+ ANT_ENC_CHANNEL_STAT_NOT_TRACKING, ///< Not tracking the master.
+ ANT_ENC_CHANNEL_STAT_TRACKING_ENCRYPTED, ///< Tracking the master, but cannot decrypt messages.
+ ANT_ENC_CHANNEL_STAT_NEGOTIATING, ///< Encryption has been enabled and negotiation is in progress.
+ ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED, ///< Tracking the master and can decrypt messages.
+ ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED ///< Tracking unsupported on this channel.
+} ant_encrypt_tracking_state_t;
+
+
+/**
+ * @brief Function for setting the encryption negotiation state of a slave ANT channel.
+ *
+ * This function should be used by the @ref ant_encrypt_config module.
+ *
+ * @param[in] channel_number ANT channel number.
+ * @param[in] state State to set.
+ */
+void ant_channel_encryp_tracking_state_set(uint8_t channel_number,
+ ant_encrypt_tracking_state_t state);
+
+/**
+ * @brief Function for getting the encryption negotiation state of a slave ANT channel.
+ *
+ * @param[in] channel_number ANT channel number.
+ */
+ant_encrypt_tracking_state_t ant_channel_encryp_tracking_state_get(uint8_t channel_number);
+
+/**
+ * @brief Function for initializing the module.
+ *
+ * This function initializes internal states of the module. It should
+ * only be used by the @ref ant_encrypt_config module.
+ *
+ */
+void ant_channel_encryp_negotiation_slave_init(void);
+
+/**
+ * @brief Function for setting the configuration for the slave channel.
+ *
+ * This function saves the channel's encryption configuration to a lookup table (LUT) for
+ * future usage. The configuration can then be used to enable encryption.
+ *
+ * This function is intended to be used by the @ref ant_encrypt_config module.
+ *
+ * @param[in] channel_number ANT channel number.
+ * @param[in] p_crypto_config Pointer to the encryption configuration.
+ */
+void ant_slave_channel_encrypt_config(uint8_t channel_number,
+ ant_encrypt_channel_settings_t const * const p_crypto_config);
+
+
+/**
+ * @brief Function for handling ANT encryption negotiation on slave nodes.
+ *
+ * This function should be used directly in the ANT event dispatching process. It
+ * tries to enable slave channel encryption for all slave channels that are declared
+ * as encrypted channels (if appropriate master channels are found).
+ *
+ * This function should be used by the @ref ant_encrypt_config module.
+ *
+ * @param[in] p_ant_evt Pointer to the ANT stack event message structure.
+ */
+void ant_slave_encrypt_negotiation(ant_evt_t * p_ant_evt);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_ENCRYPT_NEGOTIATION_SLAVE_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.c
new file mode 100644
index 0000000..6c46f32
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.c
@@ -0,0 +1,2379 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2012
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANTFS)
+
+#include "antfs.h"
+#include <string.h>
+#include "defines.h"
+#include "app_error.h"
+#include "app_timer.h"
+#include "ant_error.h"
+#include "ant_parameters.h"
+#include "ant_interface.h"
+#include "ant_key_manager.h"
+#include "crc.h"
+
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ #include "bsp.h"
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+
+#define BURST_PACKET_SIZE 8u /**< The burst packet size. */
+
+#define ANTFS_CONNECTION_TYPE_OFFSET 0x00u /**< The connection type offset within ANT-FS message. */
+#define ANTFS_COMMAND_OFFSET 0x01u /**< The command offset within ANT-FS message. */
+#define ANTFS_RESPONSE_OFFSET 0x01u /**< The response offset within ANT-FS message. */
+
+#define ANTFS_CONTROL_OFFSET 0x02u /**< The control offset within ANT-FS message. */
+#define ANTFS_DATA_OFFSET 0x03u /**< The data offset within ANT-FS message. */
+
+#define ANTFS_BEACON_ID 0x43u /**< The ANT-FS beacon ID. */
+#define ANTFS_COMMAND_ID 0x44u /**< The ANT-FS command ID. */
+
+// Beacon definitions.
+#define STATUS1_OFFSET 0x01u /**< The beacon status1 field offset. */
+#define STATUS2_OFFSET 0x02u /**< The beacon status2 field offset. */
+ #define DEVICE_STATE_SHIFT 0x00u /**< Shift value for device state bitfield. */
+ #define DEVICE_STATE_MASK (0x0Fu << DEVICE_STATE_SHIFT) /**< Device state bitmask. */
+ #define DEVICE_STATE_LINK (0x00u << DEVICE_STATE_SHIFT) /**< Device is in link state. */
+ #define DEVICE_STATE_AUTHENTICATE (0x01u << DEVICE_STATE_SHIFT) /**< Device is in authenticate state. */
+ #define DEVICE_STATE_TRANSPORT (0x02u << DEVICE_STATE_SHIFT) /**< Device is in transport state. */
+ #define DEVICE_STATE_BUSY (0x03u << DEVICE_STATE_SHIFT) /**< Device is in busy state. */
+
+#define DEVICE_DESCRIPTOR_OFFSET_0 0x04u /**< Beacon ANT-FS device descriptor LSB position. */
+#define DEVICE_DESCRIPTOR_OFFSET_1 0x05u /**< Beacon ANT-FS device descriptor LSB + 1 position. */
+#define DEVICE_DESCRIPTOR_OFFSET_2 0x06u /**< Beacon ANT-FS device descriptor LSB + 2 position. */
+#define DEVICE_DESCRIPTOR_OFFSET_3 0x07u /**< Beacon ANT-FS device descriptor MSB position. */
+
+// Commands.
+#define ANTFS_CMD_NONE 0x00u /**< Used to identify that no ANT-FS command is in progress. */
+#define ANTFS_CMD_LINK_ID 0x02u /**< ANT-FS link command ID. */
+#define ANTFS_CMD_DISCONNECT_ID 0x03u /**< ANT-FS disconnect command ID. */
+#define ANTFS_CMD_AUTHENTICATE_ID 0x04u /**< ANT-FS authenticate command ID. */
+#define ANTFS_CMD_PING_ID 0x05u /**< ANT-FS ping command ID. */
+#define ANTFS_CMD_DOWNLOAD_ID 0x09u /**< ANT-FS download request command ID. */
+#define ANTFS_CMD_UPLOAD_REQUEST_ID 0x0Au /**< ANT-FS upload request command ID. */
+#define ANTFS_CMD_ERASE_ID 0x0Bu /**< ANT-FS erase request command ID. */
+#define ANTFS_CMD_UPLOAD_DATA_ID 0x0Cu /**< ANT-FS upload command ID. */
+
+// Responses.
+#define ANTFS_RSP_AUTHENTICATE_ID 0x84u /**< ANT-FS authenticate response command ID. */
+#define ANTFS_RSP_DOWNLOAD_ID 0x89u /**< ANT-FS download request response command ID. */
+#define ANTFS_RSP_UPLOAD_REQ_ID 0x8Au /**< ANT-FS upload request response command ID. */
+#define ANTFS_RSP_ERASE_ID 0x8Bu /**< ANT-FS erase response command ID. */
+#define ANTFS_RSP_UPLOAD_DATA_ID 0x8Cu /**< ANT-FS upload data response command ID. */
+
+// Link command.
+#define TRANSPORT_CHANNEL_FREQUENCY_OFFSET 0x02u /**< Channel frequency field offset within link command. */
+#define TRANSPORT_MESSAGE_PERIOD_OFFSET 0x03u /**< Channel period field offset within link command. */
+#define HOST_ID_OFFSET_0 0x04u /**< Host serial number period field LSB offset within link command. */
+#define HOST_ID_OFFSET_1 0x05u /**< Host serial number period field LSB + 1 offset within link command. */
+#define HOST_ID_OFFSET_2 0x06u /**< Host serial number period field LSB + 2 offset within link command. */
+#define HOST_ID_OFFSET_3 0x07u /**< Host serial number period field MSB offset within link command. */
+
+// Authenticate command.
+#define COMMAND_TYPE_OFFSET 0x02u /**< Command type field offset within authenticate command. */
+ #define COMMAND_TYPE_PROCEED 0x00u /**< Command type proceed to transport in the authenticate command. */
+ #define COMMAND_TYPE_REQUEST_SERIAL 0x01u /**< Command type request client device serial number in the authenticate command. */
+ #define COMMAND_TYPE_REQUEST_PAIR 0x02u /**< Command type request pairing in the authenticate command. */
+ #define COMMAND_TYPE_REQUEST_PASSKEY 0x03u /**< Command type request passkey exchange in the authenticate command. */
+
+// Authenticate response.
+#define RESPONSE_TYPE_OFFSET 0x02u /**< Command type field offset within authenticate response command. */
+ #define AUTH_RESPONSE_N_A 0x00u /**< Command response type N/A (response for client serial number request). */
+ #define AUTH_RESPONSE_ACCEPT 0x01u /**< Command response type accept. */
+ #define AUTH_RESPONSE_REJECT 0x02u /**< Command response type reject. */
+
+// Authenticate command/response.
+#define AUTH_STRING_LENGTH_OFFSET 0x03u /**< Authenticate Command/Response authentication string length offset. */
+#define SERIAL_NUMBER_OFFSET_0 0x04u /**< Authenticate Command/Response client/host serial number LSB offset. */
+#define SERIAL_NUMBER_OFFSET_1 0x05u /**< Authenticate Command/Response client/host serial number LSB + 1 offset. */
+#define SERIAL_NUMBER_OFFSET_2 0x06u /**< Authenticate Command/Response client/host serial number LSB + 2 offset. */
+#define SERIAL_NUMBER_OFFSET_3 0x07u /**< Authenticate Command/Response client/host serial number MSB offset. */
+
+// Download/Upload/Erase commands.
+#define INITIAL_REQUEST_OFFSET 0x01u /**< Download/Upload/Erase command initial request command offset. */
+#define DATA_INDEX_OFFSET_LOW 0x02u /**< Download/Upload/Erase command offset index low. */
+#define DATA_INDEX_OFFSET_HIGH 0x03u /**< Download/Upload/Erase command offset index high. */
+
+#define ADDRESS_PARAMETER_OFFSET_0 0x04u /**< Download/Upload command parameter LSB offset. */
+#define ADDRESS_PARAMETER_OFFSET_1 0x05u /**< Download/Upload command parameter LSB + 1 offset. */
+#define ADDRESS_PARAMETER_OFFSET_2 0x06u /**< Download/Upload command parameter LSB + 2 offset. */
+#define ADDRESS_PARAMETER_OFFSET_3 0x07u /**< Download/Upload command parameter MSB offset. */
+#define UPLOAD_CRC_OFFSET_LOW 0x06u /**< Upload data CRC offset low. */
+#define UPLOAD_CRC_OFFSET_HIGH 0x07u /**< Upload data CRC offset high. */
+
+// Authentication type. The highest level of authentication available is included in the beacon.
+#if ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+ #define AUTHENTICATION_TYPE COMMAND_TYPE_REQUEST_PASSKEY /**< Passkey and pairing only mode set as authentication type in beacon. */
+#elif ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+ #define AUTHENTICATION_TYPE COMMAND_TYPE_REQUEST_PAIR /**< Pairing only mode set as authentication type in beacon. */
+#elif ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED
+ #define AUTHENTICATION_TYPE COMMAND_TYPE_PROCEED /**< Pass-through mode set as authentication type in beacon. */
+#else
+ #error "No valid auth type defined"
+#endif
+
+#define AUTHENTICATION_RETRIES 0x05u /**< Max number of retries for authentication responses */
+
+#define ANTFS_EVENT_QUEUE_SIZE 0x04u /**< ANT-FS event queue size. */
+#define SAVE_DISTANCE 256u /**< Save distance required because of nRF buffer to line up data offset on retry. */
+
+// Buffer Indices.
+#define BUFFER_INDEX_MESG_SIZE 0x00u /**< ANT message buffer index length offset. */
+#define BUFFER_INDEX_MESG_ID 0x01u /**< ANT message buffer index ID offset. */
+#define BUFFER_INDEX_CHANNEL_NUM 0x02u /**< ANT message buffer index channel number offset. */
+#define BUFFER_INDEX_MESG_DATA 0x03u /**< ANT message buffer index begin of data offset. */
+#define BUFFER_INDEX_RESPONSE_CODE 0x04u /**< ANT message buffer index response code offset. */
+
+typedef struct
+{
+ char friendly_name[ANTFS_FRIENDLY_NAME_MAX]; /**< Friendly Name. */
+ bool is_name_set; /**< Is the name set. */
+ uint32_t index; /**< Current index (for reading the friendly name). */
+ uint32_t friendly_name_size; /**< Friendly name size. */
+} friendly_name_t;
+
+typedef union
+{
+ antfs_link_substate_t link_sub_state; /**< Sub-state (Link layer). */
+ antfs_authenticate_substate_t auth_sub_state; /**< Sub-state (Authentication layer). */
+ antfs_transport_substate_t trans_sub_state; /**< Sub-state (Transport layer). */
+} antfs_substate_t;
+
+typedef struct
+{
+ antfs_state_t state; /**< ANT-FS state. */
+ antfs_substate_t sub_state; /**< ANT-FS sub-state. */
+} antfs_states_t;
+
+typedef struct
+{
+ antfs_event_return_t * p_queue; /**< ANT-FS event queue. */
+ uint32_t head; /**< ANT-FS event queue head index. */
+ uint32_t tail; /**< ANT-FS event queue tail index. */
+} antfs_event_queue_t;
+
+static antfs_params_t m_initial_parameters; /**< Initial parameters. */
+static antfs_beacon_status_byte1_t m_active_beacon_status1_field; /**< Status 1 field in beacon. */
+static uint32_t m_active_beacon_frequency; /**< Active beacon frequency. */
+static antfs_states_t m_current_state; /**< Current state. */
+static friendly_name_t m_friendly_name; /**< Host's friendly name. */
+static ulong_union_t m_link_host_serial_number; /**< Host's serial number. */
+static uint32_t m_link_command_in_progress; /**< ANT-FS command in progress. */
+static uint32_t m_authenticate_command_type; /**< Authenticate command type in progress. */
+static volatile uint8_t m_burst_wait; /**< Polling status flag for data unlock on burst handler input. */
+static uint8_t m_retry; /**< Retry counter */
+APP_TIMER_DEF(m_timer_id); /**< Timer ID used with the timer module. */
+
+#if ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+ static uint32_t m_passkey_index; /**< Current location of Tx block (auth string). */
+#endif // ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+
+// Download/upload.
+static bool m_is_data_request_pending; /**< Requested data pending. */
+static bool m_is_crc_pending; /**< CRC for data packets pending. */
+static ushort_union_t m_file_index; /**< File index of current upload/download. */
+static ulong_union_t m_file_size; /**< File size of current upload/download (bytes). */
+static ulong_union_t m_max_block_size; /**< Maximum number of bytes expected to be downloaded in a single burst block of data (set by host). */
+static ulong_union_t m_link_burst_index; /**< Current location of Tx block (bytes). */
+static ulong_union_t m_bytes_remaining; /**< Total remaining data length (bytes). */
+static ulong_union_t m_max_transfer_index; /**< Upper limit of the current Tx burst block (bytes). */
+static uint32_t m_bytes_to_write; /**< Number of bytes to write to file (upload). */
+static const uint8_t * mp_upload_data; /**< Address of begin of the buffer that holds data received from upload. */
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ static ulong_union_t m_block_size; /**< Number of bytes the client can receive in a single burst. */
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+
+// CRC verification.
+static uint32_t m_saved_crc_offset; /**< CRC data offset (bytes) saved at last CRC update (save point). */
+static uint32_t m_saved_buffer_crc_offset; /**< Data offset to track how much data has been buffered into nRF */
+static uint32_t m_temp_crc_offset; /**< Temporary CRC data offset used in CRC calculation. */
+static uint16_t m_compared_crc; /**< 16-bit CRC for all data packets in the block (provided by download request). */
+static uint16_t m_transfer_crc; /**< 16-bit CRC for all data packets in the block (calculated by client). */
+static uint16_t m_saved_transfer_crc; /**< 16-bit CRC saved at last CRC update (save point). */
+static uint16_t m_saved_buffer_crc; /**< 16-bit CRC saved at last CRC update (save point) for buffering the nRF */
+
+// ANT-FS event handling.
+static antfs_event_return_t m_event_queue_buffer[ANTFS_EVENT_QUEUE_SIZE]; /**< Event queue storage. */
+static antfs_event_queue_t m_event_queue; /**< Event queue. */
+
+static antfs_burst_wait_handler_t m_burst_wait_handler = NULL; /**< Burst wait handler */
+
+
+const char * antfs_hostname_get(void)
+{
+ if (m_friendly_name.is_name_set)
+ {
+ return (m_friendly_name.friendly_name);
+ }
+
+ return NULL;
+}
+
+
+/**@brief Function for waiting for the burst transmission request to complete.
+ */
+static void wait_burst_request_to_complete(void)
+{
+ while (m_burst_wait != 0)
+ {
+ if (m_burst_wait_handler != NULL)
+ {
+ m_burst_wait_handler();
+ }
+ };
+}
+
+
+/**@brief Function for stopping ANT-FS timeout, which is possibly currently running.
+ */
+static void timeout_disable(void)
+{
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+
+ const uint32_t err_code = app_timer_stop(m_timer_id);
+ APP_ERROR_CHECK(err_code);
+}
+
+
+/**@brief Function for transmitting a beacon.
+ *
+ * Transmits a beacon either using a broadcast or burst transmission mode.
+ *
+ * @param[in] message_type Defines the used transmission mode.
+ */
+static void beacon_transmit(uint32_t message_type)
+{
+ uint8_t beacon_status_byte2;
+
+ // Set beacon status byte 2.
+
+ if (m_link_command_in_progress == ANTFS_CMD_NONE)
+ {
+ switch (m_current_state.state)
+ {
+ case ANTFS_STATE_AUTH:
+ beacon_status_byte2 = DEVICE_STATE_AUTHENTICATE;
+ break;
+
+ case ANTFS_STATE_TRANS:
+ beacon_status_byte2 = DEVICE_STATE_TRANSPORT;
+ break;
+
+ default:
+ beacon_status_byte2 = DEVICE_STATE_LINK;
+ break;
+ }
+ }
+ else
+ {
+ beacon_status_byte2 = DEVICE_STATE_BUSY;
+ }
+
+ // Set remaining beacon fields.
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ tx_buffer[0] = ANTFS_BEACON_ID;
+ tx_buffer[1] = m_active_beacon_status1_field.status;
+ tx_buffer[2] = beacon_status_byte2;
+ tx_buffer[3] = AUTHENTICATION_TYPE;
+
+ if ((m_current_state.state == ANTFS_STATE_AUTH) ||
+ (m_current_state.state == ANTFS_STATE_TRANS))
+ {
+ tx_buffer[4] = m_link_host_serial_number.bytes.byte0;
+ tx_buffer[5] = m_link_host_serial_number.bytes.byte1;
+ tx_buffer[6] = m_link_host_serial_number.bytes.byte2;
+ tx_buffer[7] = m_link_host_serial_number.bytes.byte3;
+ }
+ else
+ {
+ tx_buffer[4] = m_initial_parameters.beacon_device_type;
+ tx_buffer[5] = (m_initial_parameters.beacon_device_type >> 8u);
+ tx_buffer[6] = m_initial_parameters.beacon_device_manufacturing_id;
+ tx_buffer[7] = (m_initial_parameters.beacon_device_manufacturing_id >> 8u);
+ }
+
+ if (message_type == MESG_BROADCAST_DATA_ID)
+ {
+ if (sd_ant_broadcast_message_tx(ANTFS_CONFIG_CHANNEL_NUMBER, sizeof(tx_buffer), tx_buffer) != NRF_SUCCESS)
+ {
+ // @note: No implementation needed, as it is a valid and accepted use case for this call
+ // to fail. This call can fail if we are in middle of bursting.
+ }
+ }
+ else if (message_type == MESG_BURST_DATA_ID)
+ {
+ // Send as the first packet of a burst.
+ const uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_START);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ // This is the first packet of a burst response, disable command timeout while bursting.
+ timeout_disable();
+ }
+ else
+ {
+ // This should not happen.
+ APP_ERROR_HANDLER(message_type);
+ }
+}
+
+
+/**@brief Function for transmitting a authenticate response message.
+ *
+ * @param[in] response_type Authenticate response code.
+ * @param[in] password_length Length of authentication string.
+ * @param[in] p_password Authentication string transmitted.
+ */
+static void authenticate_response_transmit(uint8_t response_type,
+ uint32_t password_length,
+ const uint8_t * p_password)
+{
+ ulong_union_t serial_number;
+
+ serial_number.data = m_initial_parameters.client_serial_number;
+
+ // First packet is beacon.
+ beacon_transmit(MESG_BURST_DATA_ID);
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ tx_buffer[ANTFS_CONNECTION_TYPE_OFFSET] = ANTFS_COMMAND_ID;
+ tx_buffer[ANTFS_RESPONSE_OFFSET] = ANTFS_RSP_AUTHENTICATE_ID;
+ tx_buffer[RESPONSE_TYPE_OFFSET] = response_type;
+ tx_buffer[AUTH_STRING_LENGTH_OFFSET] = password_length;
+ tx_buffer[SERIAL_NUMBER_OFFSET_0] = serial_number.bytes.byte0;
+ tx_buffer[SERIAL_NUMBER_OFFSET_1] = serial_number.bytes.byte1;
+ tx_buffer[SERIAL_NUMBER_OFFSET_2] = serial_number.bytes.byte2;
+ tx_buffer[SERIAL_NUMBER_OFFSET_3] = serial_number.bytes.byte3;
+
+ uint32_t err_code;
+ if ((m_current_state.state == ANTFS_STATE_AUTH) &&
+ (
+ (response_type != AUTH_RESPONSE_REJECT) &&
+ password_length &&
+ (password_length <= ANTFS_AUTH_STRING_MAX)
+ )
+ )
+ {
+ // Send second packet (auth response).
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_CONTINUE);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ // Round size to a multiple of 8 bytes.
+ uint8_t tx_buffer_authenticate[ANTFS_AUTH_STRING_MAX + 1u];
+
+ memset(tx_buffer_authenticate, 0, ANTFS_AUTH_STRING_MAX + 1u);
+ memcpy(tx_buffer_authenticate, p_password, password_length);
+
+ // Round up total number bytes to a multiple of 8 to be sent to burst handler.
+ if (password_length & (BURST_PACKET_SIZE - 1u))
+ {
+ password_length &= ~(BURST_PACKET_SIZE - 1u);
+ password_length += BURST_PACKET_SIZE;
+ }
+
+ // Send auth string (last packets of the burst).
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ password_length,
+ tx_buffer_authenticate,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ m_link_command_in_progress = ANTFS_RSP_AUTHENTICATE_ID;
+ }
+ else
+ {
+ // If the authorization is rejected or there is no valid password, the auth response is the
+ // last packet.
+
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+ }
+
+ // Switch to appropiate state.
+ if (response_type == AUTH_RESPONSE_REJECT)
+ {
+ m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_REJECT;
+ }
+ else if (response_type == AUTH_RESPONSE_ACCEPT)
+ {
+ m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_ACCEPT;
+ }
+ else
+ {
+ // No implementation needed.
+ }
+}
+
+
+bool antfs_pairing_resp_transmit(bool accept)
+{
+#if ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+ // This function should only be called when ANT-FS is in PAIRING mode.
+ if ((m_current_state.state != ANTFS_STATE_AUTH) ||
+ (m_current_state.sub_state.auth_sub_state != ANTFS_AUTH_SUBSTATE_PAIR))
+ {
+ return false;
+ }
+
+ m_link_command_in_progress = ANTFS_CMD_AUTHENTICATE_ID;
+
+ if (accept)
+ {
+ // Accept request and send passkey if authentication passed.
+ authenticate_response_transmit(AUTH_RESPONSE_ACCEPT,
+ ANTFS_PASSKEY_SIZE,
+ m_initial_parameters.p_pass_key);
+ }
+ else
+ {
+ // Reject authentication request.
+ authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL);
+ }
+
+ return true;
+#else
+ return false;
+#endif // ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+}
+
+
+/**@brief Function for adding an ANT-FS event to the event queue.
+ *
+ * @param[in] event_code The event to be added.
+ */
+static void event_queue_write(antfs_event_t event_code)
+{
+ antfs_event_return_t * p_event = NULL;
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ uint32_t err_code;
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+
+ // Check if there is room in the queue for a new event.
+ if (((m_event_queue.head + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u)) != m_event_queue.tail)
+ {
+ p_event = &(m_event_queue.p_queue[m_event_queue.head]);
+ }
+
+ if (p_event != NULL)
+ {
+ // Initialize event parameters.
+ p_event->event = event_code;
+
+ // Set parameters depending on event type.
+ switch (event_code)
+ {
+ case ANTFS_EVENT_ERASE_REQUEST:
+ p_event->file_index = m_file_index.data;
+ p_event->offset = 0;
+ p_event->bytes = 0;
+ p_event->crc = 0;
+ break;
+
+ case ANTFS_EVENT_DOWNLOAD_REQUEST:
+ p_event->file_index = m_file_index.data;
+ // Requested offset for the download.
+ p_event->offset = m_link_burst_index.data;
+ p_event->bytes = 0;
+ p_event->crc = 0;
+ break;
+
+ case ANTFS_EVENT_DOWNLOAD_REQUEST_DATA:
+ p_event->file_index = m_file_index.data;
+ // Current offset.
+ p_event->offset = m_link_burst_index.data;
+
+ if (m_bytes_remaining.data > (ANTFS_BURST_BLOCK_SIZE * BURST_PACKET_SIZE))
+ {
+ // If remaining bytes > burst block size then grab one block at a time.
+ p_event->bytes = ANTFS_BURST_BLOCK_SIZE * BURST_PACKET_SIZE;
+ }
+ else
+ {
+ p_event->bytes = m_bytes_remaining.data;
+ }
+
+ p_event->crc = 0;
+ break;
+
+ case ANTFS_EVENT_UPLOAD_REQUEST:
+ p_event->file_index = m_file_index.data;
+ // Requested offset for the upload.
+ p_event->offset = m_link_burst_index.data;
+ // Upper limit of the download (offset + remaining bytes).
+ p_event->bytes = m_max_transfer_index.data;
+ // CRC Seed (from last save point if resuming).
+ p_event->crc = m_transfer_crc;
+ break;
+
+ case ANTFS_EVENT_UPLOAD_DATA:
+ p_event->file_index = m_file_index.data;
+ // Current offset.
+ p_event->offset = m_link_burst_index.data;
+ // Current CRC.
+ p_event->crc = m_transfer_crc;
+ // Number of bytes to write.
+ p_event->bytes = m_bytes_to_write;
+ // Upload to appication data buffer.
+ memcpy(p_event->data, mp_upload_data, m_bytes_to_write);
+ break;
+
+ case ANTFS_EVENT_PAIRING_REQUEST:
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ err_code = bsp_indication_set(BSP_INDICATE_BONDING);
+ APP_ERROR_CHECK(err_code);
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+ break;
+
+ default:
+ // No parameters need to be set.
+
+ p_event->file_index = 0;
+ p_event->offset = 0;
+ p_event->bytes = 0;
+ p_event->crc = 0;
+ break;
+ }
+
+ // Put the event in the queue.
+ m_event_queue.head = ((m_event_queue.head + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u));
+ }
+ else
+ {
+ // No free space left in the queue.
+ APP_ERROR_HANDLER(0);
+ }
+}
+
+
+/**@brief Function for transmitting download request response message.
+ *
+ * @param[in] response Download response code.
+ */
+static void download_request_response_transmit(uint8_t response)
+{
+ // First burst packet is beacon.
+ beacon_transmit(MESG_BURST_DATA_ID);
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ // Next send the first part of the download response.
+ tx_buffer[0] = ANTFS_COMMAND_ID;
+ tx_buffer[1] = ANTFS_RSP_DOWNLOAD_ID;
+ tx_buffer[2] = response;
+ tx_buffer[3] = 0;
+ // Total number of bytes remaining in the data block.
+ tx_buffer[4] = m_bytes_remaining.bytes.byte0;
+ tx_buffer[5] = m_bytes_remaining.bytes.byte1;
+ tx_buffer[6] = m_bytes_remaining.bytes.byte2;
+ tx_buffer[7] = m_bytes_remaining.bytes.byte3;
+
+ uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_CONTINUE);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ // Second part of the download response.
+
+ // The offset the data will start from in this block.
+ tx_buffer[0] = m_link_burst_index.bytes.byte0;
+ tx_buffer[1] = m_link_burst_index.bytes.byte1;
+ tx_buffer[2] = m_link_burst_index.bytes.byte2;
+ tx_buffer[3] = m_link_burst_index.bytes.byte3;
+ // The file size in the client device.
+ tx_buffer[4] = m_file_size.bytes.byte0;
+ tx_buffer[5] = m_file_size.bytes.byte1;
+ tx_buffer[6] = m_file_size.bytes.byte2;
+ tx_buffer[7] = m_file_size.bytes.byte3;
+
+ if (response || (m_bytes_remaining.data == 0))
+ {
+ // If the download was rejected or there is no data to send.
+
+ // Set response to end since we're not downloading any data.
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+ }
+ else
+ {
+ // Response will continue (data packets + CRC footer to follow).
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_CONTINUE);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+ }
+
+ m_link_command_in_progress = ANTFS_CMD_DOWNLOAD_ID;
+
+ if (response == 0)
+ {
+ // If we are going to download (response OK), enter the downloading substate.
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_DOWNLOADING;
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_START);
+ }
+ else
+ {
+ // Download rejected.
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_FAIL);
+ }
+}
+
+
+void antfs_download_req_resp_prepare(uint8_t response,
+ const antfs_request_info_t * const p_request_info)
+{
+ // This function should only be called after receiving a download request.
+ APP_ERROR_CHECK_BOOL((m_current_state.state == ANTFS_STATE_TRANS) &&
+ (m_link_command_in_progress == ANTFS_CMD_DOWNLOAD_ID));
+
+ if (response == 0)
+ {
+ // Download request OK.
+
+ // File size of the requested download.
+ m_file_size.data = p_request_info->file_size.data;
+
+ if (m_link_burst_index.data > m_file_size.data)
+ {
+ // Offset should not exceed file size.
+ m_link_burst_index.data = m_file_size.data;
+ }
+
+ // If the host is not limiting download size or the file size does not exceed the host's
+ // download size limit.
+ if ((m_max_block_size.data == 0) || (m_file_size.data < m_max_block_size.data))
+ {
+ // Number of bytes remaining to be downloaded in this block is the file size.
+ m_bytes_remaining.data = m_file_size.data;
+ }
+
+ if ((m_file_size.data - m_link_burst_index.data) < m_bytes_remaining.data)
+ {
+ // Calculate number of remaining bytes in this block based on the offset.
+ m_bytes_remaining.data = m_file_size.data - m_link_burst_index.data;
+ }
+
+ // If the application is limiting the Tx block size.
+ if (m_bytes_remaining.data > p_request_info->max_burst_block_size.data)
+ {
+ // Number of remaining bytes in this block is the application defined block size.
+ m_bytes_remaining.data = p_request_info->max_burst_block_size.data;
+ }
+
+ // Find upper limit of the burst Tx.
+ m_max_transfer_index.data = m_link_burst_index.data + m_bytes_remaining.data;
+
+ if (m_saved_crc_offset == ANTFS_MAX_FILE_SIZE)
+ {
+ // CRC checking was set as invalid. An invalid download was requested, so reject it.
+ response = RESPONSE_INVALID_OPERATION;
+ }
+ }
+
+ if ((response != 0) || (m_file_size.data == 0))
+ {
+ // Send the response right away if the download request was rejected or there is no data to
+ // send.
+ download_request_response_transmit(response);
+ }
+ else
+ {
+ // Proceed to download data.
+ if (m_link_burst_index.data != m_saved_crc_offset)
+ {
+ uint32_t temp;
+
+ // If requesting to resume exactly where we left off, we can start from the same block.
+ if (m_link_burst_index.data == m_temp_crc_offset)
+ {
+ // Move last save point to end of last block sent.
+ m_saved_crc_offset = m_link_burst_index.data;
+ m_saved_transfer_crc = m_transfer_crc;
+ }
+
+ // To resume the download, request a block of data starting from the last save point.
+ // Update the remaining number of bytes per the last save point.
+ m_bytes_remaining.data += (m_link_burst_index.data - m_saved_crc_offset);
+
+ // Swap the current burst Tx index with the saved CRC index, to make sure we do not
+ // start updating the CRC until we get to the requested index.
+ temp = m_link_burst_index.data;
+ m_link_burst_index.data = m_saved_crc_offset;
+ m_saved_crc_offset = temp;
+
+ // Set CRC to previous save point, to check the CRC provided by the host.
+ m_transfer_crc = m_saved_transfer_crc;
+ }
+
+ m_temp_crc_offset = m_saved_crc_offset;
+
+ m_is_data_request_pending = true;
+
+ // Request data from application.
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA);
+
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC;
+ }
+}
+
+
+uint32_t antfs_input_data_download(uint16_t index,
+ uint32_t offset,
+ uint32_t num_bytes,
+ const uint8_t * const p_message)
+{
+ // Verify that this is the requested data.
+ APP_ERROR_CHECK_BOOL((offset == m_link_burst_index.data) && (index == m_file_index.data));
+
+ // If file offset is greater than the upper limit, this is not data we need.
+ APP_ERROR_CHECK_BOOL(offset <= m_max_transfer_index.data);
+
+ if ((m_current_state.state == ANTFS_STATE_TRANS) &&
+ (
+ (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_VERIFY_CRC) ||
+ // Only send data if we were processing a download request.
+ (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_DOWNLOADING)
+ )
+ )
+ {
+ uint32_t block_offset = 0;
+
+ if (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_VERIFY_CRC)
+ {
+ // Make sure download_request_response_transmit defaults to RESPONSE_INVALID_CRC.
+ uint32_t response = RESPONSE_MESSAGE_OK;
+
+ // Check CRC.
+ if (m_link_burst_index.data == m_saved_crc_offset)
+ {
+ // If indexes match, we can compare CRC directly.
+ if (m_transfer_crc != m_compared_crc)
+ {
+ response = RESPONSE_INVALID_CRC;
+ }
+ else
+ {
+ // Set up the save point
+ m_temp_crc_offset = m_link_burst_index.data; // Reset save point counter
+ m_saved_crc_offset = m_link_burst_index.data;
+ m_saved_buffer_crc_offset = m_link_burst_index.data;
+
+ // Set up the CRC save points
+ m_saved_transfer_crc = m_compared_crc;
+ m_saved_buffer_crc = m_compared_crc;
+ m_is_crc_pending = true;
+ }
+ // Start bursting beacon and the download response (3 burst packets).
+ download_request_response_transmit(response);
+ }
+ // If the data is in this block, advance to the requested offset
+ else if ((m_link_burst_index.data < m_saved_crc_offset) &&
+ ((m_saved_crc_offset - m_link_burst_index.data) < num_bytes))
+ {
+ // Update the offset within this block for the requested transmission.
+ block_offset = m_saved_crc_offset - m_link_burst_index.data;
+ // Update the number of bytes that will actually be transmitted.
+ num_bytes -= block_offset;
+
+ // Update CRC calculation up to requested index.
+ m_transfer_crc = crc_crc16_update(m_transfer_crc, p_message, block_offset);
+ // Update the remaining number of bytes.
+ m_bytes_remaining.data -= block_offset;
+
+ // Check CRC
+ if (m_transfer_crc != m_compared_crc)
+ {
+ response = RESPONSE_INVALID_CRC;
+ }
+ else
+ {
+ // Move index back to point where transmission will resume.
+ m_link_burst_index.data = m_saved_crc_offset;
+
+ // Set up the save point
+ m_temp_crc_offset = m_link_burst_index.data; // Reset save point counter
+ m_saved_buffer_crc_offset = m_link_burst_index.data;
+
+ // Set up the CRC save points
+ m_saved_transfer_crc = m_compared_crc;
+ m_saved_buffer_crc = m_compared_crc;
+
+ m_is_crc_pending = true;
+ }
+ download_request_response_transmit(response);
+ }
+ // Data index has gone too far and it is not possible to check CRC, fail and let host retry
+ else if (m_link_burst_index.data > m_saved_crc_offset)
+ {
+ response = RESPONSE_INVALID_CRC;
+ download_request_response_transmit(response);
+ }
+ // Keep getting data and recalculate the CRC until the indexes match
+ else
+ {
+ m_is_data_request_pending = false;
+
+ // Update the current burst index and bytes remaining
+ m_link_burst_index.data += num_bytes;
+ m_bytes_remaining.data -= num_bytes;
+
+ // Update CRC
+ m_transfer_crc = crc_crc16_update(m_transfer_crc, p_message, num_bytes);
+
+ // Request more data.
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA);
+ }
+ }
+
+ // Append data.
+ if (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_DOWNLOADING)
+ {
+ uint32_t num_of_bytes_to_burst = num_bytes;
+
+ if (num_of_bytes_to_burst & (BURST_PACKET_SIZE - 1u))
+ {
+ // Round up total number bytes to a multiple of BURST_PACKET_SIZE to be sent to
+ // burst handler.
+ num_of_bytes_to_burst &= ~(BURST_PACKET_SIZE - 1u);
+ num_of_bytes_to_burst += BURST_PACKET_SIZE;
+ }
+
+ uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ num_of_bytes_to_burst,
+ (uint8_t*)&(p_message[block_offset]),
+ BURST_SEGMENT_CONTINUE);
+ if (err_code != NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR)
+ {
+ // If burst failed before we are able to catch it, we will get a TRANSFER_SEQUENCE_NUMBER_ERROR
+ // The message processing will send client back to correct state
+ APP_ERROR_CHECK(err_code);
+ }
+
+ wait_burst_request_to_complete();
+
+ // Update current burst index.
+ m_link_burst_index.data += num_bytes;
+ // Update remaining bytes.
+ m_bytes_remaining.data -= num_bytes;
+
+ m_is_data_request_pending = false;
+
+ m_transfer_crc = crc_crc16_update(m_transfer_crc,
+ &(p_message[block_offset]),
+ num_bytes);
+
+ if ((m_link_burst_index.data - m_temp_crc_offset) > SAVE_DISTANCE)
+ {
+ // Set CRC save point
+ m_saved_transfer_crc = m_saved_buffer_crc; // Set CRC at buffer save point (will always be one behind to account for buffering)
+ m_saved_buffer_crc = m_transfer_crc; // Set CRC at save point
+
+ // Set offset save point
+ m_saved_crc_offset = m_saved_buffer_crc_offset; // Set offset at buffer save point (will always be one behind to account for buffering)
+ m_saved_buffer_crc_offset = m_link_burst_index.data; // Set buffer offset to current data offset
+
+ // Reset save counter offset
+ m_temp_crc_offset = m_link_burst_index.data; // Set to current location; next save point will take place after SAVE_DISTANCE bytes
+ }
+
+ if (!m_is_data_request_pending && (m_link_burst_index.data < m_max_transfer_index.data))
+ {
+ // If we have not finished the download.
+
+ // Request more data.
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA);
+
+ m_is_data_request_pending = true;
+ }
+ else if (m_link_burst_index.data >= m_max_transfer_index.data && m_is_crc_pending)
+ {
+ // We are done, send CRC footer.
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ tx_buffer[0] = 0;
+ tx_buffer[1] = 0;
+ tx_buffer[2] = 0;
+ tx_buffer[3] = 0;
+ tx_buffer[4] = 0;
+ tx_buffer[5] = 0;
+ tx_buffer[6] = (uint8_t)m_transfer_crc;
+ tx_buffer[7] = (uint8_t)(m_transfer_crc >> 8u);
+
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ if (err_code != NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR)
+ {
+ // If burst failed before we are able to catch it, we will get a TRANSFER_SEQUENCE_NUMBER_ERROR
+ // The message processing will send client back to correct state
+ APP_ERROR_CHECK(err_code);
+ }
+
+ wait_burst_request_to_complete();
+
+ m_is_crc_pending = false;
+ m_max_transfer_index.data = 0;
+ }
+
+ // Return the number of bytes we accepted.
+ return num_bytes;
+ }
+ }
+
+ // No bytes were accepted.
+ return 0;
+}
+
+
+bool antfs_upload_req_resp_transmit(uint8_t response,
+ const antfs_request_info_t * const p_request_info)
+{
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ if (m_current_state.state != ANTFS_STATE_TRANS ||
+ // Only send the response if we were processing an upload request.
+ (m_link_command_in_progress != ANTFS_CMD_UPLOAD_REQUEST_ID))
+ {
+ return false;
+ }
+
+ // If the application is sending a response for a different file than requested, the upload
+ // will fail.
+ if (p_request_info->file_index.data != m_file_index.data)
+ {
+ event_queue_write(ANTFS_EVENT_UPLOAD_FAIL);
+
+ return false;
+ }
+
+ ulong_union_t max_mem_size;
+ // Set maximum number of bytes that can be written to the file.
+ max_mem_size.data = p_request_info->max_file_size;
+
+ if (p_request_info->max_burst_block_size.data != 0)
+ {
+ // If the client is limiting the block size set the block size requested by the client.
+ m_block_size.data = p_request_info->max_burst_block_size.data;
+ }
+ else
+ {
+ // Try to get the entire file in a single block.
+ m_block_size.data = max_mem_size.data;
+ }
+
+ if (response == 0)
+ {
+ if (m_max_transfer_index.data > max_mem_size.data)
+ {
+ // Not enough space to write file, reject download.
+ response = RESPONSE_MESSAGE_NOT_ENOUGH_SPACE;
+ }
+ }
+
+ // Get last valid CRC and last valid offset.
+ m_transfer_crc = p_request_info->file_crc;
+ m_link_burst_index.data = p_request_info->file_size.data;
+
+ // First packet to transmit is the beacon.
+ beacon_transmit(MESG_BURST_DATA_ID);
+
+ // Second packet.
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ tx_buffer[0] = ANTFS_COMMAND_ID;
+ tx_buffer[1] = ANTFS_RSP_UPLOAD_REQ_ID;
+ tx_buffer[2] = response;
+ tx_buffer[3] = 0;
+ // Last valid data offset written to the file.
+ tx_buffer[4] = m_link_burst_index.bytes.byte0;
+ tx_buffer[5] = m_link_burst_index.bytes.byte1;
+ tx_buffer[6] = m_link_burst_index.bytes.byte2;
+ tx_buffer[7] = m_link_burst_index.bytes.byte3;
+
+
+ uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_CONTINUE);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ // Third packet.
+
+ // Maximum number of bytes that can be written to the file.
+ tx_buffer[0] = max_mem_size.bytes.byte0;
+ tx_buffer[1] = max_mem_size.bytes.byte1;
+ tx_buffer[2] = max_mem_size.bytes.byte2;
+ tx_buffer[3] = max_mem_size.bytes.byte3;
+ // Maximum upload block size.
+ tx_buffer[4] = m_block_size.bytes.byte0;
+ tx_buffer[5] = m_block_size.bytes.byte1;
+ tx_buffer[6] = m_block_size.bytes.byte2;
+ tx_buffer[7] = m_block_size.bytes.byte3;
+
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_CONTINUE);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ // Fourth packet.
+
+ tx_buffer[0] = 0;
+ tx_buffer[1] = 0;
+ tx_buffer[2] = 0;
+ tx_buffer[3] = 0;
+ tx_buffer[4] = 0;
+ tx_buffer[5] = 0;
+ // Value of CRC at last data offset.
+ tx_buffer[6] = (uint8_t) m_transfer_crc;
+ tx_buffer[7] = (uint8_t)(m_transfer_crc >> 8);
+
+ err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID;
+
+ if (response != 0)
+ {
+ // Failed upload request. Reset max transfer index to 0 (do not accept any data if the host
+ // sends it anyway).
+ m_max_transfer_index.data = 0;
+ }
+ else
+ {
+ // Wait for upload data request.
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA;
+ }
+
+ return true;
+#else
+ return false;
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+}
+
+
+bool antfs_upload_data_resp_transmit(bool data_upload_success)
+{
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ // Should be in TRANSPORT layer to send this response.
+ if (m_current_state.state != ANTFS_STATE_TRANS)
+ {
+ return false;
+ }
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ // Response.
+ tx_buffer[0] = ANTFS_COMMAND_ID;
+ tx_buffer[1] = ANTFS_RSP_UPLOAD_DATA_ID;
+ tx_buffer[2] = (data_upload_success) ? RESPONSE_MESSAGE_OK : RESPONSE_MESSAGE_FAIL;
+ tx_buffer[3] = 0;
+ tx_buffer[4] = 0;
+ tx_buffer[5] = 0;
+ tx_buffer[6] = 0;
+ tx_buffer[7] = 0;
+
+ // First packet is beacon.
+ beacon_transmit(MESG_BURST_DATA_ID);
+
+ // Send last packet.
+ uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+
+ m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID;
+
+ // Reset maximum index.
+ m_max_transfer_index.data = 0;
+
+ return true;
+#else
+ return false;
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+}
+
+
+void antfs_erase_req_resp_transmit(uint8_t response)
+{
+ // This function should only be called after receiving an erase request.
+ APP_ERROR_CHECK_BOOL((m_current_state.state == ANTFS_STATE_TRANS) &&
+ (m_link_command_in_progress == ANTFS_CMD_ERASE_ID));
+
+ beacon_transmit(MESG_BURST_DATA_ID);
+
+ uint8_t tx_buffer[BURST_PACKET_SIZE];
+
+ // Erase response.
+ tx_buffer[0] = ANTFS_COMMAND_ID;
+ tx_buffer[1] = ANTFS_RSP_ERASE_ID;
+ tx_buffer[2] = response;
+ tx_buffer[3] = 0;
+ tx_buffer[4] = 0;
+ tx_buffer[5] = 0;
+ tx_buffer[6] = 0;
+ tx_buffer[7] = 0;
+
+ uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CONFIG_CHANNEL_NUMBER,
+ sizeof(tx_buffer),
+ tx_buffer,
+ BURST_SEGMENT_END);
+ APP_ERROR_CHECK(err_code);
+
+ wait_burst_request_to_complete();
+}
+
+
+bool antfs_event_extract(antfs_event_return_t * const p_event)
+{
+ bool return_value = false;
+
+ if (m_event_queue.head != m_event_queue.tail)
+ {
+ // Pending events exist. Copy event parameters into return event.
+ p_event->event = m_event_queue.p_queue[m_event_queue.tail].event;
+ p_event->file_index = m_event_queue.p_queue[m_event_queue.tail].file_index;
+ p_event->offset = m_event_queue.p_queue[m_event_queue.tail].offset;
+ p_event->bytes = m_event_queue.p_queue[m_event_queue.tail].bytes;
+ p_event->crc = m_event_queue.p_queue[m_event_queue.tail].crc;
+ memcpy(p_event->data,
+ m_event_queue.p_queue[m_event_queue.tail].data,
+ sizeof(p_event->data));
+
+ // Release the event queue.
+ m_event_queue.tail = ((m_event_queue.tail + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u));
+
+ return_value = true;
+ }
+
+ return return_value;
+}
+
+
+/**@brief Function for setting the channel period.
+ *
+ * Sets the channel period. The only allowed frequencies are 0.5, 1, 2, 4 and 8 Hz.
+ *
+ * @param[in] link_period Link period for the beacon transmission.
+ */
+static void channel_period_set(uint32_t link_period)
+{
+ uint32_t period;
+
+ switch (link_period)
+ {
+ default:
+ // Shouldn't happen, but just in case default to 0,5Hz.
+ case BEACON_PERIOD_0_5_HZ:
+ period = 65535u;
+ break;
+
+ case BEACON_PERIOD_1_HZ:
+ period = 32768u;
+ break;
+
+ case BEACON_PERIOD_2_HZ:
+ period = 16384u;
+ break;
+
+ case BEACON_PERIOD_4_HZ:
+ period = 8192u;
+ break;
+
+ case BEACON_PERIOD_8_HZ:
+ period = 4096u;
+ break;
+ }
+
+ const uint32_t err_code = sd_ant_channel_period_set(ANTFS_CONFIG_CHANNEL_NUMBER, period);
+ APP_ERROR_CHECK(err_code);
+}
+
+
+/**@brief Function for starting ANT-FS timeout.
+ *
+ * @param[in] timeout_in_secs Timeout requested in unit of seconds.
+ */
+static void timeout_start(uint32_t timeout_in_secs)
+{
+ uint32_t err_code = app_timer_stop(m_timer_id);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = app_timer_start(m_timer_id,
+ APP_TIMER_TICKS((uint32_t)(timeout_in_secs * 1000u)),
+ NULL);
+ APP_ERROR_CHECK(err_code);
+}
+
+
+/**@brief Function for switching to authentication layer.
+ */
+static void authenticate_layer_transit(void)
+{
+ if (m_current_state.state != ANTFS_STATE_OFF)
+ {
+ m_current_state.state = ANTFS_STATE_AUTH;
+ m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_NONE;
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+
+ uint32_t err_code = sd_ant_channel_radio_freq_set(ANTFS_CONFIG_CHANNEL_NUMBER, m_active_beacon_frequency);
+ APP_ERROR_CHECK(err_code);
+
+ event_queue_write(ANTFS_EVENT_AUTH);
+ }
+}
+
+
+/**@brief Function for decoding an ANT-FS command received at the link layer.
+ *
+ * @param[in] p_command_buffer The ANT-FS command buffer.
+ */
+static void link_layer_cmd_decode(const uint8_t * p_command_buffer)
+{
+ if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] != ANTFS_COMMAND_ID)
+ {
+ return;
+ }
+
+ switch (p_command_buffer[ANTFS_COMMAND_OFFSET])
+ {
+ case ANTFS_CMD_LINK_ID:
+ // Channel frequency.
+ m_active_beacon_frequency =
+ p_command_buffer[TRANSPORT_CHANNEL_FREQUENCY_OFFSET];
+ // Channel message period.
+ m_active_beacon_status1_field.parameters.link_period =
+ p_command_buffer[TRANSPORT_MESSAGE_PERIOD_OFFSET];
+ // Host serial Number.
+ m_link_host_serial_number.bytes.byte0 =
+ p_command_buffer[HOST_ID_OFFSET_0];
+ m_link_host_serial_number.bytes.byte1 =
+ p_command_buffer[HOST_ID_OFFSET_1];
+ m_link_host_serial_number.bytes.byte2 =
+ p_command_buffer[HOST_ID_OFFSET_2];
+ m_link_host_serial_number.bytes.byte3 =
+ p_command_buffer[HOST_ID_OFFSET_3];
+
+ // Move to the channel period issued by the host.
+ channel_period_set(m_active_beacon_status1_field.parameters.link_period);
+
+ authenticate_layer_transit();
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/**@brief Function for switching to link layer.
+ */
+static void link_layer_transit(void)
+{
+ if (m_current_state.state != ANTFS_STATE_OFF)
+ {
+ uint32_t err_code;
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ err_code = bsp_indication_set(BSP_INDICATE_IDLE);
+ APP_ERROR_CHECK(err_code);
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+
+ m_current_state.state = ANTFS_STATE_LINK;
+ m_current_state.sub_state.link_sub_state = ANTFS_LINK_SUBSTATE_NONE;
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+ m_active_beacon_status1_field = m_initial_parameters.beacon_status_byte1;
+ m_active_beacon_frequency = m_initial_parameters.beacon_frequency;
+
+ timeout_disable();
+
+ err_code = sd_ant_channel_radio_freq_set(ANTFS_CONFIG_CHANNEL_NUMBER, m_active_beacon_frequency);
+ APP_ERROR_CHECK(err_code);
+
+ event_queue_write(ANTFS_EVENT_LINK);
+ }
+}
+
+
+/**@brief Function for decoding an ANT-FS command received at the authenticate layer.
+ *
+ * @param[in] control_byte The command control byte.
+ * @param[in] p_command_buffer The ANT-FS command buffer.
+ */
+static void authenticate_layer_cmd_decode(uint8_t control_byte,
+ const uint8_t * p_command_buffer)
+{
+ // @note: Response variable must have a static storage allocation as it keeps track of the
+ // passkey authentication progress between multiple burst packets.
+#if ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+ static uint32_t response;
+#endif // ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+
+ if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0 && m_link_command_in_progress != ANTFS_CMD_NONE)
+ {
+ // This is something new, and we're busy processing something already, so don't respond
+ return;
+ }
+
+ if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] == ANTFS_COMMAND_ID &&
+ m_link_command_in_progress == ANTFS_CMD_NONE)
+ {
+ if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_AUTHENTICATE_ID)
+ {
+ // Make sure it is the correct host
+ if (m_link_host_serial_number.bytes.byte0 != p_command_buffer[HOST_ID_OFFSET_0] ||
+ m_link_host_serial_number.bytes.byte1 != p_command_buffer[HOST_ID_OFFSET_1] ||
+ m_link_host_serial_number.bytes.byte2 != p_command_buffer[HOST_ID_OFFSET_2] ||
+ m_link_host_serial_number.bytes.byte3 != p_command_buffer[HOST_ID_OFFSET_3])
+ return;
+
+ m_link_command_in_progress = ANTFS_CMD_AUTHENTICATE_ID;
+ m_authenticate_command_type = p_command_buffer[COMMAND_TYPE_OFFSET];
+ m_retry = AUTHENTICATION_RETRIES;
+ }
+ }
+
+ if (m_link_command_in_progress == ANTFS_CMD_AUTHENTICATE_ID)
+ {
+ switch (m_authenticate_command_type)
+ {
+ case COMMAND_TYPE_REQUEST_SERIAL:
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Don't do anything before the burst completes (last burst message received).
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ authenticate_response_transmit(AUTH_RESPONSE_N_A,
+ ANTFS_REMOTE_FRIENDLY_NAME_MAX,
+ // Send device friendly name if it exists.
+ m_initial_parameters.p_remote_friendly_name);
+ }
+ break;
+
+#if ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED
+ case COMMAND_TYPE_PROCEED:
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Don't do anything before the burst completes (last burst message received).
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ // Proceed directly to transport layer (no authentication required).
+ authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, 0, NULL);
+ }
+ break;
+
+#endif // ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED
+#if ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+ case COMMAND_TYPE_REQUEST_PAIR:
+ if ((control_byte & SEQUENCE_NUMBER_ROLLOVER) == 0)
+ {
+ // First burst packet.
+
+ // Friendly name length.
+ m_friendly_name.friendly_name_size =
+ p_command_buffer[AUTH_STRING_LENGTH_OFFSET];
+
+ if (m_friendly_name.friendly_name_size > 0)
+ {
+ if (m_friendly_name.friendly_name_size > ANTFS_FRIENDLY_NAME_MAX)
+ {
+ m_friendly_name.friendly_name_size = ANTFS_FRIENDLY_NAME_MAX;
+ }
+
+ m_friendly_name.index = 0;
+ }
+ }
+ else
+ {
+ // Next burst packets: read host friendly name.
+
+ if (m_friendly_name.index < ANTFS_FRIENDLY_NAME_MAX)
+ {
+ uint32_t num_of_bytes = ANTFS_FRIENDLY_NAME_MAX - m_friendly_name.index;
+ if (num_of_bytes > 8u)
+ {
+ num_of_bytes = 8u;
+ }
+ memcpy((uint8_t*)&m_friendly_name.friendly_name[m_friendly_name.index],
+ p_command_buffer,
+ num_of_bytes);
+ m_friendly_name.index += num_of_bytes;
+ }
+ }
+
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Last burst packet.
+
+ timeout_start(ANTFS_CONFIG_PAIRING_TIMEOUT);
+ if (m_friendly_name.friendly_name_size > 0)
+ {
+ m_friendly_name.is_name_set = true;
+ }
+
+ m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_PAIR;
+ // If pairing is supported, send request to UI.
+ event_queue_write(ANTFS_EVENT_PAIRING_REQUEST);
+ }
+ break;
+
+#endif // ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+#if ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+ case COMMAND_TYPE_REQUEST_PASSKEY:
+ if ((control_byte & SEQUENCE_NUMBER_ROLLOVER) == 0)
+ {
+ // First burst packet.
+
+ // Passkey length.
+ const uint32_t passkey_size = p_command_buffer[AUTH_STRING_LENGTH_OFFSET];
+
+ // Default the algorithm to accept.
+ response = AUTH_RESPONSE_ACCEPT;
+
+ // Check if the passkey length is valid.
+ if (passkey_size == ANTFS_PASSKEY_SIZE)
+ {
+ m_passkey_index = 0;
+ }
+ else
+ {
+ // Invalid lenght supplied - the authentication will be rejected.
+ response = AUTH_RESPONSE_REJECT;
+ }
+ }
+ else
+ {
+ // Next burst packets: read host friendly name.
+
+ if ((response == AUTH_RESPONSE_ACCEPT) &&
+ // Prevent buffer overrun.
+ (m_passkey_index != ANTFS_PASSKEY_SIZE))
+ {
+ // Passkey length was valid and the host supplied key matches so far.
+ uint32_t idx = 0;
+
+ // Check the current received burst packet for passkey match.
+ do
+ {
+ if (m_initial_parameters.p_pass_key[m_passkey_index++] !=
+ p_command_buffer[idx])
+ {
+ // Reject the authentication request and further processing of
+ // passkey matching if a mismatch is found.
+ response = AUTH_RESPONSE_REJECT;
+ break;
+ }
+
+ ++idx;
+ }
+ while (idx < BURST_PACKET_SIZE);
+ }
+ }
+
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Last burst packet.
+
+ if (m_passkey_index < ANTFS_PASSKEY_SIZE)
+ {
+ // We did not get the complete passkey, reject authentication request.
+ response = AUTH_RESPONSE_REJECT;
+ }
+
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_PASSKEY;
+ authenticate_response_transmit(response, 0, NULL);
+ }
+ break;
+
+#endif // ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED
+ default:
+ break;
+ }
+ }
+ else if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_DISCONNECT_ID)
+ {
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Don't do anything before the burst completes (last burst message received).
+ link_layer_transit();
+ }
+ }
+ else if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_PING_ID)
+ {
+ // Reset timeout.
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+ }
+ else
+ {
+ // No implementation needed.
+ }
+}
+
+
+/**@brief Function for decoding an ANT-FS command received at the transport layer.
+ *
+ * @param[in] control_byte The command control byte.
+ * @param[in] p_command_buffer The ANT-FS command buffer.
+ */
+static void transport_layer_cmd_decode(uint8_t control_byte, const uint8_t * p_command_buffer)
+{
+ ulong_union_t host_serial_number = {0};
+
+ if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] == ANTFS_COMMAND_ID)
+ {
+ m_link_command_in_progress = p_command_buffer[ANTFS_COMMAND_OFFSET];
+ }
+
+ switch (m_link_command_in_progress)
+ {
+ case ANTFS_CMD_PING_ID:
+ // Reset timeout.
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+ break;
+
+ case ANTFS_CMD_DISCONNECT_ID:
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Don't do anything before the burst completes (last burst message received).
+ link_layer_transit();
+ }
+ break;
+
+ case ANTFS_CMD_ERASE_ID:
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Don't do anything before the burst completes (last burst message received).
+
+ // Requested index.
+ m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW];
+ m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH];
+
+ // Send erase request to the application.
+ event_queue_write(ANTFS_EVENT_ERASE_REQUEST);
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_link_command_in_progress = ANTFS_CMD_ERASE_ID;
+ }
+ break;
+
+ case ANTFS_CMD_DOWNLOAD_ID:
+ if (m_current_state.sub_state.trans_sub_state != ANTFS_TRANS_SUBSTATE_NONE)
+ {
+ // Ignore the command if we are busy.
+ break;
+ }
+
+ if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00)
+ {
+ // First burst packet.
+
+ if ((m_file_index.bytes.low != p_command_buffer[DATA_INDEX_OFFSET_LOW]) ||
+ (m_file_index.bytes.high != p_command_buffer[DATA_INDEX_OFFSET_HIGH]))
+ {
+ // This is a new index, so we can not check the CRC against the previous saved
+ // CRC.
+
+ // CRC seed checking is made invalid by setting the last saved offset to the
+ // maximum file size.
+ m_saved_crc_offset = ANTFS_MAX_FILE_SIZE;
+ }
+
+ // Requested data file index.
+ m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW];
+ m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH];
+
+ // Initialize current position in the TX burst to the requested offset.
+ m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0];
+ m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1];
+ m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2];
+ m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3];
+ }
+ else if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Last burst packet (download command should be two packets long).
+
+ // Get CRC seed from host.
+ m_compared_crc = (uint16_t)p_command_buffer[DATA_INDEX_OFFSET_LOW];
+ m_compared_crc |= ((uint16_t)p_command_buffer[DATA_INDEX_OFFSET_HIGH] << 8u);
+
+ // Maximum block size allowed by host.
+ m_max_block_size.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0];
+ m_max_block_size.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1];
+ m_max_block_size.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2];
+ m_max_block_size.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3];
+
+ // Initialize number of remaining bytes for this block to the maximum block size.
+ m_bytes_remaining.data = m_max_block_size.data;
+
+ if (p_command_buffer[INITIAL_REQUEST_OFFSET])
+ {
+ // This request is the start of a new transfer.
+
+ // Initialize data offset for CRC calculation to the requested data offset.
+ m_saved_crc_offset = m_link_burst_index.data;
+ m_saved_buffer_crc_offset = m_link_burst_index.data;
+
+ // Use CRC seed provided by host for CRC checking of the data.
+ m_transfer_crc = m_compared_crc;
+ m_saved_transfer_crc = m_compared_crc;
+ m_saved_buffer_crc = m_compared_crc;
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC;
+ }
+ else
+ {
+ // This is a request to resume a partially completed transfer.
+
+ if (m_saved_crc_offset > m_link_burst_index.data)
+ {
+ // We can not check the received CRC seed as the requested offset is before
+ // our last save point.
+
+ // Set CRC checking as invalid.
+ m_saved_crc_offset = ANTFS_MAX_FILE_SIZE;
+ }
+ else
+ {
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC;
+ }
+ }
+
+ m_is_data_request_pending = false;
+
+ // Send download request to the application for further handling.
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST);
+
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_link_command_in_progress = ANTFS_CMD_DOWNLOAD_ID;
+ }
+ break;
+
+ case ANTFS_CMD_UPLOAD_REQUEST_ID:
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00)
+ {
+ // First burst packet.
+
+ if ((m_file_index.bytes.low != p_command_buffer[DATA_INDEX_OFFSET_LOW]) ||
+ (
+ (m_file_index.bytes.high != p_command_buffer[DATA_INDEX_OFFSET_HIGH]) ||
+ (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_NONE)
+ )
+ )
+ {
+ // If it is a new index or we completed the last upload.
+
+ // Get the file index.
+ m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW];
+ m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH];
+
+ // As this is a new upload, reset save point to the beginning of the file.
+
+ // Set CRC to zero.
+ m_saved_crc_offset = 0;
+ m_saved_transfer_crc = 0;
+ }
+
+ // Get the upper limit of upload from request message.
+ m_max_transfer_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0];
+ m_max_transfer_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1];
+ m_max_transfer_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2];
+ m_max_transfer_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3];
+ }
+ else if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Last burst (second) packet.
+
+ // Get data offset the requested upload will start at.
+ m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0];
+ m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1];
+ m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2];
+ m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3];
+
+ if (m_link_burst_index.data != ANTFS_MAX_FILE_SIZE)
+ {
+ // If this is a new upload.
+
+ // The data offset specified in the upload request will be used.
+ m_saved_crc_offset = m_link_burst_index.data;
+
+ m_saved_transfer_crc = 0;
+ }
+
+ m_transfer_crc = m_saved_transfer_crc;
+
+ // Send upload request to the application for further handling.
+ event_queue_write(ANTFS_EVENT_UPLOAD_REQUEST);
+
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+ m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID;
+ }
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+ break;
+
+ case ANTFS_CMD_UPLOAD_DATA_ID:
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00)
+ {
+ // First burst packet.
+
+ if (m_current_state.sub_state.trans_sub_state ==
+ ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA)
+ {
+ antfs_event_t event;
+
+ // Get CRC Seed from host.
+ m_compared_crc = (uint16_t)p_command_buffer[DATA_INDEX_OFFSET_LOW];
+ m_compared_crc |= ((uint16_t)p_command_buffer[DATA_INDEX_OFFSET_HIGH] << 8u);
+
+ // Set download offset.
+ m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0];
+ m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1];
+ m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2];
+ m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3];
+
+ if ((m_link_burst_index.data + m_block_size.data) < m_max_transfer_index.data)
+ {
+ // Adjust block size as set by client.
+ m_max_transfer_index.data = m_link_burst_index.data + m_block_size.data;
+ }
+
+ if (m_compared_crc != m_transfer_crc)
+ {
+ // Check that the request matches the CRC sent on the upload response.
+
+ // Do not accept any data.
+ m_max_transfer_index.data = 0;
+
+ // Failure will be reported when upload is done.
+ event = (antfs_event_t)0;
+ }
+
+ // Set ready to receive a file.
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_UPLOADING;
+
+ event = ANTFS_EVENT_UPLOAD_START;
+ m_transfer_crc = m_compared_crc;
+
+ if (m_link_burst_index.data > m_max_transfer_index.data)
+ {
+ // If the requested offset is too high.
+
+ // Clear the max transfer index, so we'll report fail when the transfer
+ // finishes.
+ m_max_transfer_index.data = 0;
+ // Clear the event because we normally would not send an event at this point
+ // in this case.
+ event = (antfs_event_t)0;
+ }
+
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // If this upload contains no data.
+
+ // Leave the upload state.
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE;
+
+ // if it was a valid index, report it as a successful upload, otherwise
+ // report it as a failure.
+ if (event == 0)
+ {
+ event = ANTFS_EVENT_UPLOAD_FAIL;
+ }
+ else
+ {
+ event = ANTFS_EVENT_UPLOAD_COMPLETE;
+ }
+ }
+
+ if (event != 0)
+ {
+ event_queue_write(event);
+ }
+ }
+ }
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+ break;
+
+ case ANTFS_CMD_LINK_ID:
+ host_serial_number.bytes.byte0 = p_command_buffer[HOST_ID_OFFSET_0];
+ host_serial_number.bytes.byte1 = p_command_buffer[HOST_ID_OFFSET_1];
+ host_serial_number.bytes.byte2 = p_command_buffer[HOST_ID_OFFSET_2];
+ host_serial_number.bytes.byte3 = p_command_buffer[HOST_ID_OFFSET_3];
+
+ if (m_link_host_serial_number.data == host_serial_number.data)
+ {
+ m_active_beacon_frequency = p_command_buffer[TRANSPORT_CHANNEL_FREQUENCY_OFFSET];
+ m_active_beacon_status1_field.parameters.link_period =
+ p_command_buffer[TRANSPORT_MESSAGE_PERIOD_OFFSET];
+
+ const uint32_t err_code = sd_ant_channel_radio_freq_set(ANTFS_CONFIG_CHANNEL_NUMBER,
+ m_active_beacon_frequency);
+ APP_ERROR_CHECK(err_code);
+
+ channel_period_set(m_active_beacon_status1_field.parameters.link_period);
+ }
+
+ m_link_command_in_progress = 0;
+ break;
+
+ default:
+ // Don't do anything, this is an invalid message.
+ m_link_command_in_progress = 0;
+ break;
+ }
+}
+
+
+/**@brief Function for handling data upload.
+ *
+ * @param[in] control_byte The command control byte.
+ * @param[in] p_buffer The data buffer.
+ */
+static void upload_data_process(uint8_t control_byte, const uint8_t * p_buffer)
+{
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ if (control_byte & SEQUENCE_LAST_MESSAGE)
+ {
+ // Last burst packet: upload complete.
+
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE;
+
+ // CRC for data packets contained in this upload block.
+ m_compared_crc = p_buffer[UPLOAD_CRC_OFFSET_LOW ];
+ m_compared_crc |= (p_buffer[UPLOAD_CRC_OFFSET_HIGH] << 8u);
+
+ if (m_max_transfer_index.data && (m_compared_crc == m_transfer_crc))
+ {
+ // CRC OK, upload was completed successfully.
+ event_queue_write(ANTFS_EVENT_UPLOAD_COMPLETE);
+ }
+ else
+ {
+ // CRC mismatch, upload failed.
+ event_queue_write(ANTFS_EVENT_UPLOAD_FAIL);
+ }
+
+ m_max_transfer_index.data = 0;
+ }
+ else
+ {
+ // Not the last burst packet: upload not complete.
+
+ // Set initial number of bytes to 8 (size of burst packet).
+ m_bytes_to_write = BURST_PACKET_SIZE;
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+
+ if (m_link_burst_index.data > m_max_transfer_index.data)
+ {
+ // We are past the main index, we do not need to write any more data.
+ m_bytes_to_write = 0;
+ }
+ else
+ {
+ if ((m_bytes_to_write + m_link_burst_index.data) > m_max_transfer_index.data)
+ {
+ // if we're less than 8 bytes away from the end, adjust the number of bytes to write
+ // in this block.
+ m_bytes_to_write = m_max_transfer_index.data - m_link_burst_index.data;
+ }
+ }
+
+ if (m_bytes_to_write != 0)
+ {
+ APP_ERROR_CHECK_BOOL(m_bytes_to_write <= BURST_PACKET_SIZE);
+
+ // Store begin of upload data.
+ mp_upload_data = p_buffer;
+
+ m_transfer_crc = crc_crc16_update(m_transfer_crc, p_buffer, m_bytes_to_write);
+
+ // Send data to application.
+ event_queue_write(ANTFS_EVENT_UPLOAD_DATA);
+
+ // Update current offset.
+ m_link_burst_index.data += m_bytes_to_write;
+
+ // Store save point.
+ m_saved_crc_offset = m_link_burst_index.data;
+ m_saved_transfer_crc = m_transfer_crc;
+ }
+ }
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+}
+
+
+/**@brief Function for switching to transport layer.
+ */
+static void transport_layer_transit(void)
+{
+ if (m_current_state.state != ANTFS_STATE_OFF)
+ {
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
+ APP_ERROR_CHECK(err_code);
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+ m_current_state.state = ANTFS_STATE_TRANS;
+ m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE;
+
+ timeout_start(ANTFS_CONFIG_LINK_COMMAND_TIMEOUT);
+
+ beacon_transmit(MESG_BROADCAST_DATA_ID);
+
+ event_queue_write(ANTFS_EVENT_TRANS);
+ }
+}
+
+
+void antfs_message_process(uint8_t * p_message)
+{
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ uint32_t err_code;
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+
+ if (p_message != NULL)
+ {
+ if ((p_message[BUFFER_INDEX_CHANNEL_NUM] & CHANNEL_NUMBER_MASK) != ANTFS_CONFIG_CHANNEL_NUMBER)
+ {
+ // Only process messages corresponding to the ANT-FS channel here.
+ return;
+ }
+
+ if ((m_current_state.state == ANTFS_STATE_OFF) &&
+ (
+ !(
+ (p_message[BUFFER_INDEX_MESG_ID] == MESG_RESPONSE_EVENT_ID) &&
+ (p_message[BUFFER_INDEX_RESPONSE_CODE] == NO_EVENT)
+ )
+ )
+ )
+ {
+ return;
+ }
+
+ switch (p_message[BUFFER_INDEX_MESG_ID])
+ {
+ case MESG_BROADCAST_DATA_ID:
+ // We are not going to process broadcast messages or pass them to the app to handle.
+ break;
+
+ case MESG_ACKNOWLEDGED_DATA_ID:
+ // Mark it as being the last message if it's an ack message.
+ p_message[ANTFS_CONTROL_OFFSET] |= SEQUENCE_LAST_MESSAGE;
+
+ /* fall-through */
+ case MESG_BURST_DATA_ID:
+ switch (m_current_state.state)
+ {
+ case ANTFS_STATE_LINK:
+ link_layer_cmd_decode(&p_message[ANTFS_DATA_OFFSET]);
+ break;
+
+ case ANTFS_STATE_AUTH:
+ authenticate_layer_cmd_decode(p_message[ANTFS_CONTROL_OFFSET],
+ &p_message[ANTFS_DATA_OFFSET]);
+ break;
+
+ case ANTFS_STATE_TRANS:
+ if (m_current_state.sub_state.trans_sub_state !=
+ ANTFS_TRANS_SUBSTATE_UPLOADING)
+ {
+ transport_layer_cmd_decode(p_message[ANTFS_CONTROL_OFFSET],
+ &p_message[ANTFS_DATA_OFFSET]);
+ }
+ else
+ {
+ upload_data_process(p_message[ANTFS_CONTROL_OFFSET],
+ &p_message[ANTFS_DATA_OFFSET]);
+ }
+ break;
+
+ default:
+ // If in any other state or sub-state, do nothing.
+ break;
+ }
+ break;
+
+ case MESG_RESPONSE_EVENT_ID:
+ // Branch on event ID.
+ switch (p_message[BUFFER_INDEX_RESPONSE_CODE])
+ {
+ case EVENT_TRANSFER_TX_FAILED:
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+ // Switch into the appropriate state after the failure. Must be ready for
+ // the host to do a retry.
+ switch (m_current_state.state)
+ {
+ case ANTFS_STATE_LINK:
+ link_layer_transit();
+ break;
+
+ case ANTFS_STATE_AUTH:
+ // Burst failed, retry sending the response
+ if (!m_retry)
+ {
+ authenticate_layer_transit(); // Reload beacon
+ }
+ else
+ {
+ if (m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_ACCEPT)
+ {
+ if (m_authenticate_command_type == COMMAND_TYPE_REQUEST_PAIR)
+ {
+ authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, ANTFS_PASSKEY_SIZE,
+ m_initial_parameters.p_pass_key);
+ }
+ else
+ {
+ authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, 0, NULL);
+ }
+ }
+ else if (m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_REJECT)
+ {
+ authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL);
+ }
+ else if (m_authenticate_command_type == COMMAND_TYPE_REQUEST_SERIAL)
+ {
+ authenticate_response_transmit(AUTH_RESPONSE_N_A,
+ ANTFS_REMOTE_FRIENDLY_NAME_MAX,
+ // Send device friendly name if it exists.
+ m_initial_parameters.p_remote_friendly_name);
+ }
+ else
+ {
+ // No implementation needed
+ }
+
+ m_retry--;
+ }
+
+ break;
+
+ case ANTFS_STATE_TRANS:
+ if (m_current_state.sub_state.trans_sub_state ==
+ ANTFS_TRANS_SUBSTATE_DOWNLOADING)
+ {
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_FAIL);
+ }
+ transport_layer_transit();
+ break;
+
+ default:
+ // No implementation needed.
+ break;
+ }
+ break;
+
+ case EVENT_TRANSFER_RX_FAILED:
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+
+ if (m_current_state.sub_state.trans_sub_state ==
+ ANTFS_TRANS_SUBSTATE_UPLOADING)
+ {
+ event_queue_write(ANTFS_EVENT_UPLOAD_FAIL);
+
+ m_current_state.sub_state.trans_sub_state =
+ ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME;
+ }
+ else
+ {
+ // No implementation needed
+ }
+
+ break;
+
+ case EVENT_TRANSFER_TX_COMPLETED:
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+
+ // Switch into appropiate state after successful command.
+ switch (m_current_state.state)
+ {
+ case ANTFS_STATE_AUTH:
+ if (m_current_state.sub_state.auth_sub_state ==
+ ANTFS_AUTH_SUBSTATE_ACCEPT)
+ {
+ // We passed authentication, so go to transport state.
+ transport_layer_transit();
+ }
+ else if (m_current_state.sub_state.auth_sub_state ==
+ ANTFS_AUTH_SUBSTATE_REJECT)
+ {
+ // We failed authentication, so go to link state.
+ link_layer_transit();
+ }
+ else
+ {
+ // Reload beacon.
+ authenticate_layer_transit();
+ }
+ break;
+
+ case ANTFS_STATE_TRANS:
+ if (m_current_state.sub_state.trans_sub_state ==
+ ANTFS_TRANS_SUBSTATE_DOWNLOADING)
+ {
+ event_queue_write(ANTFS_EVENT_DOWNLOAD_COMPLETE);
+ }
+ if (m_current_state.sub_state.trans_sub_state !=
+ ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA)
+ {
+ transport_layer_transit(); // Reload beacon.
+ }
+ break;
+
+ default:
+ link_layer_transit(); // Reload beacon.
+ break;
+ }
+ break;
+
+ case EVENT_TX:
+#if ANTFS_CONFIG_DEBUG_LED_ENABLED
+ err_code = bsp_indication_set(BSP_INDICATE_SENT_OK);
+ APP_ERROR_CHECK(err_code);
+#endif // ANTFS_CONFIG_DEBUG_LED_ENABLED
+ // Load beacon.
+ beacon_transmit(MESG_BROADCAST_DATA_ID);
+ break;
+
+ case EVENT_CHANNEL_CLOSED:
+ event_queue_write(ANTFS_EVENT_CLOSE_COMPLETE);
+ break;
+
+ case NO_EVENT:
+ // This shouldn't happen... command responses should not occur.
+ APP_ERROR_HANDLER(p_message[BUFFER_INDEX_RESPONSE_CODE]);
+ break;
+
+ default:
+ // No implementation needed.
+ return;
+ }
+ break;
+
+ default:
+ // No implementation needed.
+ return;
+ }
+ }
+}
+
+
+void antfs_channel_setup(void)
+{
+ // Start channel configuration.
+ uint32_t err_code = ant_fs_key_set(ANTFS_CONFIG_NETWORK_NUMBER);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = sd_ant_channel_assign(ANTFS_CONFIG_CHANNEL_NUMBER,
+ ANTFS_CHANNEL_TYPE,
+ ANTFS_CONFIG_NETWORK_NUMBER,
+ 0);
+ APP_ERROR_CHECK(err_code);
+
+ // Use the lower 2 bytes of the ESN for device number.
+ uint16_t device_number = (uint16_t)(m_initial_parameters.client_serial_number & 0x0000FFFFu);
+ if (device_number == 0)
+ {
+ // Device number of 0 is not allowed.
+ device_number = 2;
+ }
+
+ err_code = sd_ant_channel_id_set(ANTFS_CONFIG_CHANNEL_NUMBER,
+ device_number,
+ ANTFS_CONFIG_DEVICE_TYPE,
+ ANTFS_CONFIG_TRANS_TYPE);
+ APP_ERROR_CHECK(err_code);
+
+ // Remain in initialization state until channel is open.
+ m_current_state.state = ANTFS_STATE_INIT;
+ // @note: Channel frequency is set by function below.
+ link_layer_transit();
+ m_current_state.state = ANTFS_STATE_INIT;
+
+ channel_period_set(m_active_beacon_status1_field.parameters.link_period);
+
+ err_code = sd_ant_channel_open(ANTFS_CONFIG_CHANNEL_NUMBER);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = sd_ant_channel_radio_tx_power_set(ANTFS_CONFIG_CHANNEL_NUMBER,
+ ANTFS_CONFIG_TRANSMIT_POWER,
+ ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER);
+ APP_ERROR_CHECK(err_code);
+
+ m_current_state.state = ANTFS_STATE_LINK;
+ m_current_state.sub_state.link_sub_state = ANTFS_LINK_SUBSTATE_NONE;
+
+ event_queue_write(ANTFS_EVENT_OPEN_COMPLETE);
+
+ // Start beacon broadcast.
+ beacon_transmit(MESG_BROADCAST_DATA_ID);
+}
+
+
+/**@brief Function for resetting the ANT-FS state machine.
+ */
+static void state_machine_reset(void)
+{
+ m_current_state.state = ANTFS_STATE_OFF;
+ m_link_command_in_progress = ANTFS_CMD_NONE;
+
+ timeout_disable();
+
+ // Reset the ANT-FS event queue.
+ m_event_queue.p_queue = m_event_queue_buffer;
+ m_event_queue.head = 0;
+ m_event_queue.tail = 0;
+
+ // Set as invalid.
+ m_authenticate_command_type = 0xFFu;
+ m_retry = 0;
+
+ m_saved_crc_offset = 0xFFFFFFFFu;
+ m_max_transfer_index.data = 0;
+ m_is_crc_pending = false;
+ m_is_data_request_pending = false;
+
+ m_friendly_name.is_name_set = false;
+ m_friendly_name.index = 0;
+
+ memset(m_friendly_name.friendly_name, 0, ANTFS_FRIENDLY_NAME_MAX);
+}
+
+
+/**@brief Function for ANT-FS timer event.
+ *
+ * Handles pairing and command timeouts.
+ *
+ * @param[in] p_context The callback context.
+ */
+static void timeout_handle(void * p_context)
+{
+ if (m_current_state.state == ANTFS_STATE_OFF)
+ {
+ return;
+ }
+
+ if ((m_current_state.state == ANTFS_STATE_AUTH) &&
+ // Pairing timeout.
+ (m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_PAIR))
+ {
+ // Reject authentication request and send pairing timeout event.
+ authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL);
+ event_queue_write(ANTFS_EVENT_PAIRING_TIMEOUT);
+ }
+
+ // Fall back to link layer when an ANT-FS event times out.
+ link_layer_transit();
+}
+
+
+void antfs_init(const antfs_params_t * const p_params,
+ antfs_burst_wait_handler_t burst_wait_handler)
+{
+ m_initial_parameters = *p_params;
+ m_burst_wait_handler = burst_wait_handler;
+ m_active_beacon_status1_field = m_initial_parameters.beacon_status_byte1;
+
+ uint32_t err_code = app_timer_create(&m_timer_id, APP_TIMER_MODE_SINGLE_SHOT, timeout_handle);
+ APP_ERROR_CHECK(err_code);
+
+ state_machine_reset();
+
+ err_code = sd_ant_burst_handler_wait_flag_enable((uint8_t *)(&m_burst_wait));
+ APP_ERROR_CHECK(err_code);
+}
+#endif // NRF_MODULE_ENABLED(ANTFS)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.h
new file mode 100644
index 0000000..b040a62
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/antfs.h
@@ -0,0 +1,396 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2012
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+/**@file
+ * @brief The ANT-FS client protocol interface.
+ * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012
+ * @defgroup ant_fs ANT-FS client device simulator
+ * @{
+ * @ingroup ant_sdk_utils
+ *
+ * @brief The ANT-FS client device simulator.
+ *
+ * @note The ANT-FS Network Key is available for ANT+ Adopters. Please refer to http://thisisant.com to become an ANT+ Adopter and access the key.
+ */
+
+#ifndef ANTFS_H__
+#define ANTFS_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "defines.h"
+#include "sdk_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANTFS_VERSION_MAJOR 1u /**< Version major number. */
+#define ANTFS_VERSION_MINOR 0 /**< Version minor number. */
+#define ANTFS_VERSION_ITERATION 0 /**< Version iteration. */
+#define ANTFS_VERSION_TYPE 'R' /**< Version type is release. */
+#define ANTFS_VERSION_SPEC '0.AK' /**< Version of the ANT-FS Technology Specification. */
+#define ANTFS_DIR_STRUCT_VERSION 1u /**< Version of the directory file structure. */
+#define ANTFS_VERSION_DATE 20090522u /**< Version date. */
+
+// ANT-FS options.
+#define ANTFS_LINK_FREQ 50u /**< RF Frequency (+2400MHz). */
+#define ANTFS_CHANNEL_TYPE CHANNEL_TYPE_MASTER /**< ANT-FS Client Channel Type. */
+#define ANTFS_AUTH_STRING_MAX 255u /**< Maximum size of authentication strings (passkey/friendly name). */
+#define ANTFS_PASSKEY_SIZE 16u /**< Passkey size. */
+#define ANTFS_FRIENDLY_NAME_MAX 16u /**< Maximum size of friendly name received from host. */
+#define ANTFS_REMOTE_FRIENDLY_NAME_MAX 16u /**< Maximum size of client's friendly name. */
+
+// Beacon definitions.
+#define BEACON_PERIOD_SHIFT 0x00 /**< Shift value for masking out beacon period. */
+#define BEACON_PERIOD_MASK (0x07u << BEACON_PERIOD_SHIFT) /**< Beacon period bitmask. */
+#define BEACON_PERIOD_0_5_HZ (0x00 << BEACON_PERIOD_SHIFT) /**< Value for 0,5Hz beacon period. */
+#define BEACON_PERIOD_1_HZ (0x01u << BEACON_PERIOD_SHIFT) /**< Value for 1Hz beacon period. */
+#define BEACON_PERIOD_2_HZ (0x02u << BEACON_PERIOD_SHIFT) /**< Value for 2Hz beacon period. */
+#define BEACON_PERIOD_4_HZ (0x03u << BEACON_PERIOD_SHIFT) /**< Value for 4Hz beacon period. */
+#define BEACON_PERIOD_8_HZ (0x04u << BEACON_PERIOD_SHIFT) /**< Value for 8Hz beacon period. */
+#define PAIRING_AVAILABLE_FLAG_SHIFT 0x03u /**< Shift value for masking out pairing enabled bit. */
+#define PAIRING_AVAILABLE_FLAG_MASK (0x01u << PAIRING_AVAILABLE_FLAG_SHIFT) /**< Pairing enabled bitmask. */
+#define UPLOAD_ENABLED_FLAG_SHIFT 0x04u /**< Shift value for masking out upload enabled bit. */
+#define UPLOAD_ENABLED_FLAG_MASK (0x01u << UPLOAD_ENABLED_FLAG_SHIFT) /**< Upload enabled bitmask. */
+#define DATA_AVAILABLE_FLAG_SHIFT 0x05u /**< Shift value for masking out data available bit. */
+#define DATA_AVAILABLE_FLAG_MASK (0x01u << DATA_AVAILABLE_FLAG_SHIFT) /**< Data available bitmask. */
+
+#if ANTFS_ENABLED
+// Build the default beacon settings.
+#if ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+ #define ANTFS_PAIRING_BIT PAIRING_AVAILABLE_FLAG_MASK /**< Build pairing enabled default beacon setting. */
+#else
+ #define ANTFS_PAIRING_BIT 0x00u /**< Build pairing disabled default beacon setting. */
+#endif // ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED
+#if ANTFS_CONFIG_UPLOAD_ENABLED
+ #define ANTFS_UPLOAD_BIT UPLOAD_ENABLED_FLAG_MASK /**< Build upload enabled default beacon setting. */
+#else
+ #define ANTFS_UPLOAD_BIT 0x00u /**< Build upload disabled default beacon setting. */
+#endif // ANTFS_CONFIG_UPLOAD_ENABLED
+
+#define ANTFS_DEFAULT_BEACON (ANTFS_CONFIG_BEACON_STATUS_PERIOD | ANTFS_UPLOAD_BIT | ANTFS_PAIRING_BIT | DATA_AVAILABLE_FLAG_MASK) /**< Define the default beacon setting. */
+#endif // ANTFS_ENABLED
+
+// Download/Upload responses.
+#define RESPONSE_MESSAGE_OK 0x00u /**< Download request ok. */
+#define RESPONSE_MESSAGE_NOT_EXIST 0x01u /**< File does not exist. */
+#define RESPONSE_MESSAGE_NOT_AVAILABLE 0x02u /**< File can not be read/written to (download/upload respectively). */
+#define RESPONSE_INVALID_OPERATION 0x04u /**< Request invalid. */
+// Download responses.
+#define RESPONSE_MESSAGE_NOT_READY 0x03u /**< Not ready to download. */
+#define RESPONSE_INVALID_CRC 0x05u /**< CRC incorrect. */
+// Upload responses.
+#define RESPONSE_MESSAGE_NOT_ENOUGH_SPACE 0x03u /**< Not enough space to to complete write. */
+#define RESPONSE_MESSAGE_UPLOAD_NOT_READY 0x05u /**< Not ready to upload */
+// Upload/Erase responses.
+#define RESPONSE_MESSAGE_FAIL 0x01u /**< Data File Index does not exist / Erase failed. */
+
+// Directory general file flags.
+#define ANTFS_DIR_READ_MASK 0x80u /**< Read (can download). */
+#define ANTFS_DIR_WRITE_MASK 0x40u /**< Write (can upload). */
+#define ANTFS_DIR_ERASE_MASK 0x20u /**< Erase (can erase). */
+#define ANTFS_DIR_ARCHIVE_MASK 0x10u /**< Archive (has been downloaded). */
+#define ANTFS_DIR_APPEND_MASK 0x08u /**< Append (can append to file only). */
+
+#define ANTFS_MAX_FILE_SIZE 0xFFFFFFFFu /**< Maximum file size, as specified by directory structure. */
+#define ANTFS_BURST_BLOCK_SIZE 16u /**< Size of each block of burst data that the client attempts to send when it processes a data request event. */
+
+/**@brief ANT-FS beacon status. */
+typedef union
+{
+ uint32_t status; /**< Beacon status byte 1. */
+
+ struct
+ {
+ uint8_t link_period : 3; /**< Beacon period (0.5 - 8 Hz). */
+ bool is_pairing_enabled : 1; /**< Pairing is enabled/disabled. */
+ bool is_upload_enabled : 1; /**< Upload is enabled/disabled. */
+ bool is_data_available : 1; /**< Data is available for download / no data available. */
+ uint8_t reserved : 2; /**< Reserved. */
+ } parameters;
+} antfs_beacon_status_byte1_t;
+
+// ANT-FS states.
+typedef enum
+{
+ ANTFS_STATE_OFF, /**< Off state. */
+ ANTFS_STATE_INIT, /**< Init state. */
+ ANTFS_STATE_LINK, /**< Link state. */
+ ANTFS_STATE_AUTH, /**< Authenticate state. */
+ ANTFS_STATE_TRANS /**< Transport state. */
+} antfs_state_t;
+
+// ANT-FS link layer substates.
+typedef enum
+{
+ ANTFS_LINK_SUBSTATE_NONE /**< None state. */
+} antfs_link_substate_t;
+
+// ANT-FS authenticate layer substates. */
+typedef enum
+{
+ ANTFS_AUTH_SUBSTATE_NONE, /**< None state. */
+ ANTFS_AUTH_SUBSTATE_PAIR, /**< Pairing state. */
+ ANTFS_AUTH_SUBSTATE_PASSKEY, /**< Passkey state. */
+ ANTFS_AUTH_SUBSTATE_ACCEPT, /**< Authenticate accept state. */
+ ANTFS_AUTH_SUBSTATE_REJECT /**< Authenticate reject state. */
+} antfs_authenticate_substate_t;
+
+// ANT-FS transport layer substates. */
+typedef enum
+{
+ ANTFS_TRANS_SUBSTATE_NONE, /**< None state. */
+ ANTFS_TRANS_SUBSTATE_VERIFY_CRC, /**< Verify CRC state. */
+ ANTFS_TRANS_SUBSTATE_DOWNLOADING, /**< Downloading state. */
+ ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA, /**< Wait for upload data request state. */
+ ANTFS_TRANS_SUBSTATE_UPLOADING, /**< Ready / receiving upload data state. */
+ ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME /**< RX failure upon receiving upload data state. */
+} antfs_transport_substate_t;
+
+// ANT-FS Events.
+typedef enum
+{
+ ANTFS_EVENT_PAIRING_REQUEST = 0xB0, /**< Pairing request event. */
+ ANTFS_EVENT_PAIRING_TIMEOUT = 0xB1, /**< Pairing timeout event. */
+ ANTFS_EVENT_OPEN_COMPLETE = 0xB2, /**< Channel setup complete event. */
+ ANTFS_EVENT_CLOSE_COMPLETE = 0xB4, /**< Channel closed event. */
+ ANTFS_EVENT_LINK = 0xB6, /**< Enter link layer event. */
+ ANTFS_EVENT_AUTH = 0xB7, /**< Enter authenticate layer event. */
+ ANTFS_EVENT_TRANS = 0xB8, /**< Enter transport layer event. */
+ ANTFS_EVENT_DOWNLOAD_REQUEST = 0xB9, /**< Download request event. */
+ ANTFS_EVENT_DOWNLOAD_REQUEST_DATA = 0xBA, /**< Download request data event. */
+ ANTFS_EVENT_DOWNLOAD_START = 0xBB, /**< Download started event. */
+ ANTFS_EVENT_DOWNLOAD_COMPLETE = 0xBC, /**< Download completed event. */
+ ANTFS_EVENT_DOWNLOAD_FAIL = 0xBD, /**< Download failed event. */
+ ANTFS_EVENT_UPLOAD_REQUEST = 0xBE, /**< Upload request event. */
+ ANTFS_EVENT_UPLOAD_DATA = 0xBF, /**< Upload data available for read event. */
+ ANTFS_EVENT_UPLOAD_START = 0xC0, /**< Upload begin event. */
+ ANTFS_EVENT_UPLOAD_COMPLETE = 0xC1, /**< Upload completed event. */
+ ANTFS_EVENT_UPLOAD_FAIL = 0xC2, /**< Upload process failed event. */
+ ANTFS_EVENT_ERASE_REQUEST = 0xC3 /**< Erase request event. */
+} antfs_event_t;
+
+/**@brief ANT-FS <-> application event communication object. */
+typedef struct
+{
+ antfs_event_t event; /**< ANT-FS event. */
+ uint16_t file_index; /**< File index (download/upload/erase). */
+ uint32_t offset; /**< Current offset (download/upload). */
+ uint32_t bytes; /**< Number of bytes in block (download/upload). */
+ uint16_t crc; /**< Current CRC (upload). */
+ uint8_t data[8]; /**< Block of data (upload). */
+} antfs_event_return_t;
+
+/**@brief ANT-FS parameters. */
+typedef struct
+{
+ uint32_t client_serial_number; /**< Client serial number. */
+ uint16_t beacon_device_type; /**< Client device type. */
+ uint16_t beacon_device_manufacturing_id; /**< Client manufacturing ID. */
+ uint8_t beacon_frequency; /**< Beacon RF Frequency. */
+ antfs_beacon_status_byte1_t beacon_status_byte1; /**< Beacon status byte 1. */
+ const uint8_t * p_pass_key; /**< Pass Key. */
+ const uint8_t * p_remote_friendly_name; /**< Friendly Name. */
+} antfs_params_t;
+
+/**@brief ANT-FS directory header. */
+typedef struct
+{
+ uint8_t version; /**< Version of the directory file structure. */
+ uint8_t length; /**< Length of each structure, in bytes. */
+ uint8_t time_format; /**< Defines how system keeps track of date/time stamps. */
+ uint8_t reserved01;
+ uint8_t reserved02;
+ uint8_t reserved03;
+ uint8_t reserved04;
+ uint8_t reserved05;
+ uint32_t system_time; /**< Number of seconds elapsed since system power up. */
+ uint32_t date; /**< Number of seconds elapsed since 00:00 hrs Dec 31, 1989. If system time is unknown, used as counter. */
+} antfs_dir_header_t;
+
+/**@brief ANT-FS directory entry. */
+typedef struct
+{
+ uint16_t data_file_index; /**< Data file index. */
+ uint8_t file_data_type; /**< File data type. */
+ uint8_t user_defined1; /**< Identifier, first byte (structure defined by data type). */
+ uint16_t user_defined2; /**< Identifier, last two bytes (structure defined by data type). */
+ uint8_t user_flags; /**< File data type specific flags (bits defined by data type). */
+ uint8_t general_flags; /**< Bit mapped flags of flag permissions. */
+ uint32_t file_size_in_bytes; /**< File size, in bytes. */
+ uint32_t date; /**< Number of seconds elapsed since 00:00 hrs Dec 31, 1980, if supported. */
+} antfs_dir_struct_t;
+
+/**@brief ANT-FS download/upload request context. */
+typedef struct
+{
+ ulong_union_t file_size; /**< Size of a file to download when reading, or the size of a partially completed upload when writing. */
+ uint32_t max_file_size; /**< The maximum size of the file specified, this is the file size when reading, and the maximum allowed file size when writing. */
+ ulong_union_t max_burst_block_size; /**< Maximum burst block size. */
+ ushort_union_t file_index; /**< File index. */
+ uint16_t file_crc; /**< CRC (uploads). */
+} antfs_request_info_t;
+
+/**@brief The burst wait handler can be configured by the application to customize the code that is
+ * executed while waiting for the burst busy flag. */
+typedef void(*antfs_burst_wait_handler_t)(void);
+
+/**@brief Function for setting initial ANT-FS configuration parameters.
+ *
+ * @param[in] p_params The initial ANT-FS configuration parameters.
+ * @param[in] burst_wait_handler Burst wait handler.
+ */
+void antfs_init(const antfs_params_t * const p_params,
+ antfs_burst_wait_handler_t burst_wait_handler);
+
+/**@brief Function for getting host name if received.
+ *
+ * @return Pointer to host name buffer if a host name was recieved, NULL otherwise.
+ */
+const char * antfs_hostname_get(void);
+
+/**@brief Function for transmitting a response to a pairing request issued by ANT-FS host.
+ *
+ * @param[in] accept The pairing response, true if pairing accepted.
+ *
+ * @retval true Operation success. Response to a pairing request was transmitted.
+ * @retval false Operation failure. Not in pairing mode or pairing not supported by the
+ * implementation.
+ */
+bool antfs_pairing_resp_transmit(bool accept);
+
+/**@brief Function for doing calculations prior downloading the data to the ANT-FS host.
+ *
+ * Function does the necessary pre processing calculations, which are required prior downloading the
+ * data, and also transmits the download request response right away in case of the download request
+ * was rejected or there is no data to send.
+ *
+ * @param[in] response The download request response code.
+ * @param[in] p_request_info ANT-FS request info structure.
+ */
+void antfs_download_req_resp_prepare(uint8_t response,
+ const antfs_request_info_t * const p_request_info);
+
+/**@brief Function for downloading requested data.
+ *
+ * @param[in] index Index of the current file downloaded.
+ * @param[in] offset Offset specified by client.
+ * @param[in] num_bytes Number of bytes requested to be transmitted from the buffer.
+ * @param[in] p_message Data buffer to be transmitted.
+ *
+ * @return Number of data bytes transmitted.
+ */
+uint32_t antfs_input_data_download(uint16_t index,
+ uint32_t offset,
+ uint32_t num_bytes,
+ const uint8_t * const p_message);
+
+/**@brief Function for transmitting upload request response to a upload request command by ANT-FS
+ * host.
+ *
+ * @param[in] response The upload response code.
+ * @param[in] p_request_info ANT-FS request info structure.
+ *
+ * @retval true Operation success. Response to upload request command was transmitted.
+ * @retval false Operation failure. Upload not supported by the implementation or not in correct
+ * state or application is sending a response for a different file
+ * than requested.
+ */
+bool antfs_upload_req_resp_transmit(uint8_t response,
+ const antfs_request_info_t * const p_request_info);
+
+/**@brief Function for transmitting upload data response to a upload data command by ANT-FS host.
+ *
+ * @param[in] data_upload_success The upload response code, true for success.
+ *
+ * @retval true Operation success. Response to upload data command was transmitted.
+ * @retval false Operation failure. Upload not supported by the implementation or not in correct
+ * state.
+ */
+bool antfs_upload_data_resp_transmit(bool data_upload_success);
+
+/**@brief Function for transmitting erase response to a erase request.
+ *
+ * @param[in] response The erase response code.
+ */
+void antfs_erase_req_resp_transmit(uint8_t response);
+
+/**@brief Function for extracting possible pending ANT-FS event.
+ *
+ * @param[out] p_event The output event structure.
+ *
+ * @retval true Operation success. Pending ANT-FS event available and it was copied to the output
+ * event structure.
+ * @retval false Operation failure. No pending ANT-FS event available.
+ */
+bool antfs_event_extract(antfs_event_return_t * const p_event);
+
+/**@brief Function for processing ANT events and data received from the ANT-FS channel.
+ *
+ * @param[in] p_message The message buffer containing the message received from the ANT-FS
+ * channel.
+ */
+void antfs_message_process(uint8_t * p_message);
+
+/**@brief Function for setting up the ANT-FS channel.
+ */
+void antfs_channel_setup(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANTFS_H__
+
+/**
+ *@}
+ **/
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.c
new file mode 100644
index 0000000..ee26d88
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.c
@@ -0,0 +1,98 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2012
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+#include "crc.h"
+#include "compiler_abstraction.h"
+
+
+/**@brief Function for updating the current CRC-16 value for a single byte input.
+ *
+ * @param[in] current_crc The current calculated CRC-16 value.
+ * @param[in] byte The input data byte for the computation.
+ *
+ * @return The updated CRC-16 value, based on the input supplied.
+ */
+static __INLINE uint16_t crc16_get(uint16_t current_crc, uint8_t byte)
+{
+ static const uint16_t crc16_table[16] =
+ {
+ 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
+ 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400
+ };
+
+ uint16_t temp;
+
+ // Compute checksum of lower four bits of a byte.
+ temp = crc16_table[current_crc & 0xF];
+ current_crc = (current_crc >> 4u) & 0x0FFFu;
+ current_crc = current_crc ^ temp ^ crc16_table[byte & 0xF];
+
+ // Now compute checksum of upper four bits of a byte.
+ temp = crc16_table[current_crc & 0xF];
+ current_crc = (current_crc >> 4u) & 0x0FFFu;
+ current_crc = current_crc ^ temp ^ crc16_table[(byte >> 4u) & 0xF];
+
+ return current_crc;
+}
+
+
+uint16_t crc_crc16_update(uint16_t current_crc, const volatile void * p_data, uint32_t size)
+{
+ uint8_t * p_block = (uint8_t *)p_data;
+
+ while (size != 0)
+ {
+ current_crc = crc16_get(current_crc, *p_block);
+ p_block++;
+ size--;
+ }
+
+ return current_crc;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.h
new file mode 100644
index 0000000..dffa5ad
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/crc.h
@@ -0,0 +1,94 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2012
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+/** @file
+ * @brief The CRC-16 interface.
+ * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012
+ * @defgroup ant_fs_client_main ANT-FS client device simulator
+ * @{
+ * @ingroup ant_fs
+ *
+ * @brief The ANT-FS client device simulator.
+ *
+ */
+
+#ifndef CRC_H__
+#define CRC_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for calculating CRC-16 in blocks.
+ *
+ * Feed each consecutive data block into this function, along with the current value of current_crc
+ * as returned by the previous call of this function. The first call of this function should pass
+ * the initial value (usually 0) of the crc in current_crc.
+
+ * @param[in] current_crc The current calculated CRC-16 value.
+ * @param[in] p_data The input data block for computation.
+ * @param[in] size The size of the input data block in bytes.
+ *
+ * @return The updated CRC-16 value, based on the input supplied.
+ */
+uint16_t crc_crc16_update(uint16_t current_crc, const volatile void * p_data, uint32_t size);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CRC_H__
+
+/**
+ *@}
+ **/
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/defines.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/defines.h
new file mode 100644
index 0000000..266de5c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_fs/defines.h
@@ -0,0 +1,109 @@
+/**
+ * This software is subject to the ANT+ Shared Source License
+ * www.thisisant.com/swlicenses
+ * Copyright (c) Dynastream Innovations, Inc. 2012
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ * 1) Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2) Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * 3) Neither the name of Dynastream nor the names of its
+ * contributors may be used to endorse or promote products
+ * derived from this software without specific prior
+ * written permission.
+ *
+ * The following actions are prohibited:
+ * 1) Redistribution of source code containing the ANT+ Network
+ * Key. The ANT+ Network Key is available to ANT+ Adopters.
+ * Please refer to http://thisisant.com to become an ANT+
+ * Adopter and access the key.
+ *
+ * 2) Reverse engineering, decompilation, and/or disassembly of
+ * software provided in binary form under this license.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; DAMAGE TO ANY DEVICE, LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE. SOME STATES DO NOT ALLOW
+ * THE EXCLUSION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE
+ * ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
+ *
+ */
+/**@file
+ * @brief Definitions.
+ * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012
+ * @defgroup ant_fs_client_main ANT-FS client device simulator
+ * @{
+ * @ingroup nrf_ant_fs_client
+ *
+ * @brief The ANT-FS client device simulator.
+ *
+ */
+
+#ifndef DEFINES_H__
+#define DEFINES_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_ULONG 0xFFFFFFFFu /**< The Max value for the type. */
+
+/**@brief uint16_t type presentation as an union. */
+typedef union
+{
+ uint16_t data; /**< The data content. */
+
+ struct
+ {
+ uint8_t low; /**< The low byte of the data content. */
+ uint8_t high; /**< The high byte of the data content. */
+ } bytes;
+} ushort_union_t;
+
+/**@brief uint32_t type presentation as an union. */
+typedef union
+{
+ uint32_t data; /**< The data content as a single variable. */
+ uint8_t data_bytes[sizeof(uint32_t)]; /**< The data content as a byte array. */
+
+ struct
+ {
+ // The least significant byte of the uint32_t in this structure is referenced by byte0.
+ uint8_t byte0; /**< Byte 0 of the data content. */
+ uint8_t byte1; /**< Byte 1 of the data content. */
+ uint8_t byte2; /**< Byte 2 of the data content. */
+ uint8_t byte3; /**< Byte 3 of the data content. */
+ } bytes;
+} ulong_union_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // DEFINES_H__
+
+/**
+ *@}
+ **/
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.c
new file mode 100644
index 0000000..d9543b3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.c
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_KEY_MANAGER)
+#include <stdio.h>
+#include "ant_key_manager.h"
+#include "ant_key_manager_config.h"
+#include "ant_interface.h"
+#include "nrf_assert.h"
+
+static uint8_t m_ant_plus_network_key[] = ANT_PLUS_NETWORK_KEY;
+static uint8_t m_ant_fs_network_key[] = ANT_FS_NETWORK_KEY;
+
+uint32_t ant_custom_key_set(uint8_t network_number, uint8_t * network_key)
+{
+ ASSERT(network_key != NULL);
+ return sd_ant_network_address_set(network_number, network_key);
+}
+
+uint32_t ant_plus_key_set(uint8_t network_number)
+{
+ return sd_ant_network_address_set(network_number, m_ant_plus_network_key);
+}
+
+uint32_t ant_fs_key_set(uint8_t network_number)
+{
+ return sd_ant_network_address_set(network_number, m_ant_fs_network_key);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_KEY_MANAGER)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.h
new file mode 100644
index 0000000..2971de9
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/ant_key_manager.h
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_KEY_MANAGER_H__
+#define ANT_KEY_MANAGER_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file
+ */
+/**
+ * @defgroup ant_key_manager ANT key manager
+ * @{
+ * @ingroup ant_sdk_utils
+ * @brief Module for registering common and custom ANT network keys.
+ */
+
+/**@brief Function for registering a custom network key.
+ *
+ * @param[in] network_number Network key number.
+ * @param[in] p_network_key Pointer to the custom ANT network key.
+ *
+ * @return A SoftDevice error code.
+ */
+uint32_t ant_custom_key_set(uint8_t network_number, uint8_t * p_network_key);
+
+/**@brief Function for registering an ANT+ network key.
+ *
+ * The key must be defined by @ref ANT_PLUS_NETWORK_KEY.
+ *
+ * @note The ANT+ Network Key is available for ANT+ Adopters. Go to http://thisisant.com
+ * to become an ANT+ Adopter and access the key.
+ *
+ * @param[in] network_number Network key number.
+ *
+ * @return A SoftDevice error code.
+ */
+uint32_t ant_plus_key_set(uint8_t network_number);
+
+/**@brief Function for registering an ANT-FS network key.
+ *
+ * The key must be defined by @ref ANT_FS_NETWORK_KEY.
+ *
+ * @note The ANT+ Network Key is available for ANT+ Adopters. Go to http://thisisant.com
+ * to become an ANT+ Adopter and access the key.
+ *
+ * @param[in] network_number Network key number.
+ *
+ * @return A SoftDevice error code.
+ */
+uint32_t ant_fs_key_set(uint8_t network_number);
+
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_KEY_MANAGER_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/config/ant_key_manager_config.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/config/ant_key_manager_config.h
new file mode 100644
index 0000000..97d42ed
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_key_manager/config/ant_key_manager_config.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_KEY_MANAGER_CONFIG_H__
+#define ANT_KEY_MANAGER_CONFIG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ant_key_manager
+ * @{
+ */
+
+#ifndef ANT_PLUS_NETWORK_KEY
+ #define ANT_PLUS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT+ network key. */
+#endif //ANT_PLUS_NETWORK_KEY
+
+#ifndef ANT_FS_NETWORK_KEY
+ #define ANT_FS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT-FS network key. */
+#endif // ANT_FS_NETWORK_KEY
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_KEY_MANAGER_CONFIG_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c
new file mode 100644
index 0000000..3241ecd
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c
@@ -0,0 +1,490 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include "nrf_assert.h"
+#include "app_error.h"
+#include "ant_interface.h"
+#include "ant_bpwr.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr
+#if ANT_BPWR_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_INFO_COLOR
+#else // ANT_BPWR_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+#define BPWR_CALIB_INT_TIMEOUT ((ANT_CLOCK_FREQUENCY * BPWR_CALIBRATION_TIMOUT_S) / BPWR_MSG_PERIOD) // calibration timeout in ant message period's unit
+
+// for torque sensor Minimum: Interleave every 9th message
+#define BPWR_PAGE_16_INTERVAL 5 // Preferred: Interleave every 5th message
+#define BPWR_PAGE_16_INTERVAL_OFS 2 // Permissible offset
+#define COMMON_PAGE_80_INTERVAL 119 // Minimum: Interleave every 121 messages
+#define COMMON_PAGE_81_INTERVAL 120 // Minimum: Interleave every 121 messages
+#define AUTO_ZERO_SUPPORT_INTERVAL 120 // Minimum: Interleave every 121 messages
+
+/**@brief Bicycle power message data layout structure. */
+typedef struct
+{
+ uint8_t page_number;
+ uint8_t page_payload[7];
+} ant_bpwr_message_layout_t;
+
+
+/**@brief Function for initializing the ANT Bicycle Power Profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+static ret_code_t ant_bpwr_init(ant_bpwr_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config)
+{
+ p_profile->channel_number = p_channel_config->channel_number;
+
+ p_profile->page_1 = DEFAULT_ANT_BPWR_PAGE1();
+ p_profile->page_16 = DEFAULT_ANT_BPWR_PAGE16();
+ p_profile->page_17 = DEFAULT_ANT_BPWR_PAGE17();
+ p_profile->page_18 = DEFAULT_ANT_BPWR_PAGE18();
+ p_profile->page_80 = DEFAULT_ANT_COMMON_page80();
+ p_profile->page_81 = DEFAULT_ANT_COMMON_page81();
+
+ NRF_LOG_INFO("ANT B-PWR channel %u init", p_profile->channel_number);
+ return ant_channel_init(p_channel_config);
+}
+
+
+ret_code_t ant_bpwr_disp_init(ant_bpwr_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bpwr_disp_config_t const * p_disp_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_disp_config != NULL);
+ ASSERT(p_disp_config->evt_handler != NULL);
+ ASSERT(p_disp_config->p_cb != NULL);
+
+ p_profile->evt_handler = p_disp_config->evt_handler;
+ p_profile->_cb.p_disp_cb = p_disp_config->p_cb;
+
+ p_profile->_cb.p_disp_cb ->calib_timeout = 0;
+ p_profile->_cb.p_disp_cb ->calib_stat = BPWR_DISP_CALIB_NONE;
+
+ return ant_bpwr_init(p_profile, p_channel_config);
+}
+
+
+ret_code_t ant_bpwr_sens_init(ant_bpwr_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bpwr_sens_config_t const * p_sens_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_sens_config != NULL);
+ ASSERT(p_sens_config->p_cb != NULL);
+ ASSERT(p_sens_config->evt_handler != NULL);
+ ASSERT(p_sens_config->calib_handler != NULL);
+
+ p_profile->evt_handler = p_sens_config->evt_handler;
+ p_profile->_cb.p_sens_cb = p_sens_config->p_cb;
+
+ p_profile->_cb.p_sens_cb->torque_use = p_sens_config->torque_use;
+ p_profile->_cb.p_sens_cb->calib_handler = p_sens_config->calib_handler;
+ p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_NONE;
+ p_profile->_cb.p_sens_cb->message_counter = 0;
+
+ return ant_bpwr_init(p_profile, p_channel_config);
+}
+
+
+
+/**@brief Function for getting next page number to send.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @return Next page number.
+ */
+static ant_bpwr_page_t next_page_number_get(ant_bpwr_profile_t * p_profile)
+{
+ ant_bpwr_sens_cb_t * p_bpwr_cb = p_profile->_cb.p_sens_cb;
+ ant_bpwr_page_t page_number;
+
+ if (p_bpwr_cb->calib_stat == BPWR_SENS_CALIB_READY)
+ {
+ page_number = ANT_BPWR_PAGE_1;
+ p_bpwr_cb->calib_stat = BPWR_SENS_CALIB_NONE; // mark event as processed
+ }
+ else if ((p_profile->BPWR_PROFILE_auto_zero_status != ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED)
+ && (p_bpwr_cb->message_counter == AUTO_ZERO_SUPPORT_INTERVAL))
+ {
+ page_number = ANT_BPWR_PAGE_1;
+ p_profile->BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_AUTO_SUPPORT;
+ p_bpwr_cb->message_counter++;
+ }
+ else if (p_bpwr_cb->message_counter >= COMMON_PAGE_81_INTERVAL)
+ {
+ page_number = ANT_BPWR_PAGE_81;
+ p_bpwr_cb->message_counter = 0;
+ }
+ else
+ {
+ if (p_bpwr_cb->message_counter == COMMON_PAGE_80_INTERVAL)
+ {
+ page_number = ANT_BPWR_PAGE_80;
+ }
+ else
+ {
+ if ( p_bpwr_cb->torque_use == TORQUE_NONE)
+ {
+ page_number = ANT_BPWR_PAGE_16;
+ }
+ else if ((p_bpwr_cb->message_counter % BPWR_PAGE_16_INTERVAL)
+ == BPWR_PAGE_16_INTERVAL_OFS)
+ {
+ page_number = ANT_BPWR_PAGE_16;
+ }
+ else if ( p_bpwr_cb->torque_use == TORQUE_WHEEL)
+ {
+ page_number = ANT_BPWR_PAGE_17;
+ }
+ else // assumed TORQUE_CRANK
+ {
+ page_number = ANT_BPWR_PAGE_18;
+ }
+ }
+ p_bpwr_cb->message_counter++;
+ }
+
+ return page_number;
+}
+
+
+/**@brief Function for encoding Bicycle Power Sensor message.
+ *
+ * @note Assume to be call each time when Tx window will occur.
+ */
+static void sens_message_encode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ ant_bpwr_message_layout_t * p_bpwr_message_payload =
+ (ant_bpwr_message_layout_t *)p_message_payload;
+
+ p_bpwr_message_payload->page_number = next_page_number_get(p_profile);
+
+ NRF_LOG_INFO("B-PWR tx page: %u", p_bpwr_message_payload->page_number);
+
+ switch (p_bpwr_message_payload->page_number)
+ {
+ case ANT_BPWR_PAGE_1:
+ ant_bpwr_page_1_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_1));
+ break;
+
+ case ANT_BPWR_PAGE_16:
+ ant_bpwr_page_16_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_16));
+ ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_BPWR_PAGE_17:
+ ant_bpwr_page_17_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_17));
+ ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_BPWR_PAGE_18:
+ ant_bpwr_page_18_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_18));
+ ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_COMMON_PAGE_80:
+ ant_common_page_80_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_80));
+ break;
+
+ case ANT_COMMON_PAGE_81:
+ ant_common_page_81_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_81));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_bpwr_evt_t)p_bpwr_message_payload->page_number);
+
+}
+
+
+/**@brief Function for decoding messages received by Bicycle Power sensor message.
+ *
+ * @note Assume to be call each time when Rx window will occur.
+ */
+static void sens_message_decode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ const ant_bpwr_message_layout_t * p_bpwr_message_payload =
+ (ant_bpwr_message_layout_t *)p_message_payload;
+ ant_bpwr_page1_data_t page1;
+
+ switch (p_bpwr_message_payload->page_number)
+ {
+ case ANT_BPWR_PAGE_1:
+ ant_bpwr_page_1_decode(p_bpwr_message_payload->page_payload, &page1);
+ p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_REQUESTED;
+ p_profile->_cb.p_sens_cb->calib_handler(p_profile, &page1);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/**@brief Function for decoding messages received by Bicycle Power display message.
+ *
+ * @note Assume to be call each time when Rx window will occur.
+ */
+static void disp_message_decode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ const ant_bpwr_message_layout_t * p_bpwr_message_payload =
+ (ant_bpwr_message_layout_t *)p_message_payload;
+
+ NRF_LOG_INFO("B-PWR rx page: %u", p_bpwr_message_payload->page_number);
+
+ switch (p_bpwr_message_payload->page_number)
+ {
+ case ANT_BPWR_PAGE_1:
+ ant_bpwr_page_1_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_1));
+ p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_NONE;
+ break;
+
+ case ANT_BPWR_PAGE_16:
+ ant_bpwr_page_16_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_16));
+ ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_BPWR_PAGE_17:
+ ant_bpwr_page_17_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_17));
+ ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_BPWR_PAGE_18:
+ ant_bpwr_page_18_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_18));
+ ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_COMMON_PAGE_80:
+ ant_common_page_80_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_80));
+ break;
+
+ case ANT_COMMON_PAGE_81:
+ ant_common_page_81_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_81));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_bpwr_evt_t)p_bpwr_message_payload->page_number);
+}
+
+
+ret_code_t ant_bpwr_calib_request(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page_1)
+{
+ ant_bpwr_message_layout_t bpwr_message_payload;
+
+ if (p_profile->_cb.p_disp_cb->calib_stat == BPWR_DISP_CALIB_REQUESTED)
+ {
+ return NRF_SUCCESS; // calibration in progress, so omit this request
+ }
+
+ bpwr_message_payload.page_number = ANT_BPWR_PAGE_1;
+ ant_bpwr_page_1_encode(bpwr_message_payload.page_payload, p_page_1);
+
+ uint32_t err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number,
+ sizeof (bpwr_message_payload),
+ (uint8_t *) &bpwr_message_payload);
+
+ if (err_code == NRF_SUCCESS)
+ {
+ p_profile->_cb.p_disp_cb->calib_timeout = BPWR_CALIB_INT_TIMEOUT; // initialize watch on calibration's time-out
+ p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_REQUESTED;
+ NRF_LOG_INFO("Start calibration process");
+ }
+ return err_code;
+}
+
+
+void ant_bpwr_calib_response(ant_bpwr_profile_t * p_profile)
+{
+ if (p_profile->_cb.p_sens_cb->calib_stat != BPWR_SENS_CALIB_READY) // abort if callback request is in progress
+ {
+ p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_READY; // calibration respond
+ }
+}
+
+
+/**@brief Function for hangling calibration events.
+ */
+static void service_calib(ant_bpwr_profile_t * p_profile, uint8_t event)
+{
+ ant_bpwr_evt_t bpwr_event;
+
+ if (p_profile->_cb.p_disp_cb->calib_stat == BPWR_DISP_CALIB_REQUESTED)
+ {
+ switch (event)
+ {
+ case EVENT_RX:
+ /* fall through */
+ case EVENT_RX_FAIL:
+
+ if (p_profile->_cb.p_disp_cb->calib_timeout-- == 0)
+ {
+ bpwr_event = ANT_BPWR_CALIB_TIMEOUT;
+ break;
+ }
+ else
+ {
+ return;
+ }
+
+ case EVENT_TRANSFER_TX_FAILED:
+ bpwr_event = ANT_BPWR_CALIB_REQUEST_TX_FAILED;
+ break;
+
+ case EVENT_RX_SEARCH_TIMEOUT:
+ bpwr_event = ANT_BPWR_CALIB_TIMEOUT;
+ break;
+
+ default:
+ return;
+ }
+
+ NRF_LOG_INFO("End calibration process");
+ p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_NONE;
+
+ p_profile->evt_handler(p_profile, bpwr_event);
+ }
+}
+
+
+static void ant_message_send(ant_bpwr_profile_t * p_profile)
+{
+ uint32_t err_code;
+ uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE];
+
+ sens_message_encode(p_profile, p_message_payload);
+ err_code =
+ sd_ant_broadcast_message_tx(p_profile->channel_number,
+ sizeof (p_message_payload),
+ p_message_payload);
+ APP_ERROR_CHECK(err_code);
+}
+
+
+ret_code_t ant_bpwr_disp_open(ant_bpwr_profile_t * p_profile)
+{
+ NRF_LOG_INFO("ANT B-PWR %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+
+ret_code_t ant_bpwr_sens_open(ant_bpwr_profile_t * p_profile)
+{
+ // Fill tx buffer for the first frame
+ ant_message_send(p_profile);
+
+ NRF_LOG_INFO("ANT B-PWR %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+
+void ant_bpwr_sens_evt_handler(ant_evt_t * p_ant_event, void * p_context)
+{
+ ant_bpwr_profile_t * p_profile = ( ant_bpwr_profile_t *)p_context;
+
+ if (p_ant_event->channel == p_profile->channel_number)
+ {
+ switch (p_ant_event->event)
+ {
+ case EVENT_TX:
+ ant_message_send(p_profile);
+ break;
+
+ case EVENT_RX:
+ if (p_ant_event->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID)
+ {
+ sens_message_decode(p_profile, p_ant_event->message.ANT_MESSAGE_aucPayload);
+ }
+ break;
+
+ default:
+ // No implementation needed
+ break;
+ }
+ }
+}
+
+
+void ant_bpwr_disp_evt_handler(ant_evt_t * p_ant_event, void * p_context)
+{
+ ant_bpwr_profile_t * p_profile = ( ant_bpwr_profile_t *)p_context;
+
+ if (p_ant_event->channel == p_profile->channel_number)
+ {
+ switch (p_ant_event->event)
+ {
+ case EVENT_RX:
+
+ if (p_ant_event->message.ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
+ || p_ant_event->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
+ || p_ant_event->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
+ {
+ disp_message_decode(p_profile, p_ant_event->message.ANT_MESSAGE_aucPayload);
+ }
+ break;
+
+ default:
+ break;
+ }
+ service_calib(p_profile, p_ant_event->event);
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h
new file mode 100644
index 0000000..a9fd093
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h
@@ -0,0 +1,377 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/**
+ * @file
+ * @defgroup ant_bpwr Bicycle Power profile
+ * @{
+ * @ingroup ant_sdk_profiles
+ * @brief This module implements the Bicycle Power profile.
+ *
+ */
+
+ #ifndef ANT_BICYCLE_POWER_H__
+ #define ANT_BICYCLE_POWER_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_parameters.h"
+#include "nrf_sdh_ant.h"
+#include "ant_channel_config.h"
+#include "ant_bpwr_pages.h"
+#include "sdk_errors.h"
+
+#define BPWR_DEVICE_TYPE 0x0Bu ///< Device type reserved for ANT+ Bicycle Power.
+#define BPWR_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz).
+#define BPWR_MSG_PERIOD 8182u ///< Message period, decimal 8182 (4.0049 Hz).
+
+#define BPWR_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+#define BPWR_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE ///< Display Bicycle Power channel type.
+#define BPWR_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor Bicycle Power channel type.
+
+#define BPWR_CALIBRATION_TIMOUT_S 5u ///< Time-out for responding to calibration callback (s).
+
+
+/**@brief Initialize an ANT channel configuration structure for the Bicycle Power profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ */
+#define BPWR_DISP_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER) \
+static const ant_channel_config_t CONCAT_2(NAME, _channel_bpwr_disp_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = BPWR_DISP_CHANNEL_TYPE, \
+ .ext_assign = BPWR_EXT_ASSIGN, \
+ .rf_freq = BPWR_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = BPWR_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = BPWR_MSG_PERIOD, \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define BPWR_DISP_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME, _channel_bpwr_disp_config)
+
+/**@brief Initialize an ANT channel configuration structure for the Bicycle Power profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ */
+#define BPWR_SENS_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER) \
+static const ant_channel_config_t CONCAT_2(NAME, _channel_bpwr_sens_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = BPWR_SENS_CHANNEL_TYPE, \
+ .ext_assign = BPWR_EXT_ASSIGN, \
+ .rf_freq = BPWR_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = BPWR_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = BPWR_MSG_PERIOD, \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define BPWR_SENS_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME, _channel_bpwr_sens_config)
+
+/**@brief Initialize an ANT profile configuration structure for the BPWR profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the BPWR profile.
+ */
+#define BPWR_DISP_PROFILE_CONFIG_DEF(NAME, \
+ EVT_HANDLER) \
+static ant_bpwr_disp_cb_t CONCAT_2(NAME, _bpwr_disp_cb); \
+static const ant_bpwr_disp_config_t CONCAT_2(NAME, _profile_bpwr_disp_config) = \
+ { \
+ .p_cb = &CONCAT_2(NAME, _bpwr_disp_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define BPWR_DISP_PROFILE_CONFIG(NAME) &CONCAT_2(NAME, _profile_bpwr_disp_config)
+
+
+/**@brief Initialize an ANT profile configuration structure for the BPWR profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] TORQUE_USED Determines whether the torque page is included.
+ * @param[in] CALIB_HANDLER Event handler to be called for handling calibration requests.
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the BPWR profile.
+ */
+#define BPWR_SENS_PROFILE_CONFIG_DEF(NAME, \
+ TORQUE_USED, \
+ CALIB_HANDLER, \
+ EVT_HANDLER) \
+static ant_bpwr_sens_cb_t CONCAT_2(NAME, _bpwr_sens_cb); \
+static const ant_bpwr_sens_config_t CONCAT_2(NAME, _profile_bpwr_sens_config) = \
+ { \
+ .torque_use = (TORQUE_USED), \
+ .calib_handler = (CALIB_HANDLER), \
+ .p_cb = &CONCAT_2(NAME, _bpwr_sens_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define BPWR_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_bpwr_sens_config
+
+
+/**@brief Configuration values for the Bicycle Power torque page. */
+typedef enum
+{
+ TORQUE_NONE = 0,
+ TORQUE_WHEEL = 1,
+ TORQUE_CRANK = 2,
+} ant_bpwr_torque_t;
+
+/**@brief Bicycle Power page number type. */
+typedef enum
+{
+ ANT_BPWR_PAGE_1 = 1, ///< Calibration data page.
+ ANT_BPWR_PAGE_16 = 16, ///< Standard power-only main data page.
+ ANT_BPWR_PAGE_17 = 17, ///< Standard wheel torque main data page.
+ ANT_BPWR_PAGE_18 = 18, ///< Standard crank torque main data page.
+ ANT_BPWR_PAGE_80 = ANT_COMMON_PAGE_80,
+ ANT_BPWR_PAGE_81 = ANT_COMMON_PAGE_81
+} ant_bpwr_page_t;
+
+/**@brief BPWR profile event type. */
+typedef enum
+{
+ ANT_BPWR_PAGE_1_UPDATED = ANT_BPWR_PAGE_1, ///< Data page 1 and speed have been updated (Display) or sent (Sensor).
+ ANT_BPWR_PAGE_16_UPDATED = ANT_BPWR_PAGE_16, ///< Data page 16 and speed have been updated (Display) or sent (Sensor).
+ ANT_BPWR_PAGE_17_UPDATED = ANT_BPWR_PAGE_17, ///< Data page 17 and speed have been updated (Display) or sent (Sensor).
+ ANT_BPWR_PAGE_18_UPDATED = ANT_BPWR_PAGE_18, ///< Data page 18 has been updated (Display) or sent (Sensor).
+ ANT_BPWR_PAGE_80_UPDATED = ANT_BPWR_PAGE_80, ///< Data page 80 has been updated (Display) or sent (Sensor).
+ ANT_BPWR_PAGE_81_UPDATED = ANT_BPWR_PAGE_81, ///< Data page 81 has been updated (Display) or sent (Sensor).
+ ANT_BPWR_CALIB_TIMEOUT, ///< Request of calibration time-out occurred (Display).
+ ANT_BPWR_CALIB_REQUEST_TX_FAILED, ///< Calibration request did not reach the destination (Display).
+} ant_bpwr_evt_t;
+
+// Forward declaration of the ant_bpwr_profile_t type.
+typedef struct ant_bpwr_profile_s ant_bpwr_profile_t;
+
+/**@brief BPWR event handler type. */
+typedef void (* ant_bpwr_evt_handler_t) (ant_bpwr_profile_t *, ant_bpwr_evt_t);
+
+/**@brief BPWR Sensor calibration request handler type. */
+typedef void (* ant_bpwr_calib_handler_t) (ant_bpwr_profile_t *, ant_bpwr_page1_data_t *);
+
+#include "ant_bpwr_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Bicycle Power Sensor configuration structure. */
+typedef struct
+{
+ ant_bpwr_torque_t torque_use; ///< Determines whether the torque page is included.
+ ant_bpwr_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile.
+ ant_bpwr_calib_handler_t calib_handler; ///< Event handler to be called for handling calibration requests.
+} ant_bpwr_sens_config_t;
+
+/**@brief Bicycle Power Display configuration structure. */
+typedef struct
+{
+ ant_bpwr_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile.
+} ant_bpwr_disp_config_t;
+
+/**@brief Bicycle Power profile structure. */
+struct ant_bpwr_profile_s
+{
+ uint8_t channel_number; ///< Channel number assigned to the profile.
+ union {
+ ant_bpwr_disp_cb_t * p_disp_cb;
+ ant_bpwr_sens_cb_t * p_sens_cb;
+ } _cb; ///< Pointer to internal control block.
+ ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile.
+ ant_bpwr_page1_data_t page_1; ///< Page 1.
+ ant_bpwr_page16_data_t page_16; ///< Page 16.
+ ant_bpwr_page17_data_t page_17; ///< Page 17.
+ ant_bpwr_page18_data_t page_18; ///< Page 18.
+ ant_common_page80_data_t page_80; ///< Page 80.
+ ant_common_page81_data_t page_81; ///< Page 81.
+ ant_bpwr_common_data_t common; ///< BPWR common data.
+};
+
+/** @name Defines for accessing ant_bpwr_profile_t member variables
+ @{ */
+#define BPWR_PROFILE_calibration_id page_1.calibration_id
+#define BPWR_PROFILE_auto_zero_status page_1.auto_zero_status
+#define BPWR_PROFILE_general_calib_data page_1.data.general_calib
+#define BPWR_PROFILE_custom_calib_data page_1.data.custom_calib
+#define BPWR_PROFILE_instantaneous_cadence common.instantaneous_cadence
+#define BPWR_PROFILE_pedal_power page_16.pedal_power.items
+#define BPWR_PROFILE_power_update_event_count page_16.update_event_count
+#define BPWR_PROFILE_accumulated_power page_16.accumulated_power
+#define BPWR_PROFILE_instantaneous_power page_16.instantaneous_power
+#define BPWR_PROFILE_wheel_update_event_count page_17.update_event_count
+#define BPWR_PROFILE_wheel_tick page_17.tick
+#define BPWR_PROFILE_wheel_period page_17.period
+#define BPWR_PROFILE_wheel_accumulated_torque page_17.accumulated_torque
+#define BPWR_PROFILE_crank_update_event_count page_18.update_event_count
+#define BPWR_PROFILE_crank_tick page_18.tick
+#define BPWR_PROFILE_crank_period page_18.period
+#define BPWR_PROFILE_crank_accumulated_torque page_18.accumulated_torque
+#define BPWR_PROFILE_manuf_id page_80.manuf_id
+#define BPWR_PROFILE_hw_revision page_80.hw_revision
+#define BPWR_PROFILE_manufacturer_id page_80.manufacturer_id
+#define BPWR_PROFILE_model_number page_80.model_number
+#define BPWR_PROFILE_sw_revision_minor page_81.sw_revision_minor
+#define BPWR_PROFILE_sw_revision_major page_81.sw_revision_major
+#define BPWR_PROFILE_serial_number page_81.serial_number
+/** @} */
+
+/**@brief Function for initializing the ANT Bicycle Power Display profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_disp_config Pointer to the Bicycle Power Display configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bpwr_disp_init(ant_bpwr_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bpwr_disp_config_t const * p_disp_config);
+
+/**@brief Function for initializing the ANT Bicycle Power Sensor profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_sens_config Pointer to the Bicycle Power Sensor configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bpwr_sens_init(ant_bpwr_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bpwr_sens_config_t const * p_sens_config);
+
+/**@brief Function for opening the profile instance channel for ANT BPWR Display.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bpwr_disp_open(ant_bpwr_profile_t * p_profile);
+
+/**@brief Function for opening the profile instance channel for ANT BPWR Sensor.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bpwr_sens_open(ant_bpwr_profile_t * p_profile);
+
+/** @name Functions: Sensor calibration API
+ * @{
+ */
+
+/** @brief Function for initializing the response for a calibration request.
+ *
+ * This function should be used to signal the status of the calibration procedure to the ANT profile layer .
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ */
+void ant_bpwr_calib_response(ant_bpwr_profile_t * p_profile);
+/** @} */
+
+
+/**@brief Function for handling the Sensor ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Bicycle Power Display profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_bpwr_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+/**@brief Function for handling the Display ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Bicycle Power Display profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_bpwr_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+/** @name Functions: Display calibration API
+ * @{
+ */
+
+/**@brief Function for initializing the calibration request process from the Bicycle Power Display side.
+ *
+ * @details This function requests a transfer to the Sensor and starts watching for the calibration response.
+ * If a calibration response has already been requested, the function ignores the new request and returns NRF_SUCCESS.
+ *
+ * @param [in] p_profile Pointer to the profile instance.
+ * @param [in] p_page_1 Pointer to the prepared page 1.
+ *
+ * @return Values returned by the @ref sd_ant_acknowledge_message_tx SVC callback.
+ */
+uint32_t ant_bpwr_calib_request(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page_1);
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BICYCLE_POWER_H__
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h
new file mode 100644
index 0000000..eb151f1
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_LOCAL_H__
+#define ANT_BPWR_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_bpwr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ant_bpwr
+ * @{
+ */
+
+/** @brief Bicycle Power Sensor control block. */
+typedef struct
+{
+ uint8_t message_counter;
+ ant_bpwr_torque_t torque_use;
+ enum
+ {
+ BPWR_SENS_CALIB_NONE, ///< Idle state.
+ BPWR_SENS_CALIB_REQUESTED, ///< Received request for general calibration result message by the sensor.
+ BPWR_SENS_CALIB_READY, ///< Calibration response message is ready to be transmitted.
+ } calib_stat;
+ ant_bpwr_calib_handler_t calib_handler;
+} ant_bpwr_sens_cb_t;
+
+/**@brief Bicycle Power Sensor RX control block. */
+typedef struct
+{
+ uint8_t calib_timeout;
+ enum
+ {
+ BPWR_DISP_CALIB_NONE, ///< Idle state.
+ BPWR_DISP_CALIB_REQUESTED, ///< Calibration requested.
+ } calib_stat;
+} ant_bpwr_disp_cb_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c
new file mode 100644
index 0000000..8312873
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include "ant_bpwr_common_data.h"
+#include "ant_bpwr_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_common
+#if ANT_BPWR_COMMON_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_COMMON_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_COMMON_INFO_COLOR
+#else // ANT_BPWR_COMMON_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_COMMON_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BPWR common page data layout structure. */
+typedef struct
+{
+ uint8_t reserved0[2];
+ uint8_t instantaneous_cadence;
+ uint8_t reserved1[4];
+}ant_bpwr_cadence_data_layout_t;
+
+/**@brief Function for tracing common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ */
+static void cadence_data_log(ant_bpwr_common_data_t const * p_common_data)
+{
+ if (p_common_data->instantaneous_cadence == 0xFF)
+ {
+ NRF_LOG_INFO("instantaneous cadence: -- rpm\r\n\n");
+ }
+ else
+ {
+ NRF_LOG_INFO("instantaneous cadence: %u rpm\r\n\n",
+ p_common_data->instantaneous_cadence);
+ }
+}
+
+void ant_bpwr_cadence_encode(uint8_t * p_page_buffer,
+ ant_bpwr_common_data_t const * p_common_data)
+{
+ ant_bpwr_cadence_data_layout_t * p_outcoming_data = (ant_bpwr_cadence_data_layout_t *)p_page_buffer;
+ p_outcoming_data->instantaneous_cadence = p_common_data->instantaneous_cadence;
+
+ cadence_data_log(p_common_data);
+}
+
+void ant_bpwr_cadence_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_common_data_t * p_common_data)
+{
+ ant_bpwr_cadence_data_layout_t const * p_incoming_data = (ant_bpwr_cadence_data_layout_t *)p_page_buffer;
+ p_common_data->instantaneous_cadence = p_incoming_data->instantaneous_cadence;
+
+ cadence_data_log(p_common_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h
new file mode 100644
index 0000000..7da410b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_COMMON_DATA_H__
+#define ANT_BPWR_COMMON_DATA_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_common_data_page Stride Based Speed and Distance Monitor profile common data
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BPWR common data.
+ *
+ * @details This structure stores data that is not associated with a particular page.
+ */
+typedef struct
+{
+ uint8_t instantaneous_cadence; ///< Crank cadence (rpm, 0 - 254, 255-> invalid).
+} ant_bpwr_common_data_t;
+
+/**@brief Initialize common data.
+ */
+#define DEFAULT_ANT_BPWR_COMMON_DATA() \
+ (ant_bpwr_common_data_t) \
+ { \
+ .instantaneous_cadence = 0, \
+ }
+
+/**@brief Function for encoding speed.
+ *
+ * This function can be used for pages 16, 17, and 18.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_cadence_encode(uint8_t * p_page_buffer,
+ ant_bpwr_common_data_t const * p_common_data);
+
+/**@brief Function for decoding speed.
+ *
+ * This function can be used for pages 16, 17, and 18.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_common_data Pointer to the common data.
+ */
+void ant_bpwr_cadence_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_common_data_t * p_common_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_COMMON_DATA_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c
new file mode 100644
index 0000000..3efe554
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c
@@ -0,0 +1,286 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include <string.h>
+#include "ant_bpwr_page_1.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_page_1
+#if ANT_BPWR_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_PAGE_1_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_PAGE_1_INFO_COLOR
+#else // ANT_BPWR_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_PAGE_1_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief bicycle power page 1 data layout structure. */
+typedef struct
+{
+ uint8_t calibration_id; ///< Calibration request type
+ union
+ {
+ struct
+ {
+ uint8_t reserved[6]; ///< Unused, fill by 0xFF.
+ } general_calib_request;
+ struct
+ {
+ uint8_t auto_zero_status; ///< Status of automatic zero feature of power sensor.
+ uint8_t reserved[5]; ///< Unused, fill by 0xFF.
+ } auto_zero_config;
+ struct
+ {
+ uint8_t auto_zero_status; ///< Status of automatic zero feature of power sensor.
+ uint8_t reserved[3]; ///< Unused, fill by 0xFF.
+ uint8_t data[2]; ///< Calibration Data.
+ } general_calib_response;
+ struct
+ {
+ uint8_t enable : 1;
+ uint8_t status : 1;
+ uint8_t reserved0 : 6; ///< Unused, fill by 0x00.
+ uint8_t reserved1[5]; ///< Unused, fill by 0xFF.
+ } auto_zero_support;
+ struct
+ {
+ uint8_t manufac_spec[6]; ///< Manufacture Specyfic Data.
+ } custom_calib;
+ } data;
+} ant_bpwr_page1_data_layout_t;
+
+
+static void page1_data_log(ant_bpwr_page1_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Calibration id: %u", p_page_data->calibration_id);
+
+ switch (p_page_data->calibration_id)
+ {
+ case ANT_BPWR_CALIB_ID_MANUAL:
+ // No implementation needed
+ break;
+
+ case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_FAILED:
+ NRF_LOG_INFO("General calibration data: %u",
+ p_page_data->data.general_calib);
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_AUTO:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_AUTO_SUPPORT:
+
+ switch (p_page_data->auto_zero_status)
+ {
+ case ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED:
+ NRF_LOG_INFO("Auto zero not supported\r\n\n");
+ break;
+
+ case ANT_BPWR_AUTO_ZERO_OFF:
+ NRF_LOG_INFO("Auto zero off\r\n\n");
+ break;
+
+ case ANT_BPWR_AUTO_ZERO_ON:
+ NRF_LOG_INFO("Auto zero on\r\n\n");
+ break;
+ }
+ break;
+
+ case ANT_BPWR_CALIB_ID_CTF:
+ NRF_LOG_INFO("Not supported\r\n\n");
+ break;
+
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS:
+ NRF_LOG_INFO("Manufacture specyfic: ");
+ NRF_LOG_HEXDUMP_INFO((uint8_t*)p_page_data->data.custom_calib,
+ sizeof (p_page_data->data.custom_calib));
+ break;
+
+ default: // shouldn't occur
+ NRF_LOG_INFO("Unsupported calibration ID\r\n\n");
+ break;
+ }
+}
+
+
+void ant_bpwr_page_1_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page1_data_t const * p_page_data)
+{
+ ant_bpwr_page1_data_layout_t * p_outcoming_data = (ant_bpwr_page1_data_layout_t *)p_page_buffer;
+
+ page1_data_log(p_page_data);
+
+ p_outcoming_data->calibration_id = p_page_data->calibration_id;
+
+ switch (p_page_data->calibration_id)
+ {
+ case ANT_BPWR_CALIB_ID_MANUAL:
+ memset(p_outcoming_data->data.general_calib_request.reserved, 0xFF,
+ sizeof (p_outcoming_data->data.general_calib_request.reserved));
+ break;
+
+ case ANT_BPWR_CALIB_ID_AUTO:
+ memset(p_outcoming_data->data.auto_zero_config.reserved, 0xFF,
+ sizeof (p_outcoming_data->data.auto_zero_config.reserved));
+ p_outcoming_data->data.auto_zero_config.auto_zero_status =
+ p_page_data->auto_zero_status;
+ break;
+
+ case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_FAILED:
+ memset(p_outcoming_data->data.general_calib_response.reserved, 0xFF,
+ sizeof (p_outcoming_data->data.general_calib_response.reserved));
+ p_outcoming_data->data.general_calib_response.auto_zero_status =
+ p_page_data->auto_zero_status;
+ UNUSED_PARAMETER(uint16_encode(p_page_data->data.general_calib,
+ p_outcoming_data->data.general_calib_response.data));
+ break;
+
+ case ANT_BPWR_CALIB_ID_CTF:
+ NRF_LOG_INFO("Not supported");
+ break;
+
+ case ANT_BPWR_CALIB_ID_AUTO_SUPPORT:
+ memset(p_outcoming_data->data.auto_zero_support.reserved1, 0xFF,
+ sizeof (p_outcoming_data->data.auto_zero_support.reserved1));
+ p_outcoming_data->data.auto_zero_support.reserved0 = 0x00;
+ p_outcoming_data->data.auto_zero_support.enable =
+ (p_page_data->auto_zero_status == ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED) ? false : true;
+ p_outcoming_data->data.auto_zero_support.status =
+ (p_page_data->auto_zero_status == ANT_BPWR_AUTO_ZERO_ON) ? true : false;
+ break;
+
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS:
+ memcpy(p_outcoming_data->data.custom_calib.manufac_spec,
+ (void *)p_page_data->data.custom_calib,
+ sizeof (p_page_data->data.custom_calib));
+ break;
+
+ default: // shouldn't occur
+ break;
+ }
+}
+
+
+void ant_bpwr_page_1_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page1_data_t * p_page_data)
+{
+ ant_bpwr_page1_data_layout_t const * p_incoming_data =
+ (ant_bpwr_page1_data_layout_t *)p_page_buffer;
+
+ p_page_data->calibration_id = (ant_bpwr_calib_id_t)p_incoming_data->calibration_id;
+
+ switch (p_incoming_data->calibration_id)
+ {
+ case ANT_BPWR_CALIB_ID_MANUAL:
+ // No implementation needed
+ break;
+
+ case ANT_BPWR_CALIB_ID_AUTO:
+ /* fall through */
+ p_page_data->auto_zero_status =
+ (ant_bpwr_auto_zero_status_t)p_incoming_data->data.auto_zero_config.auto_zero_status;
+ break;
+
+ case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_FAILED:
+ p_page_data->auto_zero_status =
+ (ant_bpwr_auto_zero_status_t)p_incoming_data->data.general_calib_response.
+ auto_zero_status;
+ p_page_data->data.general_calib = uint16_decode(
+ p_incoming_data->data.general_calib_response.data);
+ break;
+
+ case ANT_BPWR_CALIB_ID_CTF:
+ NRF_LOG_INFO("Not supported");
+ break;
+
+ case ANT_BPWR_CALIB_ID_AUTO_SUPPORT:
+
+ if (p_incoming_data->data.auto_zero_support.enable == false)
+ {
+ p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED;
+ }
+ else if (p_incoming_data->data.auto_zero_support.status)
+ {
+ p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_ON;
+ }
+ else
+ {
+ p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_OFF;
+ }
+ break;
+
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE:
+ /* fall through */
+ case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS:
+ memcpy((void *)p_page_data->data.custom_calib,
+ p_incoming_data->data.custom_calib.manufac_spec,
+ sizeof (p_page_data->data.custom_calib));
+ break;
+
+ default: // shouldn't occur
+ break;
+ }
+
+ page1_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h
new file mode 100644
index 0000000..24604a7
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h
@@ -0,0 +1,136 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGE_1_H__
+#define ANT_BPWR_PAGE_1_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_page1 Bicycle Power profile page 1
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief BPWR Calibration ID.
+ */
+typedef enum
+{
+ ANT_BPWR_CALIB_ID_NONE = 0x00,
+ ANT_BPWR_CALIB_ID_MANUAL = 0xAA, ///< Calibration Request: Manual Zero.
+ ANT_BPWR_CALIB_ID_AUTO = 0xAB, ///< Calibration Request: Auto Zero Configuration.
+ ANT_BPWR_CALIB_ID_MANUAL_SUCCESS = 0xAC, ///< Calibration Response: Manual Zero Successful.
+ ANT_BPWR_CALIB_ID_FAILED = 0xAF, ///< Calibration Response: Failed.
+ ANT_BPWR_CALIB_ID_CTF = 0x10, ///< Crank Torque Frequency (CTF) Power sensor Defined Message.
+ ANT_BPWR_CALIB_ID_AUTO_SUPPORT = 0x12, ///< Auto Zero Support.
+ ANT_BPWR_CALIB_ID_CUSTOM_REQ = 0xBA, ///< Custom Calibration Parameter Request.
+ ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS = 0xBB, ///< Custom Calibration Parameter Response.
+ ANT_BPWR_CALIB_ID_CUSTOM_UPDATE = 0xBC, ///< Custom Calibration Parameter Update.
+ ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS = 0xBD, ///< Custom Calibration Parameter Update Response.
+} ant_bpwr_calib_id_t;
+
+/**@brief BPWR Calibration Auto Zero Status.
+ */
+typedef enum
+{
+ ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED = 0xFF, ///< Auto Zero Not Supported.
+ ANT_BPWR_AUTO_ZERO_OFF = 0x00, ///< Auto Zero OFF.
+ ANT_BPWR_AUTO_ZERO_ON = 0x01, ///< Auto Zero ON.
+} ant_bpwr_auto_zero_status_t;
+
+/**@brief Data structure for Bicycle Power data page 1.
+ */
+typedef struct
+{
+ ant_bpwr_calib_id_t calibration_id; ///< Calibration request type.
+ ant_bpwr_auto_zero_status_t auto_zero_status; ///< Status of automatic zero feature of power sensor.
+ union
+ {
+ int16_t general_calib;
+ uint8_t custom_calib[6];
+ } data;
+} ant_bpwr_page1_data_t;
+
+/**@brief Initialize page 1.
+ */
+#define DEFAULT_ANT_BPWR_PAGE1() \
+ (ant_bpwr_page1_data_t) \
+ { \
+ .calibration_id = ANT_BPWR_CALIB_ID_NONE, \
+ .auto_zero_status = ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED, \
+ .data.general_calib = 0x00, \
+ }
+
+/**@brief Initialize page 1 with the general request.
+ */
+#define ANT_BPWR_GENERAL_CALIB_REQUEST() \
+ (ant_bpwr_page1_data_t) \
+ { \
+ .calibration_id = ANT_BPWR_CALIB_ID_MANUAL, \
+ }
+
+/**@brief Function for encoding page 1.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_page_1_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page1_data_t const * p_page_data);
+
+/**@brief Function for decoding page 1.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_1_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page1_data_t * p_page_data);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGE_1_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c
new file mode 100644
index 0000000..71a2370
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include "ant_bpwr_page_16.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_page_16
+#if ANT_BPWR_PAGE_16_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_PAGE_16_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_PAGE_16_INFO_COLOR
+#else // ANT_BPWR_PAGE_16_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_PAGE_16_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief bicycle power page 16 data layout structure. */
+typedef struct
+{
+ uint8_t update_event_count;
+ uint8_t pedal_power;
+ uint8_t reserved;
+ uint8_t accumulated_power[2];
+ uint8_t instantaneous_power[2];
+}ant_bpwr_page16_data_layout_t;
+
+
+static void page16_data_log(ant_bpwr_page16_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("event count: %u", p_page_data->update_event_count);
+
+ if (p_page_data->pedal_power.byte != 0xFF)
+ {
+ NRF_LOG_INFO("pedal power: %u %%",
+ p_page_data->pedal_power.items.distribution);
+ }
+ else
+ {
+ NRF_LOG_INFO("pedal power: --");
+ }
+
+ NRF_LOG_INFO("accumulated power: %u W", p_page_data->accumulated_power);
+ NRF_LOG_INFO("instantaneous power: %u W", p_page_data->instantaneous_power);
+}
+
+
+void ant_bpwr_page_16_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page16_data_t const * p_page_data)
+{
+ ant_bpwr_page16_data_layout_t * p_outcoming_data =
+ (ant_bpwr_page16_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->update_event_count = p_page_data->update_event_count;
+ p_outcoming_data->pedal_power = p_page_data->pedal_power.byte;
+
+ UNUSED_PARAMETER(uint16_encode(p_page_data->accumulated_power,
+ p_outcoming_data->accumulated_power));
+ UNUSED_PARAMETER(uint16_encode(p_page_data->instantaneous_power,
+ p_outcoming_data->instantaneous_power));
+
+ page16_data_log(p_page_data);
+}
+
+
+void ant_bpwr_page_16_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page16_data_t * p_page_data)
+{
+ ant_bpwr_page16_data_layout_t const * p_incoming_data =
+ (ant_bpwr_page16_data_layout_t *)p_page_buffer;
+
+ p_page_data->update_event_count = p_incoming_data->update_event_count;
+ p_page_data->pedal_power.byte = p_incoming_data->pedal_power;
+ p_page_data->accumulated_power = uint16_decode(p_incoming_data->accumulated_power);
+ p_page_data->instantaneous_power = uint16_decode(p_incoming_data->instantaneous_power);
+
+ page16_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h
new file mode 100644
index 0000000..6e8ce94
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGE_16_H__
+#define ANT_BPWR_PAGE_16_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_page16 Bicycle Power profile page 16
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for Bicycle Power data page 16.
+ *
+ * @note This structure implements only page 16 specific data.
+ */
+typedef struct
+{
+ union
+ {
+ struct
+ {
+ uint8_t distribution : 7; ///< Pedal power distribution (%).
+ uint8_t differentiation : 1; ///< Pedal differentiation: 1 -> right, 0 -> unknown.
+ } items;
+ uint8_t byte;
+ } pedal_power;
+
+ uint8_t update_event_count; ///< Power event count.
+ uint16_t accumulated_power; ///< Accumulated power (W).
+ uint16_t instantaneous_power; ///< Instantaneous power (W).
+} ant_bpwr_page16_data_t;
+
+/**@brief Initialize page 16.
+ */
+#define DEFAULT_ANT_BPWR_PAGE16() \
+ (ant_bpwr_page16_data_t) \
+ { \
+ .update_event_count = 0, \
+ .pedal_power.items.distribution = 0, \
+ .pedal_power.items.differentiation = 0, \
+ .accumulated_power = 0, \
+ .instantaneous_power = 0, \
+ }
+
+/**@brief Function for encoding page 16.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_page_16_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page16_data_t const * p_page_data);
+
+/**@brief Function for decoding page 16.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_16_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page16_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGE_16_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c
new file mode 100644
index 0000000..3586f92
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include "ant_bpwr_page_17.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_page_17
+#if ANT_BPWR_PAGE_17_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_PAGE_17_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_PAGE_17_INFO_COLOR
+#else // ANT_BPWR_PAGE_17_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_PAGE_17_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+static void page17_data_log(ant_bpwr_page17_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Wheel:");
+ ant_bpwr_page_torque_log((ant_bpwr_page_torque_data_t *) p_page_data);
+}
+
+
+void ant_bpwr_page_17_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page17_data_t const * p_page_data)
+{
+ ant_bpwr_page_torque_encode(p_page_buffer, (ant_bpwr_page_torque_data_t *)p_page_data);
+ page17_data_log(p_page_data);
+}
+
+
+void ant_bpwr_page_17_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page17_data_t * p_page_data)
+{
+ ant_bpwr_page_torque_decode(p_page_buffer, (ant_bpwr_page_torque_data_t *) p_page_data);
+ page17_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h
new file mode 100644
index 0000000..ef86067
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGE_17_H__
+#define ANT_BPWR_PAGE_17_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_page17 Bicycle Power profile page 17
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+#include "ant_bpwr_page_torque.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for Bicycle Power data page 17.
+ *
+ * @note This structure implements only page 17 specific data.
+ */
+typedef ant_bpwr_page_torque_data_t ant_bpwr_page17_data_t;
+
+/**@brief Initialize page 17.
+ */
+#define DEFAULT_ANT_BPWR_PAGE17() (ant_bpwr_page17_data_t) DEFAULT_ANT_BPWR_PAGE_TORQUE(0, 0, 0, 0)
+
+/**@brief Function for encoding page 17.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_page_17_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page17_data_t const * p_page_data);
+
+/**@brief Function for decoding page 17.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_17_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page17_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGE_17_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c
new file mode 100644
index 0000000..55a3148
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include "ant_bpwr_page_18.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_page_18
+#if ANT_BPWR_PAGE_18_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_PAGE_18_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_PAGE_18_INFO_COLOR
+#else // ANT_BPWR_PAGE_18_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_PAGE_18_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+static void page18_data_log(ant_bpwr_page18_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Crank:");
+ ant_bpwr_page_torque_log((ant_bpwr_page_torque_data_t *) p_page_data);
+}
+
+
+void ant_bpwr_page_18_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page18_data_t const * p_page_data)
+{
+ ant_bpwr_page_torque_encode(p_page_buffer, (ant_bpwr_page_torque_data_t *)p_page_data);
+ page18_data_log(p_page_data);
+}
+
+
+void ant_bpwr_page_18_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page18_data_t * p_page_data)
+{
+ ant_bpwr_page_torque_decode(p_page_buffer, (ant_bpwr_page_torque_data_t *) p_page_data);
+ page18_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h
new file mode 100644
index 0000000..712ae2f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2011 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGE_18_H__
+#define ANT_BPWR_PAGE_18_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_page18 Bicycle Power profile page 18
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+#include "ant_bpwr_page_torque.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for Bicycle Power data page 18.
+ *
+ * @note This structure implements only page 18 specific data.
+ */
+typedef ant_bpwr_page_torque_data_t ant_bpwr_page18_data_t;
+
+/**@brief Initialize page 18.
+ */
+#define DEFAULT_ANT_BPWR_PAGE18() (ant_bpwr_page18_data_t) DEFAULT_ANT_BPWR_PAGE_TORQUE(0, 0, 0, 0)
+
+/**@brief Function for encoding page 18.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_page_18_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page18_data_t const * p_page_data);
+
+/**@brief Function for decoding page 18.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_18_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page18_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGE_18_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c
new file mode 100644
index 0000000..e657f94
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BPWR)
+
+#include <stdio.h>
+#include "ant_bpwr_page_torque.h"
+#include "ant_bpwr_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bpwr_page_torque
+#if ANT_BPWR_PAGE_TORQUE_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BPWR_PAGE_TORQUE_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BPWR_PAGE_TORQUE_INFO_COLOR
+#else // ANT_BPWR_PAGE_TORQUE_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BPWR_PAGE_TORQUE_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief bicycle power page torque data layout structure. */
+typedef struct
+{
+ uint8_t update_event_count;
+ uint8_t tick;
+ uint8_t reserved;
+ uint8_t period[2];
+ uint8_t accumulated_torque[2];
+}ant_bpwr_page_torque_data_layout_t;
+
+STATIC_ASSERT(ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION == 1000); ///< Display format need to be updated
+STATIC_ASSERT(ANT_BPWR_ACC_TORQUE_DISP_PRECISION == 10); ///< Display format need to be updated
+
+void ant_bpwr_page_torque_log(ant_bpwr_page_torque_data_t const * p_page_data)
+{
+ uint16_t period = ANT_BPWR_TORQUE_PERIOD_RESCALE(p_page_data->period);
+ uint32_t acc_torque = ANT_BPWR_ACC_TORQUE_RESCALE(p_page_data->accumulated_torque);
+
+ NRF_LOG_INFO("event count: %u", p_page_data->update_event_count);
+ NRF_LOG_INFO("tick: %u", p_page_data->tick);
+ NRF_LOG_INFO("period: %u.%03us",
+ (unsigned int)(period / ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION),
+ (unsigned int)(period % ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION));
+ NRF_LOG_INFO("accumulated torque: %u.%01uNm",
+ (unsigned int)(acc_torque / ANT_BPWR_ACC_TORQUE_DISP_PRECISION),
+ (unsigned int)(acc_torque % ANT_BPWR_ACC_TORQUE_DISP_PRECISION));
+}
+
+
+void ant_bpwr_page_torque_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page_torque_data_t const * p_page_data)
+{
+ ant_bpwr_page_torque_data_layout_t * p_outcoming_data =
+ (ant_bpwr_page_torque_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->update_event_count = p_page_data->update_event_count;
+ p_outcoming_data->tick = p_page_data->tick;
+
+ UNUSED_PARAMETER(uint16_encode(p_page_data->period, p_outcoming_data->period));
+ UNUSED_PARAMETER(uint16_encode(p_page_data->accumulated_torque,
+ p_outcoming_data->accumulated_torque));
+}
+
+
+void ant_bpwr_page_torque_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page_torque_data_t * p_page_data)
+{
+ ant_bpwr_page_torque_data_layout_t const * p_incoming_data =
+ (ant_bpwr_page_torque_data_layout_t *)p_page_buffer;
+
+ p_page_data->update_event_count = p_incoming_data->update_event_count;
+ p_page_data->tick = p_incoming_data->tick;
+ p_page_data->period = uint16_decode(p_incoming_data->period);
+ p_page_data->accumulated_torque = uint16_decode(p_incoming_data->accumulated_torque);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BPWR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h
new file mode 100644
index 0000000..8eee44d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGE_TORQUE_COMMON_H__
+#define ANT_BPWR_PAGE_TORQUE_COMMON_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bicycle_p_page_torque Bicycle Power profile pages 17, 18 (commons)
+ * @{
+ * @ingroup ant_sdk_profiles_bpwr_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Common data structure for Bicycle Power data pages 17, 18.
+ *
+ * @note This structure implements specific data that is common for pages 17, 18.
+ */
+typedef struct
+{
+ uint8_t update_event_count; ///< Power event count.
+ uint8_t tick; ///< Wheel/crank revolutions counter.
+ uint16_t period; ///< Accumulated wheel/crank period (1/2048 s).
+ uint16_t accumulated_torque; ///< Accumulated wheel/torque (1/32 Nm).
+} ant_bpwr_page_torque_data_t;
+
+/**@brief Initialize page torque.
+ */
+#define DEFAULT_ANT_BPWR_PAGE_TORQUE(up_evt_cnt, def_tick, def_period, acc_torque) \
+ { \
+ .update_event_count = (up_evt_cnt), \
+ .tick = (def_tick), \
+ .period = (def_period), \
+ .accumulated_torque = (acc_torque) \
+ }
+
+/**@brief Function for encoding pages 17, 18.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bpwr_page_torque_encode(uint8_t * p_page_buffer,
+ ant_bpwr_page_torque_data_t const * p_page_data);
+
+/**@brief Function for decoding pages 17, 18.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_torque_decode(uint8_t const * p_page_buffer,
+ ant_bpwr_page_torque_data_t * p_page_data);
+
+/**@brief Function for logging pages 17, 18.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ */
+void ant_bpwr_page_torque_log(ant_bpwr_page_torque_data_t const * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGE_TORQUE_COMMON_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h
new file mode 100644
index 0000000..8f5098f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_PAGES_H__
+#define ANT_BPWR_PAGES_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_pages Bicycle Power profile pages
+ * @{
+ * @ingroup ant_bpwr
+ * @brief This module implements functions for the BPWR data pages.
+ */
+
+#include "ant_bpwr_page_1.h" // Calibration message main data page.
+#include "ant_bpwr_page_16.h" // Standard power-only page.
+#include "ant_bpwr_page_17.h" // Wheel Torque main data page.
+#include "ant_bpwr_page_18.h" // Crank Torque main data page.
+#include "ant_bpwr_common_data.h" // Instantaneous cadence data.
+#include "ant_common_page_80.h" // Manufacturer's information data page.
+#include "ant_common_page_81.h" // Product information data page.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_PAGES_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c
new file mode 100644
index 0000000..6d2ec14
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c
@@ -0,0 +1,201 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "ant_bpwr_simulator.h"
+#include "app_util.h"
+#include "nordic_common.h"
+
+#define POWER_MIN 0
+#define POWER_MAX 2000
+#define POWER_INCR 10
+
+#define CADENCE_MIN 0
+#define CADENCE_MAX (UINT8_MAX - 1)
+#define CADENCE_INCR 1
+
+#define PEDAL_MIN 0
+#define PEDAL_MAX 100
+#define PEDAL_INCR 1
+
+#define TORQUE_PERIOD 774
+#define SIMULATOR_TIME_INCREMENT BPWR_MSG_PERIOD
+
+#define TORQUE_INCR 10
+
+
+void ant_bpwr_simulator_init(ant_bpwr_simulator_t * p_simulator,
+ ant_bpwr_simulator_cfg_t const * p_config,
+ bool auto_change)
+{
+ p_simulator->p_profile = p_config->p_profile;
+ p_simulator->_cb.auto_change = auto_change;
+ p_simulator->_cb.tick_incr = 0;
+
+ p_simulator->_cb.power_sensorsim_cfg.min = POWER_MIN;
+ p_simulator->_cb.power_sensorsim_cfg.max = POWER_MAX;
+ p_simulator->_cb.power_sensorsim_cfg.incr = POWER_INCR;
+ p_simulator->_cb.power_sensorsim_cfg.start_at_max = false;
+
+ p_simulator->_cb.cadence_sensorsim_cfg.min = CADENCE_MIN;
+ p_simulator->_cb.cadence_sensorsim_cfg.max = CADENCE_MAX;
+ p_simulator->_cb.cadence_sensorsim_cfg.incr = CADENCE_INCR;
+ p_simulator->_cb.cadence_sensorsim_cfg.start_at_max = false;
+
+ p_simulator->_cb.pedal_sensorsim_cfg.min = PEDAL_MIN;
+ p_simulator->_cb.pedal_sensorsim_cfg.max = PEDAL_MAX;
+ p_simulator->_cb.pedal_sensorsim_cfg.incr = PEDAL_INCR;
+ p_simulator->_cb.pedal_sensorsim_cfg.start_at_max = false;
+
+ p_simulator->p_profile->BPWR_PROFILE_pedal_power.differentiation = 0x01; // right
+
+ sensorsim_init(&(p_simulator->_cb.power_sensorsim_state),
+ &(p_simulator->_cb.power_sensorsim_cfg));
+ sensorsim_init(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg));
+ sensorsim_init(&(p_simulator->_cb.pedal_sensorsim_state),
+ &(p_simulator->_cb.pedal_sensorsim_cfg));
+}
+
+
+void ant_bpwr_simulator_one_iteration(ant_bpwr_simulator_t * p_simulator, ant_bpwr_evt_t event)
+{
+ switch (event)
+ {
+ case ANT_BPWR_PAGE_16_UPDATED:
+
+ if (p_simulator->_cb.auto_change)
+ {
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.power_sensorsim_state),
+ &(p_simulator->_cb.power_sensorsim_cfg)));
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg)));
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.pedal_sensorsim_state),
+ &(p_simulator->_cb.pedal_sensorsim_cfg)));
+ }
+
+ p_simulator->p_profile->BPWR_PROFILE_instantaneous_power =
+ p_simulator->_cb.power_sensorsim_state.current_val;
+ p_simulator->p_profile->BPWR_PROFILE_accumulated_power +=
+ p_simulator->_cb.power_sensorsim_state.current_val;
+
+ if (p_simulator->p_profile->BPWR_PROFILE_accumulated_power == UINT16_MAX)
+ {
+ p_simulator->p_profile->BPWR_PROFILE_accumulated_power = 0;
+ }
+ p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence =
+ p_simulator->_cb.cadence_sensorsim_state.current_val;
+ p_simulator->p_profile->BPWR_PROFILE_pedal_power.distribution =
+ p_simulator->_cb.pedal_sensorsim_state.current_val;
+ p_simulator->p_profile->BPWR_PROFILE_power_update_event_count++;
+ break;
+
+ case ANT_BPWR_PAGE_17_UPDATED:
+
+ if (p_simulator->_cb.auto_change)
+ {
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg)));
+ }
+ p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence =
+ p_simulator->_cb.cadence_sensorsim_state.current_val;
+ p_simulator->p_profile->BPWR_PROFILE_wheel_period += TORQUE_PERIOD;
+ p_simulator->_cb.tick_incr +=
+ SIMULATOR_TIME_INCREMENT;
+ p_simulator->p_profile->BPWR_PROFILE_wheel_tick +=
+ p_simulator->_cb.tick_incr / (TORQUE_PERIOD * 16);
+ p_simulator->_cb.tick_incr =
+ p_simulator->_cb.tick_incr % (TORQUE_PERIOD * 16);
+ p_simulator->p_profile->BPWR_PROFILE_wheel_accumulated_torque += TORQUE_INCR;
+ p_simulator->p_profile->BPWR_PROFILE_wheel_update_event_count++;
+ break;
+
+ case ANT_BPWR_PAGE_18_UPDATED:
+
+ if (p_simulator->_cb.auto_change)
+ {
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg)));
+ }
+ p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence =
+ p_simulator->_cb.cadence_sensorsim_state.current_val;
+ p_simulator->p_profile->BPWR_PROFILE_crank_period = TORQUE_PERIOD;
+ p_simulator->_cb.tick_incr +=
+ SIMULATOR_TIME_INCREMENT;
+ p_simulator->p_profile->BPWR_PROFILE_crank_tick +=
+ p_simulator->_cb.tick_incr / (TORQUE_PERIOD * 16);
+ p_simulator->_cb.tick_incr =
+ p_simulator->_cb.tick_incr % (TORQUE_PERIOD * 16);
+ p_simulator->p_profile->BPWR_PROFILE_crank_accumulated_torque += TORQUE_INCR;
+ p_simulator->p_profile->BPWR_PROFILE_crank_update_event_count++;
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void ant_bpwr_simulator_increment(ant_bpwr_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_increment(&(p_simulator->_cb.power_sensorsim_state),
+ &(p_simulator->_cb.power_sensorsim_cfg));
+ sensorsim_increment(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg));
+ sensorsim_increment(&(p_simulator->_cb.pedal_sensorsim_state),
+ &(p_simulator->_cb.pedal_sensorsim_cfg));
+ }
+}
+
+
+void ant_bpwr_simulator_decrement(ant_bpwr_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_decrement(&(p_simulator->_cb.power_sensorsim_state),
+ &(p_simulator->_cb.power_sensorsim_cfg));
+ sensorsim_decrement(&(p_simulator->_cb.cadence_sensorsim_state),
+ &(p_simulator->_cb.cadence_sensorsim_cfg));
+ sensorsim_decrement(&(p_simulator->_cb.pedal_sensorsim_state),
+ &(p_simulator->_cb.pedal_sensorsim_cfg));
+ }
+}
+
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h
new file mode 100644
index 0000000..b7894ba
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_SIMULATOR_H__
+#define ANT_BPWR_SIMULATOR_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_simulators ANT simulators
+ * @ingroup ant_sdk_utils
+ * @brief Modules that simulate sensors.
+ *
+ * @defgroup ant_sdk_bpwr_simulator ANT BPWR simulator
+ * @{
+ * @ingroup ant_sdk_simulators
+ * @brief ANT BPWR simulator module.
+ *
+ * @details This module simulates power for the ANT BPWR profile. The module calculates
+ * abstract values, which are handled by the BPWR pages data model to ensure that they are
+ * compatible. It provides a handler for changing the power value manually and functionality
+ * for changing the power automatically.
+ *
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "bsp.h"
+#include "ant_bpwr.h"
+#include "sensorsim.h"
+#include "ant_bpwr_simulator_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief BPWR simulator configuration structure. */
+typedef struct
+{
+ ant_bpwr_profile_t * p_profile; ///< Related profile.
+ ant_bpwr_torque_t sensor_type; ///< Type of related sensor.
+} ant_bpwr_simulator_cfg_t;
+
+/**@brief BPWR simulator structure. */
+typedef struct
+{
+ ant_bpwr_profile_t * p_profile; ///< Related profile.
+ ant_bpwr_simulator_cb_t _cb; ///< Internal control block.
+} ant_bpwr_simulator_t;
+
+
+/**@brief Function for initializing the ANT BPWR simulator instance.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ * @param[in] p_config Pointer to the simulator configuration structure.
+ * @param[in] auto_change Enable or disable automatic changes of the power.
+ */
+void ant_bpwr_simulator_init(ant_bpwr_simulator_t * p_simulator,
+ ant_bpwr_simulator_cfg_t const * p_config,
+ bool auto_change);
+
+/**@brief Function for simulating a device event.
+ *
+ * @details Based on this event, the transmitter data is simulated.
+ *
+ * This function should be called in the BPWR TX event handler.
+ */
+void ant_bpwr_simulator_one_iteration(ant_bpwr_simulator_t * p_simulator, ant_bpwr_evt_t event);
+
+/**@brief Function for incrementing the power value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_bpwr_simulator_increment(ant_bpwr_simulator_t * p_simulator);
+
+/**@brief Function for decrementing the power value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_bpwr_simulator_decrement(ant_bpwr_simulator_t * p_simulator);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_SIMULATOR_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h
new file mode 100644
index 0000000..7b2c949
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_SIMULATOR_LOCAL_H__
+#define ANT_BPWR_SIMULATOR_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "bsp.h"
+#include "ant_bpwr.h"
+#include "sensorsim.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup ant_sdk_bpwr_simulator
+ * @brief BPWR simulator control block structure. */
+typedef struct
+{
+ bool auto_change; ///< Power will change automatically (if auto_change is set) or manually.
+ uint32_t tick_incr; ///< Fractional part of tick increment.
+ sensorsim_state_t power_sensorsim_state; ///< Power state of the simulated sensor.
+ sensorsim_cfg_t power_sensorsim_cfg; ///< Power configuration of the simulated sensor.
+ sensorsim_state_t cadence_sensorsim_state; ///< Cadence stated of the simulated sensor.
+ sensorsim_cfg_t cadence_sensorsim_cfg; ///< Cadence configuration of the simulated sensor.
+ sensorsim_state_t pedal_sensorsim_state; ///< Pedal state of the simulated sensor.
+ sensorsim_cfg_t pedal_sensorsim_cfg; ///< Pedal configuration of the simulated sensor.
+}ant_bpwr_simulator_cb_t;
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_SIMULATOR_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h
new file mode 100644
index 0000000..100e059
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BPWR_UTILS_H__
+#define ANT_BPWR_UTILS_H__
+
+#include "app_util.h"
+#include "nrf_assert.h"
+#include "nrf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bpwr_utils Bicycle Power profile utilities
+ * @{
+ * @ingroup ant_bpwr
+ * @brief This module implements utilities for the Bicycle Power profile.
+ *
+ */
+
+/*@brief A reversal of torque period unit.
+ *
+ * @details According to the ANT BPWR specification, the torque period unit is 1/2048 of a second.
+ */
+#define ANT_BPWR_TORQUE_PERIOD_UNIT_REVERSAL 2048
+#define ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION 1000
+#define ANT_BPWR_TORQUE_PERIOD_RESCALE(VALUE) value_rescale((VALUE), ANT_BPWR_TORQUE_PERIOD_UNIT_REVERSAL, \
+ ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION)
+
+/*@brief A reversal of accumulated torque unit.
+ *
+ * @details According to the ANT BPWR specification, the accumulated torque unit is 1/32 of a Nm.
+ */
+#define ANT_BPWR_ACC_TORQUE_UNIT_REVERSAL 32
+#define ANT_BPWR_ACC_TORQUE_DISP_PRECISION 10
+#define ANT_BPWR_ACC_TORQUE_RESCALE(VALUE) value_rescale((VALUE), ANT_BPWR_ACC_TORQUE_UNIT_REVERSAL, \
+ ANT_BPWR_ACC_TORQUE_DISP_PRECISION)
+
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BPWR_UTILS_H__
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.c
new file mode 100644
index 0000000..1f356c5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.c
@@ -0,0 +1,422 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "nrf_assert.h"
+#include "nrf_error.h"
+#include "app_error.h"
+#include "ant_interface.h"
+#include "ant_bsc.h"
+#include "ant_bsc_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bsc
+#if ANT_BSC_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_INFO_COLOR
+#else // ANT_BSC_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+#define MAIN_DATA_INTERVAL 4 /**< The number of background data pages sent between main data pages.*/
+#define BACKGROUND_DATA_INTERVAL 64 /**< The number of main data pages sent between background data page.
+ Background data page is sent every 65th message. */
+#define TX_TOGGLE_DIVISOR 4 /**< The number of messages between changing state of toggle bit. */
+
+/**@brief BSC message data layout structure. */
+typedef struct
+{
+ ant_bsc_page_t page_number : 7;
+ uint8_t toggle_bit : 1;
+ uint8_t page_payload[7];
+}ant_bsc_single_message_layout_t;
+
+typedef struct
+{
+ uint8_t page_payload[8];
+}ant_bsc_combined_message_layout_t;
+
+typedef union
+{
+ ant_bsc_single_message_layout_t speed_or_cadence;
+ ant_bsc_combined_message_layout_t combined;
+}ant_bsc_message_layout_t;
+
+
+/**@brief Function for initializing the ANT BSC profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+static ret_code_t ant_bsc_init(ant_bsc_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config)
+{
+ p_profile->channel_number = p_channel_config->channel_number;
+
+ p_profile->page_0 = DEFAULT_ANT_BSC_PAGE0();
+ p_profile->page_1 = DEFAULT_ANT_BSC_PAGE1();
+ p_profile->page_2 = DEFAULT_ANT_BSC_PAGE2();
+ p_profile->page_3 = DEFAULT_ANT_BSC_PAGE3();
+ p_profile->page_4 = DEFAULT_ANT_BSC_PAGE4();
+ p_profile->page_5 = DEFAULT_ANT_BSC_PAGE5();
+ p_profile->page_comb_0 = DEFAULT_ANT_BSC_COMBINED_PAGE0();
+
+ NRF_LOG_INFO("ANT BSC channel %u init", p_profile->channel_number);
+ return ant_channel_init(p_channel_config);
+}
+
+ret_code_t ant_bsc_disp_init(ant_bsc_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bsc_disp_config_t const * p_disp_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_disp_config->evt_handler != NULL);
+
+ p_profile->evt_handler = p_disp_config->evt_handler;
+ p_profile->_cb.p_disp_cb = p_disp_config->p_cb;
+
+ p_profile->_cb.p_disp_cb->device_type = p_channel_config->device_type;
+
+ return ant_bsc_init(p_profile, p_channel_config);
+}
+
+ret_code_t ant_bsc_sens_init(ant_bsc_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bsc_sens_config_t const * p_sens_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_sens_config != NULL);
+ ASSERT(p_sens_config->p_cb != NULL);
+ ASSERT(p_sens_config->evt_handler != NULL);
+
+ ASSERT((p_sens_config->main_page_number == ANT_BSC_PAGE_0)
+ || (p_sens_config->main_page_number == ANT_BSC_PAGE_5)
+ || (p_sens_config->main_page_number == ANT_BSC_COMB_PAGE_0));
+
+ p_profile->evt_handler = p_sens_config->evt_handler;
+ p_profile->_cb.p_sens_cb = p_sens_config->p_cb;
+
+ p_profile->_cb.p_sens_cb->page_1_present = p_sens_config->page_1_present;
+ p_profile->_cb.p_sens_cb->page_4_present = p_sens_config->page_4_present;
+ p_profile->_cb.p_sens_cb->main_page_number = p_sens_config->main_page_number;
+ p_profile->_cb.p_sens_cb->bkgd_page_number =
+ p_sens_config->page_1_present ? ANT_BSC_PAGE_1 : ANT_BSC_PAGE_2;
+ p_profile->_cb.p_sens_cb->message_counter = 0;
+ p_profile->_cb.p_sens_cb->toggle_bit = true;
+ p_profile->_cb.p_sens_cb->device_type = p_channel_config->device_type; /* Device type is set up in channel config */
+
+ return ant_bsc_init(p_profile, p_channel_config);
+}
+
+/**@brief Function for setting the next background page number.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ */
+__STATIC_INLINE void next_bkgd_page_number_set(ant_bsc_profile_t * p_profile)
+{
+ /* Determine the last background page*/
+ ant_bsc_page_t last_bkgd_page =
+ p_profile->_cb.p_sens_cb->page_4_present ? ANT_BSC_PAGE_4 : ANT_BSC_PAGE_3;
+
+ /* Switch the background page according to user settings */
+ ++(p_profile->_cb.p_sens_cb->bkgd_page_number);
+ if (p_profile->_cb.p_sens_cb->bkgd_page_number > last_bkgd_page)
+ {
+ p_profile->_cb.p_sens_cb->bkgd_page_number =
+ p_profile->_cb.p_sens_cb->page_1_present ? ANT_BSC_PAGE_1 : ANT_BSC_PAGE_2;
+ }
+}
+
+/**@brief Function for getting next page number to send.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @return Next page number.
+ */
+static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t * p_profile)
+{
+ ant_bsc_page_t page_number;
+
+ /* This is a single speed or cadence sensor - switch data page */
+ if (p_profile->_cb.p_sens_cb->message_counter < (BACKGROUND_DATA_INTERVAL))
+ {
+ /* Return main page */
+ page_number = p_profile->_cb.p_sens_cb->main_page_number;
+ }
+ else
+ {
+ /* Return background page */
+ page_number = p_profile->_cb.p_sens_cb->bkgd_page_number;
+ }
+
+ /* Set page toggle bit */
+ if ((p_profile->_cb.p_sens_cb->message_counter % TX_TOGGLE_DIVISOR) == 0)
+ {
+ p_profile->_cb.p_sens_cb->toggle_bit ^= 1;
+ }
+
+ /* Update message counter, wrap when counter equals 64 + 4 */
+ ++(p_profile->_cb.p_sens_cb->message_counter);
+ if (p_profile->_cb.p_sens_cb->message_counter == (BACKGROUND_DATA_INTERVAL + MAIN_DATA_INTERVAL))
+ {
+ p_profile->_cb.p_sens_cb->message_counter = 0;
+ /* Set new background data page number */
+ next_bkgd_page_number_set(p_profile);
+ }
+
+ return page_number;
+}
+
+/**@brief Function for encoding BSC message.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[out] p_message_payload Pointer to the message payload structure.
+ *
+ * @note Assume to be called each time when Tx window will occur.
+ */
+static void sens_message_encode(ant_bsc_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ ant_bsc_message_layout_t * p_bsc_message_payload = (ant_bsc_message_layout_t *)p_message_payload;
+ ant_bsc_evt_t bsc_sens_event;
+
+ if (p_profile->_cb.p_sens_cb->device_type == BSC_COMBINED_DEVICE_TYPE)
+ {
+ NRF_LOG_INFO("BSC TX Page: \"Combined Speed & Cadence Page\"");
+ ant_bsc_combined_page_0_encode(p_bsc_message_payload->combined.page_payload,
+ &(p_profile->page_comb_0));
+ bsc_sens_event = (ant_bsc_evt_t) ANT_BSC_COMB_PAGE_0_UPDATED;
+ }
+ else
+ {
+ p_bsc_message_payload->speed_or_cadence.page_number = next_page_number_get(p_profile);
+ p_bsc_message_payload->speed_or_cadence.toggle_bit = p_profile->_cb.p_sens_cb->toggle_bit;
+ NRF_LOG_INFO("BSC TX Page number: %u",
+ p_bsc_message_payload->speed_or_cadence.page_number);
+
+ ant_bsc_page_0_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_0));
+ bsc_sens_event = (ant_bsc_evt_t) p_bsc_message_payload->speed_or_cadence.page_number;
+
+ switch (p_bsc_message_payload->speed_or_cadence.page_number)
+ {
+ case ANT_BSC_PAGE_0:
+ // No implementation needed
+ break;
+ case ANT_BSC_PAGE_1:
+ ant_bsc_page_1_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_1));
+ break;
+ case ANT_BSC_PAGE_2:
+ ant_bsc_page_2_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_2));
+ break;
+ case ANT_BSC_PAGE_3:
+ ant_bsc_page_3_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_3));
+ break;
+ case ANT_BSC_PAGE_4:
+ ant_bsc_page_4_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_4));
+ break;
+ case ANT_BSC_PAGE_5:
+ ant_bsc_page_5_encode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_5));
+ break;
+ default:
+ // No implementation needed
+ break;
+ }
+ }
+
+ p_profile->evt_handler(p_profile, bsc_sens_event);
+}
+
+/**@brief Function for setting payload for ANT message and sending it.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ */
+static void ant_message_send(ant_bsc_profile_t * p_profile)
+{
+ uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE];
+ uint32_t err_code;
+
+ sens_message_encode(p_profile, p_message_payload);
+ err_code = sd_ant_broadcast_message_tx(p_profile->channel_number,
+ sizeof(p_message_payload),
+ p_message_payload);
+ APP_ERROR_CHECK(err_code);
+}
+
+void ant_bsc_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ant_bsc_profile_t * p_profile = (ant_bsc_profile_t *)p_context;
+
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ switch (p_ant_evt->event)
+ {
+ case EVENT_TX:
+ ant_message_send(p_profile);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+ret_code_t ant_bsc_disp_open(ant_bsc_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ NRF_LOG_INFO("ANT BSC channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+ret_code_t ant_bsc_sens_open(ant_bsc_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ // Fill tx buffer for the first frame
+ ant_message_send(p_profile);
+
+ NRF_LOG_INFO("ANT BSC channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+/**@brief Function for decoding BSC message.
+ *
+ * @param[in,out] p_profile Pointer to the profile instance.
+ * @param[in] p_message_payload Pointer to the message payload structure.
+ *
+ * @note Assume to be call each time when Rx window will occur.
+ */
+static void disp_message_decode(ant_bsc_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ const ant_bsc_message_layout_t * p_bsc_message_payload =
+ (ant_bsc_message_layout_t *)p_message_payload;
+ ant_bsc_evt_t bsc_disp_event;
+
+ if (p_profile->_cb.p_disp_cb->device_type == BSC_COMBINED_DEVICE_TYPE)
+ {
+ NRF_LOG_INFO("BSC RX Page Number: \"Combined Speed & Cadence Page\"");
+ ant_bsc_combined_page_0_decode(p_bsc_message_payload->combined.page_payload,
+ &(p_profile->page_comb_0));
+ bsc_disp_event = (ant_bsc_evt_t) ANT_BSC_COMB_PAGE_0_UPDATED;
+ }
+ else
+ {
+ NRF_LOG_INFO("BSC RX Page Number: %u",
+ p_bsc_message_payload->speed_or_cadence.page_number);
+ ant_bsc_page_0_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_0)); // Page 0 is present in each message
+ bsc_disp_event = (ant_bsc_evt_t) p_bsc_message_payload->speed_or_cadence.page_number;
+
+ switch (p_bsc_message_payload->speed_or_cadence.page_number)
+ {
+ case ANT_BSC_PAGE_0:
+ // No implementation needed
+ break;
+
+ case ANT_BSC_PAGE_1:
+ ant_bsc_page_1_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_1));
+ break;
+
+ case ANT_BSC_PAGE_2:
+ ant_bsc_page_2_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_2));
+ break;
+
+ case ANT_BSC_PAGE_3:
+ ant_bsc_page_3_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_3));
+ break;
+
+ case ANT_BSC_PAGE_4:
+ ant_bsc_page_4_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_4));
+ break;
+
+ case ANT_BSC_PAGE_5:
+ ant_bsc_page_5_decode(p_bsc_message_payload->speed_or_cadence.page_payload,
+ &(p_profile->page_5));
+ break;
+
+ default:
+ // No implementation needed
+ break;
+ }
+ }
+
+ p_profile->evt_handler(p_profile, bsc_disp_event);
+}
+
+void ant_bsc_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ant_bsc_profile_t * p_profile = (ant_bsc_profile_t *)p_context;
+
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX:
+
+ if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
+ {
+ disp_message_decode(p_profile, p_ant_evt->message.ANT_MESSAGE_aucPayload);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.h
new file mode 100644
index 0000000..26f053d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc.h
@@ -0,0 +1,359 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/** @file
+ *
+ * @defgroup ant_bsc Bicycle Speed and Cadence profile
+ * @{
+ * @ingroup ant_sdk_profiles
+ * @brief This module implements the Bicycle Speed and Cadence profile.
+ *
+ */
+
+#ifndef ANT_BSC_H__
+#define ANT_BSC_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "sdk_errors.h"
+#include "ant_parameters.h"
+#include "nrf_sdh_ant.h"
+#include "ant_channel_config.h"
+#include "ant_bsc_pages.h"
+
+#define BSC_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz).
+
+#define BSC_SPEED_DEVICE_TYPE 0x7B ///< Device type reserved for ANT+ bike speed sensor.
+#define BSC_CADENCE_DEVICE_TYPE 0x7A ///< Device type reserved for ANT+ bike cadence sensor.
+#define BSC_COMBINED_DEVICE_TYPE 0x79 ///< Device type reserved for ANT+ bike combined speed and cadence sensor.
+
+#define BSC_MSG_PERIOD_4Hz 1u ///< Message period, 4 Hz (in basic period counts, where basic period time = 0.25 s).
+#define BSC_MSG_PERIOD_2Hz 2u ///< Message period, 2 Hz (in basic period counts).
+#define BSC_MSG_PERIOD_1Hz 4u ///< Message period, 1 Hz (in basic period counts).
+#define BSC_MSG_PERIOD_SPEED 0x1FB6u ///< Message period in ticks, decimal 8118 (4.04 Hz).
+#define BSC_MSG_PERIOD_CADENCE 0x1FA6u ///< Message period in ticks, decimal 8102 (4.04 Hz).
+#define BSC_MSG_PERIOD_COMBINED 0x1F96u ///< Message period in ticks, decimal 8086 (4.05 Hz).
+
+#define BSC_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+#define BSC_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE_RX_ONLY ///< Display BSC channel type.
+#define BSC_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor BSC channel type.
+
+/**@brief Select the basic ANT channel period (in ticks) for the BSC profile depending on the device type.
+ *
+ * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE,
+ * @ref BSC_COMBINED_DEVICE_TYPE.
+ */
+#define BSC_DEVICE_TICKS(DEVICE_TYPE) \
+ ((DEVICE_TYPE) == (BSC_SPEED_DEVICE_TYPE) ? (BSC_MSG_PERIOD_SPEED) : \
+ ((DEVICE_TYPE) == (BSC_CADENCE_DEVICE_TYPE) ? (BSC_MSG_PERIOD_CADENCE) : \
+ ((DEVICE_TYPE) == (BSC_COMBINED_DEVICE_TYPE) ? (BSC_MSG_PERIOD_COMBINED) : 0u)))
+
+/**@brief Calculate the channel period (in ticks) depending on the device type and the chosen message frequency.
+ *
+ * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE,
+ * @ref BSC_COMBINED_DEVICE_TYPE.
+ * @param[in] BSC_MSG_PERIOD Channel data period. The BSC profile supports only the following periods:
+ * @ref BSC_MSG_PERIOD_4Hz, @ref BSC_MSG_PERIOD_2Hz, @ref BSC_MSG_PERIOD_1Hz.
+ */
+#define BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD) \
+ ((BSC_DEVICE_TICKS(DEVICE_TYPE)) * (BSC_MSG_PERIOD))
+
+/**@brief Initialize an ANT channel configuration structure for the BSC profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE,
+ * @ref BSC_COMBINED_DEVICE_TYPE.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ * @param[in] BSC_MSG_PERIOD Channel data frequency in Hz. The BSC profile supports only the following frequencies:
+ * @ref BSC_MSG_PERIOD_4Hz, @ref BSC_MSG_PERIOD_2Hz, @ref BSC_MSG_PERIOD_1Hz.
+ */
+#define BSC_DISP_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER, \
+ BSC_MSG_PERIOD) \
+static const ant_channel_config_t CONCAT_2(NAME, _channel_bsc_disp_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = BSC_DISP_CHANNEL_TYPE, \
+ .ext_assign = BSC_EXT_ASSIGN, \
+ .rf_freq = BSC_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = (DEVICE_TYPE), \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD), \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define BSC_DISP_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME, _channel_bsc_disp_config)
+
+/**@brief Initialize an ANT channel configuration structure for the BSC profile (Transmitter).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE,
+ * @ref BSC_COMBINED_DEVICE_TYPE.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ */
+#define BSC_SENS_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER) \
+static const ant_channel_config_t NAME##_channel_bsc_sens_config = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = BSC_SENS_CHANNEL_TYPE, \
+ .ext_assign = BSC_EXT_ASSIGN, \
+ .rf_freq = BSC_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = (DEVICE_TYPE), \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD_4Hz), \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define BSC_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_bsc_sens_config
+
+/**@brief Initialize an ANT profile configuration structure for the BSC profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the BSC profile.
+ */
+#define BSC_DISP_PROFILE_CONFIG_DEF(NAME, \
+ EVT_HANDLER) \
+static ant_bsc_disp_cb_t CONCAT_2(NAME, _bsc_disp_cb); \
+static const ant_bsc_disp_config_t CONCAT_2(NAME, _profile_bsc_disp_config) = \
+ { \
+ .p_cb = &CONCAT_2(NAME, _bsc_disp_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define BSC_DISP_PROFILE_CONFIG(NAME) &CONCAT_2(NAME, _profile_bsc_disp_config)
+
+
+/**@brief Initialize an ANT profile configuration structure for the BSC profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] PAGE_1_PRESENT Determines whether page 1 is included.
+ * @param[in] PAGE_4_PRESENT Determines whether page 4 is included.
+ * @param[in] MAIN_PAGE_NUMBER Determines the main data page (@ref ANT_BSC_PAGE_0 or @ref ANT_BSC_PAGE_5 or @ref ANT_BSC_COMB_PAGE_0).
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the BSC profile.
+ */
+#define BSC_SENS_PROFILE_CONFIG_DEF(NAME, \
+ PAGE_1_PRESENT, \
+ PAGE_4_PRESENT, \
+ MAIN_PAGE_NUMBER, \
+ EVT_HANDLER) \
+static ant_bsc_sens_cb_t CONCAT_2(NAME, _bsc_sens_cb); \
+static const ant_bsc_sens_config_t CONCAT_2(NAME, _profile_bsc_sens_config) = \
+ { \
+ .page_1_present = (PAGE_1_PRESENT), \
+ .page_4_present = (PAGE_4_PRESENT), \
+ .main_page_number = (MAIN_PAGE_NUMBER), \
+ .p_cb = &CONCAT_2(NAME, _bsc_sens_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define BSC_SENS_PROFILE_CONFIG(NAME) &CONCAT_2(NAME, _profile_bsc_sens_config)
+
+
+/**@brief BSC page number type. */
+typedef enum{
+ ANT_BSC_PAGE_0, ///< Main data page number 0.
+ ANT_BSC_PAGE_1, ///< Background data page number 1. This page is optional.
+ ANT_BSC_PAGE_2, ///< Background data page number 2.
+ ANT_BSC_PAGE_3, ///< Background data page number 3.
+ ANT_BSC_PAGE_4, ///< Background data page number 4. This page is optional.
+ ANT_BSC_PAGE_5, ///< Main data page number 5. This page is optional.
+ ANT_BSC_COMB_PAGE_0 ///< Main data page number 0 for combined speed and cadence sensor.
+} ant_bsc_page_t;
+
+/**@brief BSC profile event type. */
+typedef enum{
+ ANT_BSC_PAGE_0_UPDATED = ANT_BSC_PAGE_0, ///< Data page 0 has been updated (Display) or sent (Sensor).
+ ANT_BSC_PAGE_1_UPDATED = ANT_BSC_PAGE_1, ///< Data page 0 and page 1 have been updated (Display) or sent (Sensor).
+ ANT_BSC_PAGE_2_UPDATED = ANT_BSC_PAGE_2, ///< Data page 0 and page 2 have been updated (Display) or sent (Sensor).
+ ANT_BSC_PAGE_3_UPDATED = ANT_BSC_PAGE_3, ///< Data page 0 and page 3 have been updated (Display) or sent (Sensor).
+ ANT_BSC_PAGE_4_UPDATED = ANT_BSC_PAGE_4, ///< Data page 0 and page 4 have been updated (Display) or sent (Sensor).
+ ANT_BSC_PAGE_5_UPDATED = ANT_BSC_PAGE_5, ///< Data page 0 and page 5 have been updated (Display) or sent (Sensor).
+ ANT_BSC_COMB_PAGE_0_UPDATED = ANT_BSC_COMB_PAGE_0, ///< Combined Speed and cadence data page has been updated (Display) or sent (Sensor).
+} ant_bsc_evt_t;
+
+// Forward declaration of the ant_bsc_profile_t type.
+typedef struct ant_bsc_profile_s ant_bsc_profile_t;
+
+/**@brief BSC event handler type. */
+typedef void (* ant_bsc_evt_handler_t) (ant_bsc_profile_t *, ant_bsc_evt_t);
+
+#include "ant_bsc_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief BSC Display configuration structure. */
+typedef struct
+{
+ ant_bsc_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile.
+} ant_bsc_disp_config_t;
+
+/**@brief BSC Sensor configuration structure. */
+typedef struct
+{
+ bool page_1_present; ///< Determines whether page 1 is included.
+ bool page_4_present; ///< Determines whether page 4 is included.
+ ant_bsc_page_t main_page_number; ///< Determines the main data page (@ref ANT_BSC_PAGE_0 or @ref ANT_BSC_PAGE_5 or @ref ANT_BSC_COMB_PAGE_0).
+ ant_bsc_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile.
+} ant_bsc_sens_config_t;
+
+/**@brief BSC profile structure. */
+struct ant_bsc_profile_s
+{
+ uint8_t channel_number; ///< Channel number assigned to the profile.
+ union {
+ ant_bsc_disp_cb_t * p_disp_cb;
+ ant_bsc_sens_cb_t * p_sens_cb;
+ } _cb; ///< Pointer to internal control block.
+ ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile.
+ ant_bsc_page0_data_t page_0; ///< Page 0.
+ ant_bsc_page1_data_t page_1; ///< Page 1.
+ ant_bsc_page2_data_t page_2; ///< Page 2.
+ ant_bsc_page3_data_t page_3; ///< Page 3.
+ ant_bsc_page4_data_t page_4; ///< Page 4.
+ ant_bsc_page5_data_t page_5; ///< Page 5.
+ ant_bsc_combined_page0_data_t page_comb_0; ///< Page 0 for combined speed and cadence sensor.
+};
+
+/** @name Defines for accessing ant_bsc_profile_t member variables
+@{ */
+#define BSC_PROFILE_event_time page_0.event_time
+#define BSC_PROFILE_rev_count page_0.rev_count
+#define BSC_PROFILE_operating_time page_1.operating_time
+#define BSC_PROFILE_manuf_id page_2.manuf_id
+#define BSC_PROFILE_serial_num page_2.serial_num
+#define BSC_PROFILE_hw_version page_3.hw_version
+#define BSC_PROFILE_sw_version page_3.sw_version
+#define BSC_PROFILE_model_num page_3.model_num
+#define BSC_PROFILE_fract_bat_volt page_4.fract_bat_volt
+#define BSC_PROFILE_coarse_bat_volt page_4.coarse_bat_volt
+#define BSC_PROFILE_bat_status page_4.bat_status
+#define BSC_PROFILE_stop_indicator page_5.stop_indicator
+#define BSC_PROFILE_cadence_event_time page_comb_0.cadence_event_time
+#define BSC_PROFILE_cadence_rev_count page_comb_0.cadence_rev_count
+#define BSC_PROFILE_speed_event_time page_comb_0.speed_event_time
+#define BSC_PROFILE_speed_rev_count page_comb_0.speed_rev_count
+/** @} */
+
+/**@brief Function for initializing the ANT BSC profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_disp_config Pointer to the BSC display configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bsc_disp_init(ant_bsc_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bsc_disp_config_t const * p_disp_config);
+
+/**@brief Function for initializing the ANT BSC profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_sens_config Pointer to the BSC sensor configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bsc_sens_init(ant_bsc_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_bsc_sens_config_t const * p_sens_config);
+
+/**@brief Function for opening the profile instance channel for the ANT BSC Display.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bsc_disp_open(ant_bsc_profile_t * p_profile);
+
+/**@brief Function for opening the profile instance channel for the ANT BSC Sensor.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_bsc_sens_open(ant_bsc_profile_t * p_profile);
+
+/**@brief Function for handling the Sensor ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Bicycle Speed and Cadence Sensor profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_bsc_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+/**@brief Function for handling the Display ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Bicycle Speed and Cadence Display profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_bsc_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_H__
+/** @} */
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h
new file mode 100644
index 0000000..44c64cc
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_LOCAL_H__
+#define ANT_BSC_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_bsc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ant_bsc
+ * @{
+ */
+
+/**@brief BSC Sensor control block. */
+typedef struct
+{
+ uint8_t device_type;
+ uint8_t toggle_bit : 1;
+ ant_bsc_page_t main_page_number : 7;
+ uint8_t page_1_present : 1;
+ uint8_t page_4_present : 1;
+ ant_bsc_page_t bkgd_page_number : 6;
+ uint8_t message_counter;
+}ant_bsc_sens_cb_t;
+
+/**@brief BSC Display control block. */
+typedef struct
+{
+ uint8_t device_type;
+}ant_bsc_disp_cb_t;
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c
new file mode 100644
index 0000000..4ac5c62
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_combined_page_0.h"
+#include "ant_bsc_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_combined_page_0
+#if ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_COMBINED_PAGE_0_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_COMBINED_PAGE_0_INFO_COLOR
+#else // ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 0 data layout structure. */
+typedef struct
+{
+ uint8_t cadence_evt_time_LSB;
+ uint8_t cadence_evt_time_MSB;
+ uint8_t cadence_rev_count_LSB;
+ uint8_t cadence_rev_count_MSB;
+ uint8_t speed_evt_time_LSB;
+ uint8_t speed_evt_time_MSB;
+ uint8_t speed_rev_count_LSB;
+ uint8_t speed_rev_count_MSB;
+}ant_bsc_combined_page0_data_layout_t;
+
+/**@brief Function for printing combined speed and cadence page0 data. */
+static void comb_page0_data_log(ant_bsc_combined_page0_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Cadence Revolution count: %u",
+ (unsigned int)p_page_data->cadence_rev_count);
+
+ NRF_LOG_INFO("Cadence event time: %u.%03us",
+ (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->cadence_event_time),
+ (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->cadence_event_time));
+
+ NRF_LOG_INFO("Speed Revolution count: %u",
+ (unsigned int)p_page_data->speed_rev_count);
+
+ NRF_LOG_INFO("Speed event time: %u.%03us\r\n\n",
+ (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->speed_event_time),
+ (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->speed_event_time));
+}
+
+void ant_bsc_combined_page_0_encode(uint8_t * p_page_buffer, ant_bsc_combined_page0_data_t const * p_page_data)
+{
+ ant_bsc_combined_page0_data_layout_t * p_outcoming_data = (ant_bsc_combined_page0_data_layout_t *) p_page_buffer;
+
+ uint16_t cadence_event_time = p_page_data->cadence_event_time;
+ uint16_t cadence_rev_count = p_page_data->cadence_rev_count;
+ uint16_t speed_event_time = p_page_data->speed_event_time;
+ uint16_t speed_rev_count = p_page_data->speed_rev_count;
+
+ p_outcoming_data->cadence_evt_time_LSB = (uint8_t)(cadence_event_time & UINT8_MAX);
+ p_outcoming_data->cadence_evt_time_MSB = (uint8_t)((cadence_event_time >> 8) & UINT8_MAX);
+ p_outcoming_data->cadence_rev_count_LSB = (uint8_t)(cadence_rev_count & UINT8_MAX);
+ p_outcoming_data->cadence_rev_count_MSB = (uint8_t)((cadence_rev_count >> 8) & UINT8_MAX);
+ p_outcoming_data->speed_evt_time_LSB = (uint8_t)(speed_event_time & UINT8_MAX);
+ p_outcoming_data->speed_evt_time_MSB = (uint8_t)((speed_event_time >> 8) & UINT8_MAX);
+ p_outcoming_data->speed_rev_count_LSB = (uint8_t)(speed_rev_count & UINT8_MAX);
+ p_outcoming_data->speed_rev_count_MSB = (uint8_t)((speed_rev_count >> 8) & UINT8_MAX);
+
+ comb_page0_data_log(p_page_data);
+}
+
+void ant_bsc_combined_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_combined_page0_data_t * p_page_data)
+{
+ ant_bsc_combined_page0_data_layout_t const * p_incoming_data = (ant_bsc_combined_page0_data_layout_t *)p_page_buffer;
+
+ uint16_t cadence_event_time = (uint16_t)((p_incoming_data->cadence_evt_time_MSB << 8)
+ + p_incoming_data->cadence_evt_time_LSB);
+ uint16_t cadence_revolution_count = (uint16_t) ((p_incoming_data->cadence_rev_count_MSB << 8)
+ + p_incoming_data->cadence_rev_count_LSB);
+ uint16_t speed_event_time = (uint16_t)((p_incoming_data->speed_evt_time_MSB << 8)
+ + p_incoming_data->speed_evt_time_LSB);
+ uint16_t speed_revolution_count = (uint16_t) ((p_incoming_data->speed_rev_count_MSB << 8)
+ + p_incoming_data->speed_rev_count_LSB);
+
+ p_page_data->cadence_event_time = cadence_event_time;
+ p_page_data->cadence_rev_count = cadence_revolution_count;
+ p_page_data->speed_event_time = speed_event_time;
+ p_page_data->speed_rev_count = speed_revolution_count;
+
+ comb_page0_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h
new file mode 100644
index 0000000..b1e5fef
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_COMBINED_PAGE_0_H__
+#define ANT_BSC_COMBINED_PAGE_0_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_combined_page0 BSC profile page 0 (combined speed & cadence)
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for Bicycle Combined Speed and Cadence data page 0.
+ *
+ * This structure is used as a common page.
+ */
+typedef struct
+{
+ uint16_t cadence_event_time; ///< Cadence event time.
+ uint16_t cadence_rev_count; ///< Cadence revolution count.
+ uint16_t speed_event_time; ///< Speed event time.
+ uint16_t speed_rev_count; ///< Speed revolution count.
+} ant_bsc_combined_page0_data_t;
+
+/**@brief Initialize page 0.
+ */
+#define DEFAULT_ANT_BSC_COMBINED_PAGE0() \
+ (ant_bsc_combined_page0_data_t) \
+ { \
+ .cadence_event_time = 0, \
+ .cadence_rev_count = 0, \
+ .speed_event_time = 0, \
+ .speed_rev_count = 0, \
+ }
+
+/**@brief Function for encoding page 0.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_combined_page_0_encode(uint8_t * p_page_buffer, ant_bsc_combined_page0_data_t const * p_page_data);
+
+/**@brief Function for decoding page 0.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_combined_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_combined_page0_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_COMBINED_PAGE_0_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c
new file mode 100644
index 0000000..3122336
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_0.h"
+#include "ant_bsc_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_0
+#if ANT_BSC_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_0_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_0_INFO_COLOR
+#else // ANT_BSC_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_0_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 0 data layout structure. */
+typedef struct
+{
+ uint8_t reserved[3];
+ uint8_t bsc_evt_time_LSB;
+ uint8_t bsc_evt_time_MSB;
+ uint8_t bsc_rev_count_LSB;
+ uint8_t bsc_rev_count_MSB;
+}ant_bsc_page0_data_layout_t;
+
+/**@brief Function for printing speed or cadence page0 data. */
+static void page0_data_log(ant_bsc_page0_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Revolution count: %u", (unsigned int)p_page_data->rev_count);
+
+ NRF_LOG_INFO("BSC event time: %u.%03us",
+ (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->event_time),
+ (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->event_time));
+
+// NRF_LOG_INFO("%03us", (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->event_time));
+}
+
+void ant_bsc_page_0_encode(uint8_t * p_page_buffer, ant_bsc_page0_data_t const * p_page_data)
+{
+ ant_bsc_page0_data_layout_t * p_outcoming_data = (ant_bsc_page0_data_layout_t *) p_page_buffer;
+ uint16_t event_time = p_page_data->event_time;
+ uint16_t rev_count = p_page_data->rev_count;
+
+ p_outcoming_data->reserved[0] = UINT8_MAX;
+ p_outcoming_data->reserved[1] = UINT8_MAX;
+ p_outcoming_data->reserved[2] = UINT8_MAX;
+ p_outcoming_data->bsc_evt_time_LSB = (uint8_t)(event_time & UINT8_MAX);
+ p_outcoming_data->bsc_evt_time_MSB = (uint8_t)((event_time >> 8) & UINT8_MAX);
+ p_outcoming_data->bsc_rev_count_LSB = (uint8_t)(rev_count & UINT8_MAX);
+ p_outcoming_data->bsc_rev_count_MSB = (uint8_t)((rev_count >> 8) & UINT8_MAX);
+
+ page0_data_log(p_page_data);
+}
+
+void ant_bsc_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_page0_data_t * p_page_data)
+{
+ ant_bsc_page0_data_layout_t const * p_incoming_data = (ant_bsc_page0_data_layout_t *)p_page_buffer;
+
+ uint16_t event_time = (uint16_t)((p_incoming_data->bsc_evt_time_MSB << 8)
+ + p_incoming_data->bsc_evt_time_LSB);
+
+ uint16_t revolution_count = (uint16_t) ((p_incoming_data->bsc_rev_count_MSB << 8)
+ + p_incoming_data->bsc_rev_count_LSB);
+
+ p_page_data->event_time = event_time;
+ p_page_data->rev_count = revolution_count;
+
+ page0_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h
new file mode 100644
index 0000000..bce264f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_0_H__
+#define ANT_BSC_PAGE_0_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page0 BSC profile page 0
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BSC data page 0.
+ *
+ * This structure is used as a common page.
+ */
+typedef struct
+{
+ uint16_t event_time; ///< Speed or cadence event time.
+ uint16_t rev_count; ///< Speed or cadence revolution count.
+} ant_bsc_page0_data_t;
+
+/**@brief Initialize page 0.
+ */
+#define DEFAULT_ANT_BSC_PAGE0() \
+ (ant_bsc_page0_data_t) \
+ { \
+ .event_time = 0, \
+ .rev_count = 0 \
+ }
+
+/**@brief Function for encoding page 0.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_0_encode(uint8_t * p_page_buffer, ant_bsc_page0_data_t const * p_page_data);
+
+/**@brief Function for decoding page 0.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_page0_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_0_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c
new file mode 100644
index 0000000..929b655
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_1.h"
+#include "ant_bsc_utils.h"
+#include "app_util.h"
+#include "nordic_common.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_1
+#if ANT_BSC_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_1_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_1_INFO_COLOR
+#else // ANT_BSC_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_1_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 1 data layout structure. */
+typedef struct
+{
+ uint8_t cumulative_operating_time[3];
+ uint8_t reserved[4];
+}ant_bsc_page1_data_layout_t;
+
+/**@brief Function for printing speed or cadence page1 data. */
+static void page1_data_log(ant_bsc_page1_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Cumulative operating time: %ud %uh %um %us",
+ (unsigned int)ANT_BSC_OPERATING_DAYS(p_page_data->operating_time),
+ (unsigned int)ANT_BSC_OPERATING_HOURS(p_page_data->operating_time),
+ (unsigned int)ANT_BSC_OPERATING_MINUTES(p_page_data->operating_time),
+ (unsigned int)ANT_BSC_OPERATING_SECONDS(p_page_data->operating_time));
+}
+
+void ant_bsc_page_1_encode(uint8_t * p_page_buffer, ant_bsc_page1_data_t const * p_page_data)
+{
+ ant_bsc_page1_data_layout_t * p_outcoming_data = (ant_bsc_page1_data_layout_t *)p_page_buffer;
+
+ UNUSED_PARAMETER(uint24_encode(p_page_data->operating_time,
+ p_outcoming_data->cumulative_operating_time));
+ page1_data_log( p_page_data);
+}
+
+void ant_bsc_page_1_decode(uint8_t const * p_page_buffer, ant_bsc_page1_data_t * p_page_data)
+{
+ ant_bsc_page1_data_layout_t const * p_incoming_data = (ant_bsc_page1_data_layout_t *)p_page_buffer;
+
+ p_page_data->operating_time = uint24_decode(p_incoming_data->cumulative_operating_time);
+
+ page1_data_log( p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h
new file mode 100644
index 0000000..3739da6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_1_H__
+#define ANT_BSC_PAGE_1_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page1 BSC profile page 1
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BSC data page 1.
+ *
+ * This structure implements only page 1 specific data.
+ */
+typedef struct
+{
+ uint32_t operating_time; ///< Operating time.
+} ant_bsc_page1_data_t;
+
+/**@brief Initialize page 1.
+ */
+#define DEFAULT_ANT_BSC_PAGE1() \
+ (ant_bsc_page1_data_t) \
+ { \
+ .operating_time = 0, \
+ }
+
+/**@brief Function for encoding page 1.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_1_encode(uint8_t * p_page_buffer, ant_bsc_page1_data_t const * p_page_data);
+
+/**@brief Function for decoding page 1.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_1_decode(uint8_t const * p_page_buffer, ant_bsc_page1_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_1_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c
new file mode 100644
index 0000000..4fb01d2
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_2.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_2
+#if ANT_BSC_PAGE_2_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_2_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_2_INFO_COLOR
+#else // ANT_BSC_PAGE_2_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_2_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 2 data layout structure. */
+typedef struct
+{
+ uint8_t manuf_id;
+ uint8_t serial_num_LSB;
+ uint8_t serial_num_MSB;
+ uint8_t reserved[4];
+}ant_bsc_page2_data_layout_t;
+
+/**@brief Function for printing speed or cadence page2 data. */
+static void page2_data_log(ant_bsc_page2_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Manufacturer ID: %u", (unsigned int)p_page_data->manuf_id);
+ NRF_LOG_INFO("Serial No (upper 16-bits): 0x%X",
+ (unsigned int)p_page_data->serial_num);
+}
+
+void ant_bsc_page_2_encode(uint8_t * p_page_buffer, ant_bsc_page2_data_t const * p_page_data)
+{
+ ant_bsc_page2_data_layout_t * p_outcoming_data = (ant_bsc_page2_data_layout_t *)p_page_buffer;
+ uint32_t serial_num = p_page_data->serial_num;
+
+ p_outcoming_data->manuf_id = (uint8_t)p_page_data->manuf_id;
+ p_outcoming_data->serial_num_LSB = (uint8_t)(serial_num & UINT8_MAX);
+ p_outcoming_data->serial_num_MSB = (uint8_t)((serial_num >> 8) & UINT8_MAX);
+
+ page2_data_log( p_page_data);
+}
+
+void ant_bsc_page_2_decode(uint8_t const * p_page_buffer, ant_bsc_page2_data_t * p_page_data)
+{
+ ant_bsc_page2_data_layout_t const * p_incoming_data = (ant_bsc_page2_data_layout_t *)p_page_buffer;
+ uint32_t serial_num = (uint32_t)((p_incoming_data->serial_num_MSB << 8)
+ + p_incoming_data->serial_num_LSB);
+
+ p_page_data->manuf_id = (uint32_t)p_incoming_data->manuf_id;
+ p_page_data->serial_num = serial_num;
+
+ page2_data_log( p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h
new file mode 100644
index 0000000..55d9793
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_2_H__
+#define ANT_BSC_PAGE_2_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page2 BSC profile page 2
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BSC data page 2.
+ *
+ * This structure implements only page 2 specific data.
+ */
+typedef struct
+{
+ uint8_t manuf_id; ///< Manufacturer ID.
+ uint16_t serial_num; ///< Serial number.
+} ant_bsc_page2_data_t;
+
+/**@brief Initialize page 2.
+ */
+#define DEFAULT_ANT_BSC_PAGE2() \
+ (ant_bsc_page2_data_t) \
+ { \
+ .manuf_id = 0, \
+ .serial_num = 0, \
+ }
+
+/**@brief Function for encoding page 2.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_2_encode(uint8_t * p_page_buffer, ant_bsc_page2_data_t const * p_page_data);
+
+/**@brief Function for decoding page 2.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_2_decode(uint8_t const * p_page_buffer, ant_bsc_page2_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_2_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c
new file mode 100644
index 0000000..ab52197
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_3.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_3
+#if ANT_BSC_PAGE_3_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_3_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_3_INFO_COLOR
+#else // ANT_BSC_PAGE_3_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_3_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 3 data layout structure. */
+typedef struct
+{
+ uint8_t hw_version;
+ uint8_t sw_version;
+ uint8_t model_num;
+ uint8_t reserved[4];
+}ant_bsc_page3_data_layout_t;
+
+/**@brief Function for printing speed or cadence page3 data. */
+static void page3_data_log(ant_bsc_page3_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Hardware Rev ID: %u", (unsigned int)p_page_data->hw_version);
+ NRF_LOG_INFO("Model Number: %u", (unsigned int)p_page_data->model_num);
+ NRF_LOG_INFO("Software Ver ID: %u", (unsigned int)p_page_data->sw_version);
+}
+
+void ant_bsc_page_3_encode(uint8_t * p_page_buffer, ant_bsc_page3_data_t const * p_page_data)
+{
+ ant_bsc_page3_data_layout_t * p_outcoming_data = (ant_bsc_page3_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->hw_version = (uint8_t)p_page_data->hw_version;
+ p_outcoming_data->sw_version = (uint8_t)p_page_data->sw_version;
+ p_outcoming_data->model_num = (uint8_t)p_page_data->model_num;
+
+ page3_data_log( p_page_data);
+}
+
+void ant_bsc_page_3_decode(uint8_t const * p_page_buffer, ant_bsc_page3_data_t * p_page_data)
+{
+ ant_bsc_page3_data_layout_t const * p_incoming_data = (ant_bsc_page3_data_layout_t *)p_page_buffer;
+
+ p_page_data->hw_version = (uint32_t)p_incoming_data->hw_version;
+ p_page_data->sw_version = (uint32_t)p_incoming_data->sw_version;
+ p_page_data->model_num = (uint32_t)p_incoming_data->model_num;
+
+ page3_data_log( p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h
new file mode 100644
index 0000000..6aa663e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_3_H__
+#define ANT_BSC_PAGE_3_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page3 BSC profile page 3
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BSC data page 3.
+ *
+ * This structure implements only page 3 specific data.
+ */
+typedef struct
+{
+ uint8_t hw_version; ///< Hardware version.
+ uint8_t sw_version; ///< Software version.
+ uint8_t model_num; ///< Model number.
+} ant_bsc_page3_data_t;
+
+/**@brief Initialize page 3.
+ */
+#define DEFAULT_ANT_BSC_PAGE3() \
+ (ant_bsc_page3_data_t) \
+ { \
+ .hw_version = 0, \
+ .sw_version = 0, \
+ .model_num = 0, \
+ }
+
+/**@brief Function for encoding page 3.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_3_encode(uint8_t * p_page_buffer, ant_bsc_page3_data_t const * p_page_data);
+
+/**@brief Function for decoding page 3.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_3_decode(uint8_t const * p_page_buffer, ant_bsc_page3_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_3_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c
new file mode 100644
index 0000000..a8f83f2
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_4.h"
+#include "ant_bsc_utils.h"
+#include "app_util.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_4
+#if ANT_BSC_PAGE_4_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_4_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_4_INFO_COLOR
+#else // ANT_BSC_PAGE_4_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_4_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC page 4 data layout structure. */
+typedef struct
+{
+ uint8_t reserved_byte;
+ uint8_t fract_bat_volt;
+ uint8_t coarse_bat_volt : 4;
+ uint8_t bat_status : 3;
+ uint8_t bitfield_reserved : 1;
+ uint8_t reserved[4];
+}ant_bsc_page4_data_layout_t;
+
+/* Display precission must be updated. */
+STATIC_ASSERT(ANT_BSC_BAT_VOLTAGE_PRECISION == 1000);
+
+/**@brief Function for printing speed or cadence page4 data. */
+static void page4_data_log( ant_bsc_page4_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Battery voltage: %u.%03uV",
+ (unsigned int)p_page_data->coarse_bat_volt,
+ (unsigned int)ANT_BSC_BAT_VOLTAGE_FRACTION_MV(p_page_data->fract_bat_volt));
+ NRF_LOG_INFO("Battery status: %u", (unsigned int)p_page_data->bat_status);
+}
+
+void ant_bsc_page_4_encode(uint8_t * p_page_buffer, ant_bsc_page4_data_t const * p_page_data)
+{
+ ant_bsc_page4_data_layout_t * p_outcoming_data = (ant_bsc_page4_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->reserved_byte = UINT8_MAX;
+ p_outcoming_data->fract_bat_volt = p_page_data->fract_bat_volt;
+ p_outcoming_data->coarse_bat_volt = p_page_data->coarse_bat_volt;
+ p_outcoming_data->bat_status = p_page_data->bat_status;
+ p_outcoming_data->bitfield_reserved = 0;
+
+ page4_data_log( p_page_data);
+}
+
+void ant_bsc_page_4_decode(uint8_t const * p_page_buffer, ant_bsc_page4_data_t * p_page_data)
+{
+ ant_bsc_page4_data_layout_t const * p_incoming_data = (ant_bsc_page4_data_layout_t *)p_page_buffer;
+
+ p_page_data->fract_bat_volt = p_incoming_data->fract_bat_volt;
+ p_page_data->coarse_bat_volt = p_incoming_data->coarse_bat_volt;
+ p_page_data->bat_status = p_incoming_data->bat_status;
+
+ page4_data_log( p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h
new file mode 100644
index 0000000..093ef57
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_4_H__
+#define ANT_BSC_PAGE_4_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page4 BSC profile page 4
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief BSC profile battery status.
+ *
+ * This enum represents possible battery status values for the ANT BSC profile.
+ */
+typedef enum
+{
+ RESERVED0 = 0, ///< Reserved.
+ BSC_BAT_STATUS_NEW = 1, ///< Battery status: new.
+ BSC_BAT_STATUS_GOOD = 2, ///< Battery status: good.
+ BSC_BAT_STATUS_OK = 3, ///< Battery status: ok.
+ BSC_BAT_STATUS_LOW = 4, ///< Battery status: low.
+ BSC_BAT_STATUS_CRITICAL = 5, ///< Battery status: critical.
+ RESERVED1 = 6, ///< Reserved.
+ BSC_BAT_STATUS_INVALID = 7 ///< Invalid battery status.
+} ant_bsc_bat_status_t;
+
+/**@brief Data structure for BSC data page 4.
+ *
+ * This structure implements only page 4 specific data.
+ */
+typedef struct
+{
+ uint8_t fract_bat_volt; ///< Fractional battery voltage.
+ uint8_t coarse_bat_volt : 4; ///< Coarse battery voltage.
+ uint8_t bat_status : 3; ///< Battery status.
+} ant_bsc_page4_data_t;
+
+/**@brief Initialize page 4.
+ */
+#define DEFAULT_ANT_BSC_PAGE4() \
+ (ant_bsc_page4_data_t) \
+ { \
+ .fract_bat_volt = 0, \
+ .coarse_bat_volt = 0, \
+ .bat_status = BSC_BAT_STATUS_INVALID \
+ }
+
+/**@brief Function for encoding page 4.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_4_encode(uint8_t * p_page_buffer, ant_bsc_page4_data_t const * p_page_data);
+
+/**@brief Function for decoding page 4.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_4_decode(uint8_t const * p_page_buffer, ant_bsc_page4_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_4_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c
new file mode 100644
index 0000000..c861143
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_BSC)
+
+#include "ant_bsc_page_5.h"
+#include "ant_bsc_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_bcs_page_5
+#if ANT_BSC_PAGE_5_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_BSC_PAGE_5_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_BSC_PAGE_5_INFO_COLOR
+#else // ANT_BSC_PAGE_5_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_BSC_PAGE_5_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief BSC profile page 5 bitfields definitions. */
+#define ANT_BSC_STOP_IND_MASK 0x01
+
+/**@brief BSC page 5 data layout structure. */
+typedef struct
+{
+ uint8_t flags;
+ uint8_t reserved[6];
+}ant_bsc_page5_data_layout_t;
+
+/**@brief Function for printing speed or cadence page5 data. */
+static void page5_data_log(ant_bsc_page5_data_t const * p_page_data)
+{
+ if (p_page_data->stop_indicator)
+ {
+ NRF_LOG_INFO("Bicycle stopped.");
+ }
+ else
+ {
+ NRF_LOG_INFO("Bicycle moving.");
+ }
+}
+
+void ant_bsc_page_5_encode(uint8_t * p_page_buffer, ant_bsc_page5_data_t const * p_page_data)
+{
+ ant_bsc_page5_data_layout_t * p_outcoming_data = (ant_bsc_page5_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->flags = (uint8_t)p_page_data->stop_indicator;
+
+ page5_data_log( p_page_data);
+}
+
+void ant_bsc_page_5_decode(uint8_t const * p_page_buffer, ant_bsc_page5_data_t * p_page_data)
+{
+ ant_bsc_page5_data_layout_t const * p_incoming_data = (ant_bsc_page5_data_layout_t *)p_page_buffer;
+
+ p_page_data->stop_indicator = (p_incoming_data->flags) & ANT_BSC_STOP_IND_MASK;
+
+ page5_data_log( p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_BSC)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h
new file mode 100644
index 0000000..64cd241
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_PAGE_5_H__
+#define ANT_BSC_PAGE_5_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_page5 BSC profile page 5
+ * @{
+ * @ingroup ant_sdk_profiles_bsc_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for BSC data page 5.
+ *
+ * This structure implements only page 5 specific data.
+ */
+typedef struct
+{
+ uint8_t stop_indicator:1; ///< Stop indication bit.
+ uint8_t reserved:7; ///< Reserved.
+} ant_bsc_page5_data_t;
+
+/**@brief Initialize page 5.
+ */
+#define DEFAULT_ANT_BSC_PAGE5() \
+ (ant_bsc_page5_data_t) \
+ { \
+ .stop_indicator = 0, \
+ .reserved = 0, \
+ }
+
+/**@brief Function for encoding page 5.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_bsc_page_5_encode(uint8_t * p_page_buffer, ant_bsc_page5_data_t const * p_page_data);
+
+/**@brief Function for decoding page 5.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_bsc_page_5_decode(uint8_t const * p_page_buffer, ant_bsc_page5_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_PAGE_5_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h
new file mode 100644
index 0000000..f725e66
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __ANT_BSC_PAGES_H
+#define __ANT_BSC_PAGES_H
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_pages Bicycle Speed and Cadence profile pages
+ * @{
+ * @ingroup ant_bsc
+ * @brief This module implements functions for the BSC data pages.
+ */
+
+#include "ant_bsc_page_0.h"
+#include "ant_bsc_page_1.h"
+#include "ant_bsc_page_2.h"
+#include "ant_bsc_page_3.h"
+#include "ant_bsc_page_4.h"
+#include "ant_bsc_page_5.h"
+#include "ant_bsc_combined_page_0.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ANT_BSC_PAGES_H
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c
new file mode 100644
index 0000000..c3499cc
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c
@@ -0,0 +1,280 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "ant_bsc_simulator.h"
+#include "ant_bsc_utils.h"
+#include "app_util.h"
+
+#define ITERATION_ANT_CYCLES(DEVICE_TYPE) \
+ (BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD_4Hz)) ///< period of calculation [1/32678 s], defined in ANT device profile
+ // use the same DEVICE TYPE as in profile definition
+#define ITERATION_PERIOD(DEVICE_TYPE) \
+ ((ITERATION_ANT_CYCLES(DEVICE_TYPE)) * 1024 / ANT_CLOCK_FREQUENCY) ///< integer part of calculation's period [1/1024 s]
+#define ITERATION_FRACTION(DEVICE_TYPE) \
+ ((ITERATION_ANT_CYCLES(DEVICE_TYPE)) * 1024 % ANT_CLOCK_FREQUENCY) ///< fractional part of calculation's period [1/32678 s]
+
+#define SPEED_SIM_MIN_VAL 0u ///< speed simulation minimum value [m/s]
+#define SPEED_SIM_MAX_VAL 16u ///< speed simulation maximum value [m/s]
+#define SPEED_SIM_INCREMENT 1u ///< speed simulation value increment [m/s]
+#define CADENCE_SIM_MIN_VAL 70u ///< cadence simulation minimum value [rpm]
+#define CADENCE_SIM_MAX_VAL 120u ///< cadence simulation maximum value [rpm]
+#define CADENCE_SIM_INCREMENT 1u ///< cadence simulation value increment [rpm]
+#define WHEEL_CIRCUMFERENCE 1766u ///< bike wheel circumference [mm]
+#define MM_TO_METERS(MM_VAL) ((MM_VAL) / 1000u)
+#define TWO_SEC_TO_TICKS 2048 ///< number of [1/1024s] ticks in 2 sec period
+#define CUMULATIVE_TIME_UNIT 2 ///< cumulative time unit
+
+void ant_bsc_simulator_init(ant_bsc_simulator_t * p_simulator,
+ ant_bsc_simulator_cfg_t const * p_config,
+ bool auto_change)
+{
+ p_simulator->p_profile = p_config->p_profile;
+ p_simulator->_cb.auto_change = auto_change;
+ p_simulator->_cb.speed_sim_val = SPEED_SIM_MIN_VAL;
+ p_simulator->_cb.cadence_sim_val = CADENCE_SIM_MIN_VAL;
+ p_simulator->_cb.time_since_last_s_evt = 0;
+ p_simulator->_cb.fraction_since_last_s_evt = 0;
+ p_simulator->_cb.time_since_last_c_evt = 0;
+ p_simulator->_cb.fraction_since_last_c_evt = 0;
+ p_simulator->_cb.device_type = p_config->device_type;
+
+ p_simulator->_cb.sensorsim_s_cfg.min = SPEED_SIM_MIN_VAL;
+ p_simulator->_cb.sensorsim_s_cfg.max = SPEED_SIM_MAX_VAL;
+ p_simulator->_cb.sensorsim_s_cfg.incr = SPEED_SIM_INCREMENT;
+ p_simulator->_cb.sensorsim_s_cfg.start_at_max = false;
+ sensorsim_init(&(p_simulator->_cb.sensorsim_s_state),
+ &(p_simulator->_cb.sensorsim_s_cfg));
+ p_simulator->_cb.sensorsim_c_cfg.min = CADENCE_SIM_MIN_VAL;
+ p_simulator->_cb.sensorsim_c_cfg.max = CADENCE_SIM_MAX_VAL;
+ p_simulator->_cb.sensorsim_c_cfg.incr = CADENCE_SIM_INCREMENT;
+ p_simulator->_cb.sensorsim_c_cfg.start_at_max = false;
+ p_simulator->_cb.stop_cnt = 0;
+ sensorsim_init(&(p_simulator->_cb.sensorsim_c_state),
+ &(p_simulator->_cb.sensorsim_c_cfg));
+}
+
+
+void ant_bsc_simulator_one_iteration(ant_bsc_simulator_t * p_simulator)
+{
+
+ // Set constant battery voltage
+ p_simulator->p_profile->BSC_PROFILE_coarse_bat_volt = 2;
+ p_simulator->p_profile->BSC_PROFILE_fract_bat_volt = 200;
+ p_simulator->p_profile->BSC_PROFILE_bat_status = BSC_BAT_STATUS_GOOD;
+
+ // Calculate speed and cadence values
+ if (p_simulator->_cb.auto_change)
+ {
+ p_simulator->_cb.speed_sim_val = sensorsim_measure(&(p_simulator->_cb.sensorsim_s_state),
+ &(p_simulator->_cb.sensorsim_s_cfg));
+ p_simulator->_cb.cadence_sim_val = sensorsim_measure(&(p_simulator->_cb.sensorsim_c_state),
+ &(p_simulator->_cb.sensorsim_c_cfg));
+ }
+ else
+ {
+ p_simulator->_cb.speed_sim_val = p_simulator->_cb.sensorsim_s_state.current_val;
+ p_simulator->_cb.cadence_sim_val = p_simulator->_cb.sensorsim_c_state.current_val;
+ }
+
+ // Simulate bicycle stopped for around 10s and go for around 5s only in auto-simulation
+ if (p_simulator->_cb.auto_change)
+ {
+ if ((p_simulator->p_profile->_cb.p_sens_cb->main_page_number == ANT_BSC_PAGE_5) &&
+ (p_simulator->_cb.stop_cnt++ < 40))
+ {
+ p_simulator->_cb.speed_sim_val = 0;
+ p_simulator->_cb.cadence_sim_val = 0;
+ }
+ else
+ {
+ if (p_simulator->_cb.stop_cnt == 60)
+ {
+ p_simulator->_cb.stop_cnt = 0;
+ }
+ }
+ }
+ if (p_simulator->_cb.speed_sim_val == 0)
+ {
+ p_simulator->p_profile->BSC_PROFILE_stop_indicator = 1;
+ }
+ else
+ {
+ p_simulator->p_profile->BSC_PROFILE_stop_indicator = 0;
+ }
+
+ // @note: Take a local copy within scope in order to assist the compiler in variable register
+ // allocation.
+ const uint32_t computed_speed = p_simulator->_cb.speed_sim_val;
+ const uint32_t computed_cadence = p_simulator->_cb.cadence_sim_val;
+
+ // @note: This implementation assumes that the current instantaneous speed/cadence can vary and this
+ // function is called with static frequency.
+ // value and the speed/cadence pulse interval is derived from it. The computation is based on 60
+ // seconds in a minute and the used time base is 1/1024 seconds.
+ const uint32_t current_speed_pulse_interval =
+ MM_TO_METERS((WHEEL_CIRCUMFERENCE * 1024u) / computed_speed);
+ const uint32_t current_cadence_pulse_interval = (60u * 1024u) / computed_cadence;
+
+ //update time from last evt detected
+ p_simulator->_cb.time_since_last_s_evt += ITERATION_PERIOD(p_simulator->_cb.device_type);
+ p_simulator->_cb.time_since_last_c_evt += ITERATION_PERIOD(p_simulator->_cb.device_type);
+
+ // extended calculation by fraction make calculating accurate in long time perspective
+ p_simulator->_cb.fraction_since_last_s_evt += ITERATION_FRACTION(p_simulator->_cb.device_type);
+ p_simulator->_cb.fraction_since_last_c_evt += ITERATION_FRACTION(p_simulator->_cb.device_type);
+
+ uint32_t add_period = p_simulator->_cb.fraction_since_last_s_evt / ANT_CLOCK_FREQUENCY;
+ if (add_period > 0)
+ {
+ p_simulator->_cb.time_since_last_s_evt++;
+ p_simulator->_cb.fraction_since_last_s_evt %= ANT_CLOCK_FREQUENCY;
+ }
+
+ add_period = p_simulator->_cb.fraction_since_last_c_evt / ANT_CLOCK_FREQUENCY;
+ if (add_period > 0)
+ {
+ p_simulator->_cb.time_since_last_c_evt++;
+ p_simulator->_cb.fraction_since_last_c_evt %= ANT_CLOCK_FREQUENCY;
+ }
+
+ // Calculate cumulative time based on time since last event (from profile data) in [1/1024] ticks
+ int16_t diff = p_simulator->p_profile->BSC_PROFILE_event_time -
+ p_simulator->_cb.prev_time_since_evt;
+ p_simulator->_cb.prev_time_since_evt = p_simulator->p_profile->BSC_PROFILE_event_time;
+
+ if (diff >= 0) // Check for time count overflow
+ {
+ // No overflow
+ p_simulator->_cb.cumulative_time += diff / TWO_SEC_TO_TICKS;
+ p_simulator->_cb.cumulative_time_frac += diff % TWO_SEC_TO_TICKS;
+ }
+ else
+ {
+ p_simulator->_cb.cumulative_time += (UINT16_MAX + diff) / TWO_SEC_TO_TICKS;
+ p_simulator->_cb.cumulative_time_frac += (UINT16_MAX + diff) % TWO_SEC_TO_TICKS;
+ }
+ // Check fraction
+ if ((p_simulator->_cb.cumulative_time_frac / TWO_SEC_TO_TICKS) > 0)
+ {
+ p_simulator->_cb.cumulative_time += p_simulator->_cb.cumulative_time_frac / TWO_SEC_TO_TICKS;
+ p_simulator->_cb.cumulative_time_frac %= TWO_SEC_TO_TICKS;
+ }
+ // Update page data if necessary
+ if (p_simulator->_cb.cumulative_time != p_simulator->p_profile->BSC_PROFILE_operating_time)
+ {
+ p_simulator->p_profile->BSC_PROFILE_operating_time = p_simulator->_cb.cumulative_time;
+ }
+
+ //calc number of events as will fill
+ uint32_t new_s_events = p_simulator->_cb.time_since_last_s_evt /
+ current_speed_pulse_interval;
+ uint32_t add_speed_event_time = new_s_events * current_speed_pulse_interval;
+ if ((new_s_events > 0) && ((p_simulator->_cb.device_type == BSC_SPEED_DEVICE_TYPE) ||
+ (p_simulator->_cb.device_type == BSC_COMBINED_DEVICE_TYPE)))
+ {
+ p_simulator->p_profile->BSC_PROFILE_rev_count += new_s_events;
+ p_simulator->p_profile->BSC_PROFILE_speed_rev_count += new_s_events;
+
+ // Current speed event time is the previous event time plus the current speed
+ // pulse interval.
+ uint32_t current_speed_event_time = p_simulator->p_profile->BSC_PROFILE_event_time +
+ add_speed_event_time;
+ // Set current event time.
+ p_simulator->p_profile->BSC_PROFILE_event_time = current_speed_event_time; // <- B<4,5> <-
+
+ current_speed_event_time = p_simulator->p_profile->BSC_PROFILE_speed_event_time +
+ add_speed_event_time;
+ // Set current event time for combined device.
+ p_simulator->p_profile->BSC_PROFILE_speed_event_time = current_speed_event_time;
+
+ p_simulator->_cb.time_since_last_s_evt -= add_speed_event_time;
+ }
+
+ uint32_t new_c_events = p_simulator->_cb.time_since_last_c_evt /
+ current_cadence_pulse_interval;
+ uint32_t add_cadence_event_time = new_c_events * current_cadence_pulse_interval;
+ if ((new_c_events > 0) && ((p_simulator->_cb.device_type == BSC_CADENCE_DEVICE_TYPE) ||
+ (p_simulator->_cb.device_type == BSC_COMBINED_DEVICE_TYPE)))
+ {
+ p_simulator->p_profile->BSC_PROFILE_rev_count += new_c_events;
+ p_simulator->p_profile->BSC_PROFILE_cadence_rev_count += new_c_events;
+
+ // Current speed event time is the previous event time plus the current speed
+ // pulse interval.
+ uint32_t current_cadence_event_time = p_simulator->p_profile->BSC_PROFILE_event_time +
+ add_cadence_event_time;
+ // Set current event time.
+ p_simulator->p_profile->BSC_PROFILE_event_time = current_cadence_event_time; //<- B<4,5> <-
+
+ current_cadence_event_time = p_simulator->p_profile->BSC_PROFILE_cadence_event_time +
+ add_cadence_event_time;
+ // Set current event time for combined device.
+ p_simulator->p_profile->BSC_PROFILE_cadence_event_time = current_cadence_event_time;
+
+ p_simulator->_cb.time_since_last_c_evt -= add_cadence_event_time;
+ }
+}
+
+
+void ant_bsc_simulator_increment(ant_bsc_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ // Speed
+ sensorsim_increment(&(p_simulator->_cb.sensorsim_s_state),
+ &(p_simulator->_cb.sensorsim_s_cfg));
+ // Cadence
+ sensorsim_increment(&(p_simulator->_cb.sensorsim_c_state),
+ &(p_simulator->_cb.sensorsim_c_cfg));
+ }
+}
+
+
+void ant_bsc_simulator_decrement(ant_bsc_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ // Speed
+ sensorsim_decrement(&(p_simulator->_cb.sensorsim_s_state),
+ &(p_simulator->_cb.sensorsim_s_cfg));
+ // Cadence
+ sensorsim_decrement(&(p_simulator->_cb.sensorsim_c_state),
+ &(p_simulator->_cb.sensorsim_c_cfg));
+ }
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h
new file mode 100644
index 0000000..98e1fc4
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_SIMULATOR_H__
+#define ANT_BSC_SIMULATOR_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_bsc_simulator ANT BSC simulator
+ * @{
+ * @ingroup ant_sdk_simulators
+ * @brief ANT BSC simulator module.
+ *
+ * @details This module simulates a pulse for the ANT Bicycle Speed and Cadence profile. The module
+ * calculates abstract values, which are handled by the BSC pages data model to ensure that
+ * they are compatible. It provides a handler for changing the cadence and speed values manually
+ * as well as functionality to change the values automatically.
+ *
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_bsc.h"
+#include "ant_bsc_utils.h"
+#include "sensorsim.h"
+#include "ant_bsc_simulator_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief BSC simulator configuration structure. */
+typedef struct
+{
+ ant_bsc_profile_t * p_profile; ///< Related profile.
+ uint8_t device_type; ///< BSC device type (must be consistent with the type chosen for the profile). Supported types:
+ // @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, @ref BSC_COMBINED_DEVICE_TYPE.
+} ant_bsc_simulator_cfg_t;
+
+/**@brief BSC simulator structure. */
+typedef struct
+{
+ ant_bsc_profile_t * p_profile; ///< Related profile.
+ ant_bsc_simulator_cb_t _cb; ///< Internal control block.
+} ant_bsc_simulator_t;
+
+
+/**@brief Function for initializing the ANT BSC simulator instance.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ * @param[in] p_config Pointer to the simulator configuration structure.
+ * @param[in] auto_change Enable or disable automatic changes of speed or cadence.
+ */
+void ant_bsc_simulator_init(ant_bsc_simulator_t * p_simulator,
+ ant_bsc_simulator_cfg_t const * p_config,
+ bool auto_change);
+
+/**@brief Function for simulating a device event.
+ *
+ * @details Based on this event, the transmitter data is simulated.
+ *
+ * This function should be called in the BSC Sensor event handler.
+ */
+void ant_bsc_simulator_one_iteration(ant_bsc_simulator_t * p_simulator);
+
+/**@brief Function for incrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_bsc_simulator_increment(ant_bsc_simulator_t * p_simulator);
+
+/**@brief Function for decrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_bsc_simulator_decrement(ant_bsc_simulator_t * p_simulator);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_SIMULATOR_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h
new file mode 100644
index 0000000..cb1aec6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_SIMULATOR_LOCAL_H__
+#define ANT_BSC_SIMULATOR_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_bsc.h"
+#include "sensorsim.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**@brief BSC simulator control block structure. */
+typedef struct
+{
+ uint8_t device_type;
+ bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually.
+ uint16_t speed_sim_val; ///< Instantaneous speed value.
+ uint16_t cadence_sim_val; ///< Instantaneous cadence value.
+ uint32_t time_since_last_s_evt; ///< Time since last speed event occurred (integer part).
+ uint64_t fraction_since_last_s_evt; ///< Time since last speed event occurred (fractional part).
+ uint32_t time_since_last_c_evt; ///< Time since last cadence event occurred (integer part).
+ uint64_t fraction_since_last_c_evt; ///< Time since last cadence event occurred (fractional part).
+ sensorsim_state_t sensorsim_s_state; ///< State of the simulated speed sensor.
+ sensorsim_cfg_t sensorsim_s_cfg; ///< Configuration of the simulated speed sensor.
+ sensorsim_state_t sensorsim_c_state; ///< State of the simulated cadence sensor.
+ sensorsim_cfg_t sensorsim_c_cfg; ///< Configuration of the simulated cadence sensor.
+ uint16_t prev_time_since_evt; ///< Previous value of time since the last event.
+ uint32_t cumulative_time; ///< Cumulative time in 2 s ticks used for updating the cumulative time.
+ uint32_t cumulative_time_frac; ///< Cumulative time in 2 s ticks (fractional part), used for updating the cumulative time.
+ uint8_t stop_cnt; ///< Counter used for simulating bicycle stopped state.
+} ant_bsc_simulator_cb_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_SIMULATOR_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h
new file mode 100644
index 0000000..7126ebf
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h
@@ -0,0 +1,128 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_BSC_UTILS_H__
+#define ANT_BSC_UTILS_H__
+
+#include "nrf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_bsc_utils Bicycle Speed and Cadence profile utilities
+ * @{
+ * @ingroup ant_bsc
+ * @brief This module implements utilities for the Bicycle Speed and Cadence profile.
+ *
+ */
+
+/**@brief Unit for BSC operating time.
+ *
+ * @details According to the ANT BSC specification, the operating time unit is 2 seconds.
+ */
+#define ANT_BSC_OPERATING_TIME_UNIT 2u
+
+/**@brief This macro should be used to get the seconds part of the operating time.
+ */
+#define ANT_BSC_OPERATING_SECONDS(OPERATING_TIME) (((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) % 60)
+
+/**@brief This macro should be used to get the minutes part of the operating time.
+ */
+#define ANT_BSC_OPERATING_MINUTES(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / 60) % 60)
+
+/**@brief This macro should be used to get the hours part of the operating time.
+ */
+#define ANT_BSC_OPERATING_HOURS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / (60 * 60)) % 24)
+
+/**@brief This macro should be used to get the days part of the operating time.
+ */
+#define ANT_BSC_OPERATING_DAYS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / (60 * 60)) / 24)
+
+/**@brief Number of Bicycle Speed or Cadence event time counts per second.
+ *
+ * @details According to the ANT BSC specification, the speed or cadence event time unit is 1/1024 of a second.
+ */
+#define ANT_BSC_EVENT_TIME_COUNTS_PER_SEC 1024u
+
+/**@brief BSC event time display required precision.
+ *
+ * @details This value is used to decode the number of milliseconds.
+ */
+#define ANT_BSC_EVENT_TIME_PRECISION 1000u
+
+/**@brief This macro should be used to get the seconds part of the BSC event time.
+ */
+#define ANT_BSC_EVENT_TIME_SEC(EVENT_TIME) ((EVENT_TIME) / ANT_BSC_EVENT_TIME_COUNTS_PER_SEC)
+
+/**@brief This macro should be used to get the milliseconds part of the BSC event time.
+ */
+#define ANT_BSC_EVENT_TIME_MSEC(EVENT_TIME) (((((EVENT_TIME) % ANT_BSC_EVENT_TIME_COUNTS_PER_SEC) * ANT_BSC_EVENT_TIME_PRECISION) \
+ + ANT_BSC_EVENT_TIME_COUNTS_PER_SEC / 2) \
+ / ANT_BSC_EVENT_TIME_COUNTS_PER_SEC)
+
+/**@brief Battery voltage display required precision.
+ *
+ * @details This value is used to decode the number of mV.
+ */
+#define ANT_BSC_BAT_VOLTAGE_PRECISION 1000u
+
+/**@brief Bike Speed and Cadence profile, unit divisor of the fractional part of the battery voltage.
+ *
+ * @details According to the ANT BSC specification, the battery voltage fraction unit is (1/256) V.
+ */
+#define ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT 256u
+
+/**@brief This macro should be used to get the mV part of the BSC battery voltage.
+ */
+#define ANT_BSC_BAT_VOLTAGE_FRACTION_MV(VOLT_FRACT) ((((VOLT_FRACT) * ANT_BSC_BAT_VOLTAGE_PRECISION) \
+ + ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT / 2) \
+ / ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT)
+
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_BSC_UTILS_H__
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c
new file mode 100644
index 0000000..c5cd45f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c
@@ -0,0 +1,224 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_REQUEST_CONTROLLER)
+#include "ant_request_controller.h"
+#include "ant_interface.h"
+#include "ant_parameters.h"
+#include "app_error.h"
+#include "nrf_assert.h"
+#include "nrf.h"
+
+/**@brief Common message data layout structure. */
+typedef struct
+{
+ uint8_t page_number; ///< Page number.
+ uint8_t page_payload[7]; ///< Page payload.
+}ant_common_message_layout_t;
+
+
+void ant_request_controller_init(ant_request_controller_t * p_controller)
+{
+ ASSERT(p_controller != NULL);
+
+ p_controller->state = ANT_REQUEST_CONTROLLER_IDLE;
+ p_controller->page_70 = DEFAULT_ANT_COMMON_PAGE70();
+}
+
+
+uint32_t ant_request_controller_request(ant_request_controller_t * p_controller,
+ uint8_t channel_number,
+ ant_common_page70_data_t * p_page_70)
+{
+ ASSERT(p_controller != NULL);
+ ASSERT(p_page_70 != NULL);
+
+ ant_common_message_layout_t message;
+ message.page_number = ANT_COMMON_PAGE_70;
+
+ ant_common_page_70_encode(message.page_payload, p_page_70);
+
+ p_controller->state = ANT_REQUEST_CONTROLLER_SENDED;
+
+ return sd_ant_acknowledge_message_tx(channel_number, sizeof (message), (uint8_t *)&message);
+}
+
+
+bool ant_request_controller_pending_get(ant_request_controller_t * p_controller,
+ uint8_t * p_page_number)
+{
+ ASSERT(p_controller != NULL);
+ ASSERT(p_page_number != NULL);
+
+ if ((p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED)
+ || (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED)
+ || (p_controller->state == ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED))
+ {
+ *p_page_number = p_controller->page_70.page_number;
+ return true;
+ }
+ return false;
+}
+
+
+bool ant_request_controller_ack_needed(ant_request_controller_t * p_controller)
+{
+ ASSERT(p_controller != NULL);
+ return ((p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED)
+ || (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED));
+}
+
+
+ant_request_controller_evt_t ant_request_controller_disp_evt_handler(
+ ant_request_controller_t * p_controller,
+ ant_evt_t * p_ant_evt)
+{
+ ASSERT(p_controller != NULL);
+ ASSERT(p_ant_evt != NULL);
+
+ if ( p_controller->state == ANT_REQUEST_CONTROLLER_SENDED)
+ {
+ switch (p_ant_evt->event)
+ {
+ case EVENT_TRANSFER_TX_FAILED:
+ p_controller->state = ANT_REQUEST_CONTROLLER_IDLE;
+ return ANT_REQUEST_CONTROLLER_FAILED;
+
+ case EVENT_TRANSFER_TX_COMPLETED:
+ p_controller->state = ANT_REQUEST_CONTROLLER_IDLE;
+ return ANT_REQUEST_CONTROLLER_SUCCESS;
+
+ default:
+ break;
+ }
+ }
+
+ return ANT_REQUEST_CONTROLLER_NONE;
+}
+
+
+/**@brief Function for confirmation of page sending.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ */
+__STATIC_INLINE void page_sended(ant_request_controller_t * p_controller)
+{
+ if (!((p_controller->page_70.transmission_response.items.transmit_count)--))
+ {
+ p_controller->state = ANT_REQUEST_CONTROLLER_IDLE;
+ }
+}
+
+
+/**@brief Function for handling page request.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ * @param[in] p_message_payload Pointer to the message payload.
+ */
+__STATIC_INLINE void page_requested(ant_request_controller_t * p_controller,
+ ant_common_message_layout_t * p_message_payload)
+{
+ ant_common_page_70_decode(p_message_payload->page_payload, &(p_controller->page_70));
+
+ if ((p_controller->page_70.command_type == ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST)
+ && (p_controller->page_70.transmission_response.specyfic != ANT_PAGE70_RESPONSE_INVALID))
+ {
+ if (p_controller->page_70.transmission_response.items.ack_resposne)
+ {
+ if (p_controller->page_70.transmission_response.specyfic ==
+ ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS)
+ {
+ p_controller->state = ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED;
+ }
+ else
+ {
+ p_controller->state = ANT_REQUEST_CONTROLLER_ACK_REQUESTED;
+ }
+ }
+ else
+ {
+ p_controller->state = ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED;
+ }
+ }
+}
+
+
+void ant_request_controller_sens_evt_handler(ant_request_controller_t * p_controller,
+ ant_evt_t * p_ant_evt)
+{
+ ASSERT(p_controller != NULL);
+ ASSERT(p_ant_evt != NULL);
+
+ ant_common_message_layout_t * p_message_payload =
+ (ant_common_message_layout_t *)p_ant_evt->message.ANT_MESSAGE_aucPayload;
+
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX:
+
+ if (p_message_payload->page_number == ANT_COMMON_PAGE_70)
+ {
+ page_requested(p_controller, p_message_payload);
+ }
+ break;
+
+ case EVENT_TRANSFER_TX_COMPLETED:
+
+ if (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED)
+ {
+ p_controller->state = ANT_REQUEST_CONTROLLER_IDLE;
+ }
+ /* fall through */
+
+ case EVENT_TX:
+
+ if (p_controller->state == ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED
+ || p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED)
+ {
+ page_sended(p_controller);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_REQUEST_CONTROLLER)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h
new file mode 100644
index 0000000..4c99b9c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h
@@ -0,0 +1,157 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/** @file
+ *
+ * @defgroup ant_request_controller ANT request controller
+ * @{
+ * @ingroup ant_sdk_utils
+ *
+ * @brief Module for handling page requests related to page 70.
+ */
+
+#ifndef ANT_REQUEST_CONTROLLER_H__
+#define ANT_REQUEST_CONTROLLER_H__
+#include <stdbool.h>
+#include "ant_common_page_70.h"
+#include "nrf_sdh_ant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Request controller events types. */
+typedef enum
+{
+ ANT_REQUEST_CONTROLLER_NONE, ///< No event.
+ ANT_REQUEST_CONTROLLER_SUCCESS, ///< Page request successful.
+ ANT_REQUEST_CONTROLLER_FAILED, ///< Page request failed.
+} ant_request_controller_evt_t;
+
+/**@brief Request controller states. */
+typedef enum
+{
+ ANT_REQUEST_CONTROLLER_IDLE, ///< Module is in idle state.
+ ANT_REQUEST_CONTROLLER_SENDED, ///< Module waits for acknowledgment of its request.
+ ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED, ///< Module is requested to send page n times using broadcast.
+ ANT_REQUEST_CONTROLLER_ACK_REQUESTED, ///< Module is requested to send page n times using acknowledgment.
+ ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED, ///< Module is requested to send page until success using acknowledgment.
+} ant_request_controller_state_t;
+
+/**@brief ANT request controller structure. */
+typedef struct
+{
+ ant_request_controller_state_t state; ///< Actual module state.
+ ant_common_page70_data_t page_70; ///< Page 70.
+} ant_request_controller_t;
+
+/**@brief Function for initializing the ANT request controller instance.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ */
+void ant_request_controller_init(ant_request_controller_t * p_controller);
+
+/**@brief Function for sending a request.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ * @param[in] channel_number Channel number.
+ * @param[in] p_page_70 Pointer to the prepared page 70.
+ *
+ * @return Error code returned by @ref sd_ant_acknowledge_message_tx().
+ */
+uint32_t ant_request_controller_request(ant_request_controller_t * p_controller,
+ uint8_t channel_number,
+ ant_common_page70_data_t * p_page_70);
+
+/**@brief Function for getting pending page number.
+ *
+ * @details This function checks whether a page number was requested.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ * @param[out] p_page_number Pending page number (valid if true was returned).
+ *
+ * @retval TRUE If there was a pending page.
+ * @retval FALSE If no page was pending.
+ */
+bool ant_request_controller_pending_get(ant_request_controller_t * p_controller,
+ uint8_t * p_page_number);
+
+/**@brief Function for checking whether the next page must be sent with acknowledgment.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ *
+ * @retval TRUE If the next transmission needs acknowledgment.
+ * @retval FALSE If the next transmission does not need acknowledgment.
+ */
+bool ant_request_controller_ack_needed(ant_request_controller_t * p_controller);
+
+/**
+ * @brief Function for handling ANT events on display side.
+ *
+ * @details All events from the ANT stack that are related to the appropriate channel number
+ * should be propagated.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ */
+ant_request_controller_evt_t ant_request_controller_disp_evt_handler(
+ ant_request_controller_t * p_controller,
+ ant_evt_t * p_ant_evt);
+
+/**
+ * @brief Function for handling ANT events on sensor side.
+ *
+ * @details All events from the ANT stack that are related to the appropriate channel number
+ * should be propagated.
+ *
+ * @param[in] p_controller Pointer to the controller instance.
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @retval TRUE If there was a pending page.
+ */
+void ant_request_controller_sens_evt_handler(ant_request_controller_t * p_controller,
+ ant_evt_t * p_ant_evt);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_REQUEST_CONTROLLER_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c
new file mode 100644
index 0000000..0026fe5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c
@@ -0,0 +1,141 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_COMMON_PAGE_70)
+
+#include <string.h>
+#include "ant_common_page_70.h"
+
+#define NRF_LOG_MODULE_NAME ant_common_page_70
+#if ANT_COMMON_PAGE_70_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_COMMON_PAGE_70_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_COMMON_PAGE_70_INFO_COLOR
+#else // ANT_COMMON_PAGE_70_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_COMMON_PAGE_70_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief ANT+ common page 70 data layout structure. */
+typedef struct
+{
+ uint8_t reserved[2];
+ uint8_t descriptor[2];
+ uint8_t req_trans_response;
+ uint8_t req_page_number;
+ uint8_t command_type;
+}ant_common_page70_data_layout_t;
+
+/**@brief Function for tracing page 70 data.
+ *
+ * @param[in] p_page_data Pointer to the page 70 data.
+ */
+static void page70_data_log(volatile ant_common_page70_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Page %d request", p_page_data->page_number);
+
+ switch (p_page_data->transmission_response.specyfic)
+ {
+ case ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS:
+ NRF_LOG_INFO("Try to send until ACK");
+ break;
+
+ case ANT_PAGE70_RESPONSE_INVALID:
+ NRF_LOG_INFO("Invalid requested transmission response");
+ break;
+
+ default:
+
+ if (p_page_data->transmission_response.items.ack_resposne)
+ {
+ NRF_LOG_INFO("Answer with acknowledged messages");
+ }
+ NRF_LOG_INFO("Requested number of transmissions: %d",
+ p_page_data->transmission_response.items.transmit_count);
+ }
+
+ switch (p_page_data->command_type)
+ {
+ case ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST:
+ NRF_LOG_INFO("Request Data Page");
+ break;
+
+ case ANT_PAGE70_COMMAND_ANT_FS_SESSION_REQUEST:
+ NRF_LOG_INFO("Request ANT-FS Session");
+ break;
+
+ default:
+ NRF_LOG_INFO("Invalid request");
+ }
+ NRF_LOG_INFO("Descriptor %x\r\n\n", p_page_data->descriptor);
+}
+
+
+void ant_common_page_70_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page70_data_t const * p_page_data)
+{
+ ant_common_page70_data_layout_t * p_outcoming_data =
+ (ant_common_page70_data_layout_t *)p_page_buffer;
+
+ memset(p_outcoming_data->reserved, UINT8_MAX, sizeof (p_outcoming_data->reserved));
+ UNUSED_PARAMETER(uint16_encode(p_page_data->descriptor, p_outcoming_data->descriptor));
+ p_outcoming_data->req_trans_response = p_page_data->transmission_response.byte;
+ p_outcoming_data->req_page_number = p_page_data->page_number;
+ p_outcoming_data->command_type = p_page_data->command_type;
+
+ page70_data_log(p_page_data);
+}
+
+
+void ant_common_page_70_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page70_data_t * p_page_data)
+{
+ ant_common_page70_data_layout_t const * p_incoming_data =
+ (ant_common_page70_data_layout_t *)p_page_buffer;
+
+ p_page_data->descriptor = uint16_decode(p_incoming_data->descriptor);
+ p_page_data->transmission_response.byte = p_incoming_data->req_trans_response;
+ p_page_data->page_number = p_incoming_data->req_page_number;
+ p_page_data->command_type = (ant_page70_command_t)p_incoming_data->command_type;
+
+ page70_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_COMMON_PAGE_70)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h
new file mode 100644
index 0000000..20e5351
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_COMMON_PAGE_70_H__
+#define ANT_COMMON_PAGE_70_H__
+
+/** @file
+ *
+ * @defgroup ant_common_page_70 ANT+ common page 70
+ * @{
+ * @ingroup ant_sdk_common_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANT_COMMON_PAGE_70 (70) ///< @brief ID value of common page 70.
+#define ANT_PAGE70_INVALID_DESCRIPTOR UINT16_MAX ///< Invalid descriptor.
+
+/**@brief Command type.
+ */
+typedef enum
+{
+ ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST = 0x01, ///< Page request.
+ ANT_PAGE70_COMMAND_ANT_FS_SESSION_REQUEST = 0x02, ///< ANT FS session request.
+} ant_page70_command_t;
+
+
+/**@brief Data structure for ANT+ common data page 70.
+ */
+typedef struct
+{
+ uint8_t page_number; ///< Requested page number.
+ uint16_t descriptor; ///< Descriptor.
+ ant_page70_command_t command_type; ///< Command type.
+ union
+ {
+ enum
+ {
+ ANT_PAGE70_RESPONSE_INVALID = 0x00, ///< Invalid response type.
+ ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS = 0x80, ///< Transmit until a successful acknowledge is received.
+ } specyfic;
+ struct
+ {
+ uint8_t transmit_count :7; ///< Number of re-transmissions.
+ uint8_t ack_resposne :1; ///< Acknowledge transmission is required.
+ } items;
+ uint8_t byte;
+ } transmission_response;
+} ant_common_page70_data_t;
+
+/**@brief Initialize page 70 with default values.
+ */
+#define DEFAULT_ANT_COMMON_PAGE70() \
+ (ant_common_page70_data_t) \
+ { \
+ .page_number = 0x00, \
+ .command_type = (ant_page70_command_t)0x00, \
+ .transmission_response.specyfic = ANT_PAGE70_RESPONSE_INVALID, \
+ .descriptor = ANT_PAGE70_INVALID_DESCRIPTOR, \
+ }
+
+/**@brief Initialize page 70 with the page request.
+ */
+#define ANT_COMMON_PAGE_DATA_REQUEST(PAGE_NUMBER) \
+ (ant_common_page70_data_t) \
+ { \
+ .page_number = (PAGE_NUMBER), \
+ .command_type = ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST, \
+ .transmission_response.specyfic = ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS, \
+ .descriptor = ANT_PAGE70_INVALID_DESCRIPTOR, \
+ }
+
+/**@brief Function for encoding page 70.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_common_page_70_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page70_data_t const * p_page_data);
+
+/**@brief Function for decoding page 70.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_common_page_70_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page70_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_COMMON_PAGE_70_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c
new file mode 100644
index 0000000..b60e859
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c
@@ -0,0 +1,110 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_COMMON_PAGE_80)
+
+#include <string.h>
+#include "ant_common_page_80.h"
+
+#define NRF_LOG_MODULE_NAME ant_common_page_80
+#if ANT_COMMON_PAGE_80_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_COMMON_PAGE_80_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_COMMON_PAGE_80_INFO_COLOR
+#else // ANT_COMMON_PAGE_80_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_COMMON_PAGE_80_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief ant+ common page 80 data layout structure. */
+typedef struct
+{
+ uint8_t reserved[2]; ///< unused, fill by 0xFF
+ uint8_t hw_revision;
+ uint8_t manufacturer_id[2];
+ uint8_t model_number[2];
+}ant_common_page80_data_layout_t;
+
+
+/**@brief Function for tracing page 80 data.
+ *
+ * @param[in] p_page_data Pointer to the page 80 data.
+ */
+static void page80_data_log(volatile ant_common_page80_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("hw revision: %u", p_page_data->hw_revision);
+ NRF_LOG_INFO("manufacturer id: %u", p_page_data->manufacturer_id);
+ NRF_LOG_INFO("model number: %u\r\n\n", p_page_data->model_number);
+}
+
+
+void ant_common_page_80_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page80_data_t const * p_page_data)
+{
+ ant_common_page80_data_layout_t * p_outcoming_data =
+ (ant_common_page80_data_layout_t *)p_page_buffer;
+
+ memset(p_page_buffer, UINT8_MAX, sizeof (p_outcoming_data->reserved));
+
+ p_outcoming_data->hw_revision = p_page_data->hw_revision;
+
+ UNUSED_PARAMETER(uint16_encode(p_page_data->manufacturer_id,
+ p_outcoming_data->manufacturer_id));
+ UNUSED_PARAMETER(uint16_encode(p_page_data->model_number, p_outcoming_data->model_number));
+
+ page80_data_log(p_page_data);
+}
+
+
+void ant_common_page_80_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page80_data_t * p_page_data)
+{
+ ant_common_page80_data_layout_t const * p_incoming_data =
+ (ant_common_page80_data_layout_t *)p_page_buffer;
+
+ p_page_data->hw_revision = p_incoming_data->hw_revision;
+
+ p_page_data->manufacturer_id = uint16_decode(p_incoming_data->manufacturer_id);
+ p_page_data->model_number = uint16_decode(p_incoming_data->model_number);
+
+ page80_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_COMMON_PAGE_80)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h
new file mode 100644
index 0000000..15a971c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_COMMON_PAGE_80_H__
+#define ANT_COMMON_PAGE_80_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_common_pages ANT+ common pages
+ * @{
+ * @ingroup ant_sdk_profiles
+ * @brief This module implements functions for the ANT+ common pages.
+ * @details ANT+ common data pages define common data formats that can be used by any device on any ANT network. The ability to send and receive these common pages is defined by the transmission type of the ANT channel parameter.
+ *
+ * Note that all unused pages in this section are not defined and therefore cannot be used.
+ * @}
+ *
+ * @defgroup ant_common_page_80 ANT+ common page 80
+ * @{
+ * @ingroup ant_sdk_common_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANT_COMMON_PAGE_80 (80) ///< @brief ID value of common page 80.
+
+/**@brief Data structure for ANT+ common data page 80.
+ *
+ * @note This structure implements only page 80 specific data.
+ */
+typedef struct
+{
+ uint8_t hw_revision; ///< Hardware revision.
+ uint16_t manufacturer_id; ///< Manufacturer ID.
+ uint16_t model_number; ///< Model number.
+} ant_common_page80_data_t;
+
+/**@brief Initialize page 80.
+ */
+#define DEFAULT_ANT_COMMON_page80() \
+ (ant_common_page80_data_t) \
+ { \
+ .hw_revision = 0x00, \
+ .manufacturer_id = UINT8_MAX, \
+ .model_number = 0x00, \
+ }
+
+/**@brief Initialize page 80.
+ */
+#define ANT_COMMON_page80(hw_rev, man_id, mod_num) \
+ (ant_common_page80_data_t) \
+ { \
+ .hw_revision = (hw_rev), \
+ .manufacturer_id = (man_id), \
+ .model_number = (mod_num), \
+ }
+
+/**@brief Function for encoding page 80.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_common_page_80_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page80_data_t const * p_page_data);
+
+/**@brief Function for decoding page 80.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_common_page_80_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page80_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_COMMON_PAGE_80_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c
new file mode 100644
index 0000000..3e5582e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c
@@ -0,0 +1,117 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_COMMON_PAGE_81)
+
+#include "ant_common_page_81.h"
+
+#define NRF_LOG_MODULE_NAME ant_common_page_81
+#if ANT_COMMON_PAGE_81_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_COMMON_PAGE_81_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_COMMON_PAGE_81_INFO_COLOR
+#else // ANT_COMMON_PAGE_81_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_COMMON_PAGE_81_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief ant+ common page 81 data layout structure. */
+typedef struct
+{
+ uint8_t reserved; ///< unused, fill by 0xFF
+ uint8_t sw_revision_minor;
+ uint8_t sw_revision_major;
+ uint8_t serial_number[4];
+}ant_common_page81_data_layout_t;
+
+
+/**@brief Function for tracing page 80 data.
+ *
+ * @param[in] p_page_data Pointer to the page 80 data.
+ */
+static void page81_data_log(volatile ant_common_page81_data_t const * p_page_data)
+{
+ if (p_page_data->sw_revision_minor != UINT8_MAX)
+ {
+ NRF_LOG_INFO("sw revision: %u.%u",
+ ((ant_common_page81_data_t const *) p_page_data)->sw_revision_major,
+ ((ant_common_page81_data_t const *) p_page_data)->sw_revision_minor);
+ }
+ else
+ {
+ NRF_LOG_INFO("sw revision: %u", p_page_data->sw_revision_major);
+ }
+
+ NRF_LOG_INFO("serial number: %u\r\n\n", (unsigned int) p_page_data->serial_number);
+}
+
+
+void ant_common_page_81_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page81_data_t const * p_page_data)
+{
+ ant_common_page81_data_layout_t * p_outcoming_data =
+ (ant_common_page81_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->reserved = UINT8_MAX;
+
+ p_outcoming_data->sw_revision_minor = p_page_data->sw_revision_minor;
+ p_outcoming_data->sw_revision_major = p_page_data->sw_revision_major;
+
+ UNUSED_PARAMETER(uint32_encode(p_page_data->serial_number, p_outcoming_data->serial_number));
+
+ page81_data_log(p_page_data);
+}
+
+
+void ant_common_page_81_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page81_data_t * p_page_data)
+{
+ ant_common_page81_data_layout_t const * p_incoming_data =
+ (ant_common_page81_data_layout_t *)p_page_buffer;
+
+ p_page_data->sw_revision_minor = p_incoming_data->sw_revision_minor;
+ p_page_data->sw_revision_major = p_incoming_data->sw_revision_major;
+
+ p_page_data->serial_number = uint32_decode(p_incoming_data->serial_number);
+
+ page81_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_COMMON_PAGE_81)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h
new file mode 100644
index 0000000..4299850
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_COMMON_PAGE_81_H__
+#define ANT_COMMON_PAGE_81_H__
+
+/** @file
+ *
+ * @defgroup ant_common_page_81 ANT+ common page 81
+ * @{
+ * @ingroup ant_sdk_common_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANT_COMMON_PAGE_81 (81) ///< @brief ID value of common page 81.
+
+/**@brief Data structure for ANT+ common data page 81.
+ *
+ * @note This structure implements only page 81 specific data.
+ */
+typedef struct
+{
+ uint8_t sw_revision_minor; ///< Supplemental, fill by 0xFF if unused.
+ uint8_t sw_revision_major; ///< Main software version.
+ uint32_t serial_number; ///< Lowest 32 b of serial number, fill by 0xFFFFFFFFF if unused.
+} ant_common_page81_data_t;
+
+/**@brief Initialize page 81.
+ */
+#define DEFAULT_ANT_COMMON_page81() \
+ (ant_common_page81_data_t) \
+ { \
+ .sw_revision_minor = UINT8_MAX, \
+ .sw_revision_major = UINT8_MAX, \
+ .serial_number = UINT32_MAX, \
+ }
+
+/**@brief Initialize page 81.
+ */
+#define ANT_COMMON_page81(sw_major_rev, sw_minor_rev, seril_no) \
+ (ant_common_page81_data_t) \
+ { \
+ .sw_revision_minor = (sw_minor_rev), \
+ .sw_revision_major = (sw_major_rev), \
+ .serial_number = (seril_no), \
+ }
+
+/**@brief Function for encoding page 81.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_common_page_81_encode(uint8_t * p_page_buffer,
+ volatile ant_common_page81_data_t const * p_page_data);
+
+/**@brief Function for decoding page 81.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_common_page_81_decode(uint8_t const * p_page_buffer,
+ volatile ant_common_page81_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_COMMON_PAGE_81_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.c
new file mode 100644
index 0000000..6c868d8
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.c
@@ -0,0 +1,346 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_config.h"
+#if ANT_HRM_ENABLED
+
+#include "nrf_assert.h"
+#include "app_error.h"
+#include "ant_interface.h"
+#include "app_util.h"
+#include "ant_hrm.h"
+#include "ant_hrm_utils.h"
+#include "app_error.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm
+#if ANT_HRM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_INFO_COLOR
+#else // ANT_HRM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+#define BACKGROUND_DATA_INTERVAL 64 /**< The number of main data pages sent between background data page.
+ Background data page is sent every 65th message. */
+#define TX_TOGGLE_DIVISOR 4 /**< The number of messages between changing state of toggle bit. */
+
+/**@brief HRM message data layout structure. */
+typedef struct
+{
+ ant_hrm_page_t page_number : 7;
+ uint8_t toggle_bit : 1;
+ uint8_t page_payload[7];
+} ant_hrm_message_layout_t;
+
+/**@brief Function for initializing the ANT HRM profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+static ret_code_t ant_hrm_init(ant_hrm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config)
+{
+ p_profile->channel_number = p_channel_config->channel_number;
+
+ p_profile->page_0 = DEFAULT_ANT_HRM_PAGE0();
+ p_profile->page_1 = DEFAULT_ANT_HRM_PAGE1();
+ p_profile->page_2 = DEFAULT_ANT_HRM_PAGE2();
+ p_profile->page_3 = DEFAULT_ANT_HRM_PAGE3();
+ p_profile->page_4 = DEFAULT_ANT_HRM_PAGE4();
+
+ NRF_LOG_INFO("ANT HRM channel %u init", p_profile->channel_number);
+ return ant_channel_init(p_channel_config);
+}
+
+
+ret_code_t ant_hrm_disp_init(ant_hrm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_hrm_evt_handler_t evt_handler)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(evt_handler != NULL);
+
+ p_profile->evt_handler = evt_handler;
+
+ return ant_hrm_init(p_profile, p_channel_config);
+}
+
+
+ret_code_t ant_hrm_sens_init(ant_hrm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_hrm_sens_config_t const * p_sens_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_sens_config != NULL);
+ ASSERT(p_sens_config->p_cb != NULL);
+ ASSERT(p_sens_config->evt_handler != NULL);
+
+ ASSERT((p_sens_config->main_page_number == ANT_HRM_PAGE_0)
+ || (p_sens_config->main_page_number == ANT_HRM_PAGE_4));
+
+ p_profile->evt_handler = p_sens_config->evt_handler;
+ p_profile->_cb.p_sens_cb = p_sens_config->p_cb;
+
+ ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb;
+ p_hrm_cb->page_1_present = p_sens_config->page_1_present;
+ p_hrm_cb->main_page_number = p_sens_config->main_page_number;
+ p_hrm_cb->ext_page_number = p_hrm_cb->page_1_present ? ANT_HRM_PAGE_1 : ANT_HRM_PAGE_2;
+ p_hrm_cb->message_counter = 0;
+ p_hrm_cb->toggle_bit = true;
+
+ return ant_hrm_init(p_profile, p_channel_config);
+}
+
+
+/**@brief Function for getting next page number to send.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @return Next page number.
+ */
+static ant_hrm_page_t next_page_number_get(ant_hrm_profile_t * p_profile)
+{
+ ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb;
+ ant_hrm_page_t page_number;
+
+ if (p_hrm_cb->message_counter == (BACKGROUND_DATA_INTERVAL))
+ {
+ page_number = p_hrm_cb->ext_page_number;
+
+ p_hrm_cb->message_counter = 0;
+
+ p_hrm_cb->ext_page_number++;
+
+ if (p_hrm_cb->ext_page_number > ANT_HRM_PAGE_3)
+ {
+ p_hrm_cb->ext_page_number = p_hrm_cb->page_1_present ? ANT_HRM_PAGE_1 : ANT_HRM_PAGE_2;
+ }
+ }
+ else
+ {
+ page_number = p_hrm_cb->main_page_number;
+ }
+
+ if (p_hrm_cb->message_counter % TX_TOGGLE_DIVISOR == 0)
+ {
+ p_hrm_cb->toggle_bit ^= 1;
+ }
+
+ p_hrm_cb->message_counter++;
+
+ return page_number;
+}
+
+
+/**@brief Function for encoding HRM message.
+ *
+ * @note Assume to be call each time when Tx window will occur.
+ */
+static void sens_message_encode(ant_hrm_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ ant_hrm_message_layout_t * p_hrm_message_payload =
+ (ant_hrm_message_layout_t *)p_message_payload;
+ ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb;
+
+ p_hrm_message_payload->page_number = next_page_number_get(p_profile);
+ p_hrm_message_payload->toggle_bit = p_hrm_cb->toggle_bit;
+
+ NRF_LOG_INFO("HRM TX Page number: %u", p_hrm_message_payload->page_number);
+
+ ant_hrm_page_0_encode(p_hrm_message_payload->page_payload, &(p_profile->page_0)); // Page 0 is present in each message
+
+ switch (p_hrm_message_payload->page_number)
+ {
+ case ANT_HRM_PAGE_0:
+ // No implementation needed
+ break;
+
+ case ANT_HRM_PAGE_1:
+ ant_hrm_page_1_encode(p_hrm_message_payload->page_payload, &(p_profile->page_1));
+ break;
+
+ case ANT_HRM_PAGE_2:
+ ant_hrm_page_2_encode(p_hrm_message_payload->page_payload, &(p_profile->page_2));
+ break;
+
+ case ANT_HRM_PAGE_3:
+ ant_hrm_page_3_encode(p_hrm_message_payload->page_payload, &(p_profile->page_3));
+ break;
+
+ case ANT_HRM_PAGE_4:
+ ant_hrm_page_4_encode(p_hrm_message_payload->page_payload, &(p_profile->page_4));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_hrm_evt_t)p_hrm_message_payload->page_number);
+}
+
+
+/**@brief Function for setting payload for ANT message and sending it.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ */
+static void ant_message_send(ant_hrm_profile_t * p_profile)
+{
+ uint32_t err_code;
+ uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE];
+
+ sens_message_encode(p_profile, p_message_payload);
+ err_code =
+ sd_ant_broadcast_message_tx(p_profile->channel_number,
+ sizeof (p_message_payload),
+ p_message_payload);
+ APP_ERROR_CHECK(err_code);
+}
+
+
+void ant_hrm_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ant_hrm_profile_t * p_profile = (ant_hrm_profile_t *)p_context;
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ switch (p_ant_evt->event)
+ {
+ case EVENT_TX:
+ ant_message_send(p_profile);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+ret_code_t ant_hrm_disp_open(ant_hrm_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ NRF_LOG_INFO("ANT HRM channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+
+ret_code_t ant_hrm_sens_open(ant_hrm_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ // Fill tx buffer for the first frame
+ ant_message_send(p_profile);
+
+ NRF_LOG_INFO("ANT HRM channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+
+/**@brief Function for decoding HRM message.
+ *
+ * @note Assume to be call each time when Rx window will occur.
+ */
+static void disp_message_decode(ant_hrm_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ const ant_hrm_message_layout_t * p_hrm_message_payload =
+ (ant_hrm_message_layout_t *)p_message_payload;
+
+ NRF_LOG_INFO("HRM RX Page Number: %u", p_hrm_message_payload->page_number);
+
+ ant_hrm_page_0_decode(p_hrm_message_payload->page_payload, &(p_profile->page_0)); // Page 0 is present in each message
+
+ switch (p_hrm_message_payload->page_number)
+ {
+ case ANT_HRM_PAGE_0:
+ // No implementation needed
+ break;
+
+ case ANT_HRM_PAGE_1:
+ ant_hrm_page_1_decode(p_hrm_message_payload->page_payload, &(p_profile->page_1));
+ break;
+
+ case ANT_HRM_PAGE_2:
+ ant_hrm_page_2_decode(p_hrm_message_payload->page_payload, &(p_profile->page_2));
+ break;
+
+ case ANT_HRM_PAGE_3:
+ ant_hrm_page_3_decode(p_hrm_message_payload->page_payload, &(p_profile->page_3));
+ break;
+
+ case ANT_HRM_PAGE_4:
+ ant_hrm_page_4_decode(p_hrm_message_payload->page_payload, &(p_profile->page_4));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_hrm_evt_t)p_hrm_message_payload->page_number);
+}
+
+
+void ant_hrm_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ant_hrm_profile_t * p_profile = ( ant_hrm_profile_t *)p_context;
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX:
+ if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
+ {
+ disp_message_decode(p_profile, p_ant_evt->message.ANT_MESSAGE_aucPayload);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+#endif // ANT_HRM_ENABLED
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.h
new file mode 100644
index 0000000..fd6372c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm.h
@@ -0,0 +1,292 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/** @file
+ *
+ * @defgroup ant_hrm Heart Rate Monitor profile
+ * @{
+ * @ingroup ant_sdk_profiles
+ * @brief This module implements the Heart Rate Monitor profile.
+ *
+ */
+
+#ifndef ANT_HRM_H__
+#define ANT_HRM_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "app_util.h"
+#include "ant_parameters.h"
+#include "nrf_sdh_ant.h"
+#include "ant_channel_config.h"
+#include "ant_hrm_pages.h"
+#include "sdk_errors.h"
+
+#define HRM_DEVICE_TYPE 0x78u ///< Device type reserved for ANT+ heart rate monitor.
+#define HRM_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz).
+
+#define HRM_MSG_PERIOD_4Hz 0x1F86u ///< Message period, decimal 8070 (4.06 Hz).
+#define HRM_MSG_PERIOD_2Hz 0x3F0Cu ///< Message period, decimal 16140 (2.03 Hz).
+#define HRM_MSG_PERIOD_1Hz 0x7E18u ///< Message period, decimal 32280 (1.02 Hz).
+
+#define HRM_EXT_ASSIGN 0x00 ///< ANT ext assign.
+#define HRM_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE ///< Display HRM channel type.
+#define HRM_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor HRM channel type.
+
+/**@brief Initialize an ANT channel configuration structure for the HRM profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ * @param[in] HRM_MSG_PERIOD Channel period in 32 kHz counts. The HRM profile supports only the following periods:
+ * @ref HRM_MSG_PERIOD_4Hz, @ref HRM_MSG_PERIOD_2Hz, @ref HRM_MSG_PERIOD_1Hz.
+ */
+#define HRM_DISP_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER, \
+ HRM_MSG_PERIOD) \
+static const ant_channel_config_t CONCAT_2(NAME,_channel_hrm_disp_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = HRM_DISP_CHANNEL_TYPE, \
+ .ext_assign = HRM_EXT_ASSIGN, \
+ .rf_freq = HRM_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = HRM_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = (HRM_MSG_PERIOD), \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define HRM_DISP_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME,_channel_hrm_disp_config)
+
+
+/**@brief Initialize an ANT channel configuration structure for the HRM profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ */
+#define HRM_SENS_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER) \
+static const ant_channel_config_t CONCAT_2(NAME,_channel_hrm_sens_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = HRM_SENS_CHANNEL_TYPE, \
+ .ext_assign = HRM_EXT_ASSIGN, \
+ .rf_freq = HRM_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = HRM_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = HRM_MSG_PERIOD_4Hz, \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define HRM_SENS_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME,_channel_hrm_sens_config)
+
+/**@brief Initialize an ANT profile configuration structure for the HRM profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] PAGE_1_PRESENT Determines whether page 1 is included.
+ * @param[in] MAIN_PAGE_NUMBER Determines the main data page (@ref ANT_HRM_PAGE_0 or @ref ANT_HRM_PAGE_4).
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the HRM profile.
+ */
+#define HRM_SENS_PROFILE_CONFIG_DEF(NAME, \
+ PAGE_1_PRESENT, \
+ MAIN_PAGE_NUMBER, \
+ EVT_HANDLER) \
+static ant_hrm_sens_cb_t CONCAT_2(NAME,_hrm_sens_cb); \
+static const ant_hrm_sens_config_t CONCAT_2(NAME,_profile_hrm_sens_config) = \
+ { \
+ .page_1_present = (PAGE_1_PRESENT), \
+ .main_page_number = (MAIN_PAGE_NUMBER), \
+ .p_cb = &CONCAT_2(NAME,_hrm_sens_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define HRM_SENS_PROFILE_CONFIG(NAME) &CONCAT_2(NAME,_profile_hrm_sens_config)
+
+
+/**@brief HRM page number type. */
+typedef enum
+{
+ ANT_HRM_PAGE_0, ///< Main data page number 0.
+ ANT_HRM_PAGE_1, ///< Background data page number 1. This page is optional.
+ ANT_HRM_PAGE_2, ///< Background data page number 2.
+ ANT_HRM_PAGE_3, ///< Background data page number 3.
+ ANT_HRM_PAGE_4 ///< Main data page number 4.
+} ant_hrm_page_t;
+
+/**@brief HRM profile event type. */
+typedef enum
+{
+ ANT_HRM_PAGE_0_UPDATED = ANT_HRM_PAGE_0, ///< Data page 0 has been updated (Display) or sent (Sensor).
+ ANT_HRM_PAGE_1_UPDATED = ANT_HRM_PAGE_1, ///< Data page 0 and page 1 have been updated (Display) or sent (Sensor).
+ ANT_HRM_PAGE_2_UPDATED = ANT_HRM_PAGE_2, ///< Data page 0 and page 2 have been updated (Display) or sent (Sensor).
+ ANT_HRM_PAGE_3_UPDATED = ANT_HRM_PAGE_3, ///< Data page 0 and page 3 have been updated (Display) or sent (Sensor).
+ ANT_HRM_PAGE_4_UPDATED = ANT_HRM_PAGE_4, ///< Data page 0 and page 4 have been updated (Display) or sent (Sensor).
+} ant_hrm_evt_t;
+
+// Forward declaration of the ant_hrm_profile_t type.
+typedef struct ant_hrm_profile_s ant_hrm_profile_t;
+
+/**@brief HRM event handler type. */
+typedef void (* ant_hrm_evt_handler_t) (ant_hrm_profile_t *, ant_hrm_evt_t);
+
+#include "ant_hrm_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief HRM sensor configuration structure. */
+typedef struct
+{
+ bool page_1_present; ///< Determines whether page 1 is included.
+ ant_hrm_page_t main_page_number; ///< Determines the main data page (@ref ANT_HRM_PAGE_0 or @ref ANT_HRM_PAGE_4).
+ ant_hrm_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_hrm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the HRM profile.
+} ant_hrm_sens_config_t;
+
+/**@brief HRM profile structure. */
+struct ant_hrm_profile_s
+{
+ uint8_t channel_number; ///< Channel number assigned to the profile.
+ union {
+ void * p_none;
+ ant_hrm_sens_cb_t * p_sens_cb;
+ } _cb; ///< Pointer to internal control block.
+ ant_hrm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the HRM profile.
+ ant_hrm_page0_data_t page_0; ///< Page 0.
+ ant_hrm_page1_data_t page_1; ///< Page 1.
+ ant_hrm_page2_data_t page_2; ///< Page 2.
+ ant_hrm_page3_data_t page_3; ///< Page 3.
+ ant_hrm_page4_data_t page_4; ///< Page 4.
+};
+
+/** @name Defines for accessing ant_hrm_profile_t member variables
+ @{ */
+#define HRM_PROFILE_beat_count page_0.beat_count
+#define HRM_PROFILE_computed_heart_rate page_0.computed_heart_rate
+#define HRM_PROFILE_beat_time page_0.beat_time
+#define HRM_PROFILE_operating_time page_1.operating_time
+#define HRM_PROFILE_manuf_id page_2.manuf_id
+#define HRM_PROFILE_serial_num page_2.serial_num
+#define HRM_PROFILE_hw_version page_3.hw_version
+#define HRM_PROFILE_sw_version page_3.sw_version
+#define HRM_PROFILE_model_num page_3.model_num
+#define HRM_PROFILE_manuf_spec page_4.manuf_spec
+#define HRM_PROFILE_prev_beat page_4.prev_beat
+/** @} */
+
+/**@brief Function for initializing the ANT HRM Display profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] evt_handler Event handler to be called for handling events in the HRM profile.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_hrm_disp_init(ant_hrm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_hrm_evt_handler_t evt_handler);
+
+/**@brief Function for initializing the ANT HRM Sensor profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_sens_config Pointer to the HRM sensor configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_hrm_sens_init(ant_hrm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_hrm_sens_config_t const * p_sens_config);
+
+/**@brief Function for opening the profile instance channel for ANT HRM Display.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_hrm_disp_open(ant_hrm_profile_t * p_profile);
+
+/**@brief Function for opening the profile instance channel for ANT HRM Sensor.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_hrm_sens_open(ant_hrm_profile_t * p_profile);
+
+/**@brief Function for handling the sensor ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Sensor profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_hrm_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+/**@brief Function for handling the display ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Display profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_hrm_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_H__
+/** @} */
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h
new file mode 100644
index 0000000..fdffdc7
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_LOCAL_H__
+#define ANT_HRM_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_hrm.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ant_hrm
+ * @{
+ */
+
+/** @brief HRM Sensor control block. */
+typedef struct
+{
+ uint8_t toggle_bit;
+ ant_hrm_page_t main_page_number;
+ uint8_t page_1_present;
+ ant_hrm_page_t ext_page_number;
+ uint8_t message_counter;
+} ant_hrm_sens_cb_t;
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c
new file mode 100644
index 0000000..4f383a1
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_HRM)
+
+#include "ant_hrm_page_0.h"
+#include "ant_hrm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm_page_0
+#if ANT_HRM_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_PAGE_0_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_0_INFO_COLOR
+#else // ANT_HRM_PAGE_0_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_PAGE_0_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief HRM page 0 data layout structure. */
+typedef struct
+{
+ uint8_t reserved[3];
+ uint8_t heart_beat_evt_time_LSB;
+ uint8_t heart_beat_evt_time_MSB;
+ uint8_t heart_beat_count;
+ uint8_t computed_heart_rate;
+}ant_hrm_page0_data_layout_t;
+
+/**@brief Function for tracing page 0 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 0 data.
+ */
+static void page0_data_log(ant_hrm_page0_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Heart beat count: %u", (unsigned int)p_page_data->beat_count);
+ NRF_LOG_INFO("Computed heart rate: %u",
+ (unsigned int) p_page_data->computed_heart_rate);
+ NRF_LOG_INFO("Heart beat event time: %u.%03us\r\n\n",
+ (unsigned int) ANT_HRM_BEAT_TIME_SEC(p_page_data->beat_time),
+ (unsigned int) ANT_HRM_BEAT_TIME_MSEC(p_page_data->beat_time));
+}
+
+
+void ant_hrm_page_0_encode(uint8_t * p_page_buffer,
+ ant_hrm_page0_data_t const * p_page_data)
+{
+ ant_hrm_page0_data_layout_t * p_outcoming_data = (ant_hrm_page0_data_layout_t *)p_page_buffer;
+ uint32_t beat_time = p_page_data->beat_time;
+
+ p_outcoming_data->reserved[0] = UINT8_MAX;
+ p_outcoming_data->reserved[1] = UINT8_MAX;
+ p_outcoming_data->reserved[2] = UINT8_MAX;
+ p_outcoming_data->heart_beat_evt_time_LSB = (uint8_t)(beat_time & UINT8_MAX);
+ p_outcoming_data->heart_beat_evt_time_MSB = (uint8_t)((beat_time >> 8) & UINT8_MAX);
+ p_outcoming_data->heart_beat_count = (uint8_t)p_page_data->beat_count;
+ p_outcoming_data->computed_heart_rate = (uint8_t)p_page_data->computed_heart_rate;
+
+ page0_data_log(p_page_data);
+}
+
+
+void ant_hrm_page_0_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page0_data_t * p_page_data)
+{
+ ant_hrm_page0_data_layout_t const * p_incoming_data =
+ (ant_hrm_page0_data_layout_t *)p_page_buffer;
+
+ uint32_t beat_time = (uint32_t)((p_incoming_data->heart_beat_evt_time_MSB << 8)
+ + p_incoming_data->heart_beat_evt_time_LSB);
+
+ p_page_data->beat_count = (uint32_t)p_incoming_data->heart_beat_count;
+ p_page_data->computed_heart_rate = (uint32_t)p_incoming_data->computed_heart_rate;
+ p_page_data->beat_time = beat_time;
+
+ page0_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_HRM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h
new file mode 100644
index 0000000..1b06e9a
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_PAGE_0_H__
+#define ANT_HRM_PAGE_0_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_page0 HRM profile page 0
+ * @{
+ * @ingroup ant_sdk_profiles_hrm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for HRM data page 0.
+ *
+ * This structure is used as a common page.
+ */
+typedef struct
+{
+ uint8_t beat_count; ///< Beat count.
+ uint8_t computed_heart_rate; ///< Computed heart rate.
+ uint16_t beat_time; ///< Beat time.
+} ant_hrm_page0_data_t;
+
+/**@brief Initialize page 0.
+ */
+#define DEFAULT_ANT_HRM_PAGE0() \
+ (ant_hrm_page0_data_t) \
+ { \
+ .beat_count = 0, \
+ .computed_heart_rate = 0, \
+ .beat_time = 0, \
+ }
+
+/**@brief Function for encoding page 0.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_hrm_page_0_encode(uint8_t * p_page_buffer,
+ ant_hrm_page0_data_t const * p_page_data);
+
+/**@brief Function for decoding page 0.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_hrm_page_0_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page0_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_PAGE_0_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c
new file mode 100644
index 0000000..90eee6f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_HRM)
+
+#include "ant_hrm_page_1.h"
+#include "ant_hrm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm_page_1
+#if ANT_HRM_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_PAGE_1_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_1_INFO_COLOR
+#else // ANT_HRM_PAGE_1_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_PAGE_1_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief HRM page 1 data layout structure. */
+typedef struct
+{
+ uint8_t cumulative_operating_time[3];
+ uint8_t reserved[4];
+}ant_hrm_page1_data_layout_t;
+
+/**@brief Function for tracing page 1 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 1 data.
+ */
+static void page1_data_log(ant_hrm_page1_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Cumulative operating time: %ud %uh %um %us\r\n\n",
+ (unsigned int) ANT_HRM_OPERATING_DAYS(p_page_data->operating_time),
+ (unsigned int) ANT_HRM_OPERATING_HOURS(p_page_data->operating_time),
+ (unsigned int) ANT_HRM_OPERATING_MINUTES(p_page_data->operating_time),
+ (unsigned int) ANT_HRM_OPERATING_SECONDS(p_page_data->operating_time));
+}
+
+
+void ant_hrm_page_1_encode(uint8_t * p_page_buffer,
+ ant_hrm_page1_data_t const * p_page_data)
+{
+ ant_hrm_page1_data_layout_t * p_outcoming_data = (ant_hrm_page1_data_layout_t *)p_page_buffer;
+ uint32_t operating_time = p_page_data->operating_time;
+
+ UNUSED_PARAMETER(uint24_encode(operating_time, p_outcoming_data->cumulative_operating_time));
+ page1_data_log(p_page_data);
+}
+
+
+void ant_hrm_page_1_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page1_data_t * p_page_data)
+{
+ ant_hrm_page1_data_layout_t const * p_incoming_data =
+ (ant_hrm_page1_data_layout_t *)p_page_buffer;
+
+ uint32_t operating_time = uint24_decode(p_incoming_data->cumulative_operating_time);
+
+ p_page_data->operating_time = operating_time;
+
+ page1_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_HRM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h
new file mode 100644
index 0000000..5162025
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_PAGE_1_H__
+#define ANT_HRM_PAGE_1_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_page1 HRM profile page 1
+ * @{
+ * @ingroup ant_sdk_profiles_hrm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for HRM data page 1.
+ *
+ * This structure implements only page 1 specific data.
+ */
+typedef struct
+{
+ uint32_t operating_time; ///< Operating time.
+} ant_hrm_page1_data_t;
+
+/**@brief Initialize page 1.
+ */
+#define DEFAULT_ANT_HRM_PAGE1() \
+ (ant_hrm_page1_data_t) \
+ { \
+ .operating_time = 0, \
+ }
+
+/**@brief Function for encoding page 1.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_hrm_page_1_encode(uint8_t * p_page_buffer,
+ ant_hrm_page1_data_t const * p_page_data);
+
+/**@brief Function for decoding page 1.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_hrm_page_1_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page1_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_PAGE_1_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c
new file mode 100644
index 0000000..1873b93
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_HRM)
+
+#include "ant_hrm_page_2.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm_page_2
+#if ANT_HRM_PAGE_2_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_PAGE_2_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_2_INFO_COLOR
+#else // ANT_HRM_PAGE_2_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_PAGE_2_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief HRM page 2 data layout structure. */
+typedef struct
+{
+ uint8_t manuf_id;
+ uint8_t serial_num_LSB;
+ uint8_t serial_num_MSB;
+ uint8_t reserved[4];
+}ant_hrm_page2_data_layout_t;
+
+/**@brief Function for tracing page 2 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 2 data.
+ */
+static void page2_data_log(ant_hrm_page2_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Manufacturer ID: %u", (unsigned int)p_page_data->manuf_id);
+ NRF_LOG_INFO("Serial No (upper 16-bits): 0x%X\r\n\n", (unsigned int)p_page_data->serial_num);
+}
+
+
+void ant_hrm_page_2_encode(uint8_t * p_page_buffer,
+ ant_hrm_page2_data_t const * p_page_data)
+{
+ ant_hrm_page2_data_layout_t * p_outcoming_data = (ant_hrm_page2_data_layout_t *)p_page_buffer;
+ uint32_t serial_num = p_page_data->serial_num;
+
+ p_outcoming_data->manuf_id = (uint8_t)p_page_data->manuf_id;
+ p_outcoming_data->serial_num_LSB = (uint8_t)(serial_num & UINT8_MAX);
+ p_outcoming_data->serial_num_MSB = (uint8_t)((serial_num >> 8) & UINT8_MAX);
+
+ page2_data_log(p_page_data);
+}
+
+
+void ant_hrm_page_2_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page2_data_t * p_page_data)
+{
+ ant_hrm_page2_data_layout_t const * p_incoming_data =
+ (ant_hrm_page2_data_layout_t *)p_page_buffer;
+ uint32_t serial_num =
+ (uint32_t)((p_incoming_data->serial_num_MSB << 8)
+ + p_incoming_data->
+ serial_num_LSB);
+
+ p_page_data->manuf_id = (uint32_t)p_incoming_data->manuf_id;
+ p_page_data->serial_num = serial_num;
+
+ page2_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_HRM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h
new file mode 100644
index 0000000..4460373
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_PAGE_2_H__
+#define ANT_HRM_PAGE_2_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_page2 HRM profile page 2
+ * @{
+ * @ingroup ant_sdk_profiles_hrm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for HRM data page 2.
+ *
+ * This structure implements only page 2 specific data.
+ */
+typedef struct
+{
+ uint8_t manuf_id; ///< Manufacturer ID.
+ uint16_t serial_num; ///< Serial number.
+} ant_hrm_page2_data_t;
+
+/**@brief Initialize page 2.
+ */
+#define DEFAULT_ANT_HRM_PAGE2() \
+ (ant_hrm_page2_data_t) \
+ { \
+ .manuf_id = 0, \
+ .serial_num = 0, \
+ }
+
+/**@brief Function for encoding page 2.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_hrm_page_2_encode(uint8_t * p_page_buffer,
+ ant_hrm_page2_data_t const * p_page_data);
+
+/**@brief Function for decoding page 2.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_hrm_page_2_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page2_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_PAGE_2_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c
new file mode 100644
index 0000000..aa1ec7e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_HRM)
+
+#include "ant_hrm_page_3.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm_page_3
+#if ANT_HRM_PAGE_3_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_PAGE_3_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_3_INFO_COLOR
+#else // ANT_HRM_PAGE_3_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_PAGE_3_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief HRM page 3 data layout structure. */
+typedef struct
+{
+ uint8_t hw_version;
+ uint8_t sw_version;
+ uint8_t model_num;
+ uint8_t reserved[4];
+}ant_hrm_page3_data_layout_t;
+
+/**@brief Function for tracing page 3 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 3 data.
+ */
+static void page3_data_log(ant_hrm_page3_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Hardware Rev ID %u", (unsigned int)p_page_data->hw_version);
+ NRF_LOG_INFO("Model %u", (unsigned int)p_page_data->model_num);
+ NRF_LOG_INFO("Software Ver ID %u\r\n\n", (unsigned int)p_page_data->sw_version);
+}
+
+
+void ant_hrm_page_3_encode(uint8_t * p_page_buffer,
+ ant_hrm_page3_data_t const * p_page_data)
+{
+ ant_hrm_page3_data_layout_t * p_outcoming_data = (ant_hrm_page3_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->hw_version = (uint8_t)p_page_data->hw_version;
+ p_outcoming_data->sw_version = (uint8_t)p_page_data->sw_version;
+ p_outcoming_data->model_num = (uint8_t)p_page_data->model_num;
+
+ page3_data_log(p_page_data);
+}
+
+
+void ant_hrm_page_3_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page3_data_t * p_page_data)
+{
+ ant_hrm_page3_data_layout_t const * p_incoming_data =
+ (ant_hrm_page3_data_layout_t *)p_page_buffer;
+
+ p_page_data->hw_version = (uint32_t)p_incoming_data->hw_version;
+ p_page_data->sw_version = (uint32_t)p_incoming_data->sw_version;
+ p_page_data->model_num = (uint32_t)p_incoming_data->model_num;
+
+ page3_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_HRM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h
new file mode 100644
index 0000000..1fed280
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_PAGE_3_H__
+#define ANT_HRM_PAGE_3_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_page3 HRM profile page 3
+ * @{
+ * @ingroup ant_sdk_profiles_hrm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for HRM data page 3.
+ *
+ * This structure implements only page 3 specific data.
+ */
+typedef struct
+{
+ uint8_t hw_version; ///< Hardware version.
+ uint8_t sw_version; ///< Software version.
+ uint8_t model_num; ///< Model number.
+} ant_hrm_page3_data_t;
+
+/**@brief Initialize page 3.
+ */
+#define DEFAULT_ANT_HRM_PAGE3() \
+ (ant_hrm_page3_data_t) \
+ { \
+ .hw_version = 0, \
+ .sw_version = 0, \
+ .model_num = 0, \
+ }
+
+/**@brief Function for encoding page 3.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_hrm_page_3_encode(uint8_t * p_page_buffer,
+ ant_hrm_page3_data_t const * p_page_data);
+
+/**@brief Function for decoding page 3.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_hrm_page_3_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page3_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_PAGE_3_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c
new file mode 100644
index 0000000..62bd683
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_HRM)
+
+#include "ant_hrm_page_4.h"
+#include "ant_hrm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_hrm_page_4
+#if ANT_HRM_PAGE_4_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_HRM_PAGE_4_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_4_INFO_COLOR
+#else // ANT_HRM_PAGE_4_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_HRM_PAGE_4_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+/**@brief HRM page 4 data layout structure. */
+typedef struct
+{
+ uint8_t manuf_spec;
+ uint8_t prev_beat_LSB;
+ uint8_t prev_beat_MSB;
+ uint8_t reserved[4];
+}ant_hrm_page4_data_layout_t;
+
+/**@brief Function for tracing page 4 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 4 data.
+ */
+static void page4_data_log(ant_hrm_page4_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Previous heart beat event time: %u.%03us\r\n\n",
+ (unsigned int)ANT_HRM_BEAT_TIME_SEC(p_page_data->prev_beat),
+ (unsigned int)ANT_HRM_BEAT_TIME_MSEC(p_page_data->prev_beat));
+}
+
+
+void ant_hrm_page_4_encode(uint8_t * p_page_buffer,
+ ant_hrm_page4_data_t const * p_page_data)
+{
+ ant_hrm_page4_data_layout_t * p_outcoming_data = (ant_hrm_page4_data_layout_t *)p_page_buffer;
+ uint32_t prev_beat = p_page_data->prev_beat;
+
+ p_outcoming_data->manuf_spec = p_page_data->manuf_spec;
+ p_outcoming_data->prev_beat_LSB = (uint8_t)(prev_beat & UINT8_MAX);
+ p_outcoming_data->prev_beat_MSB = (uint8_t)((prev_beat >> 8) & UINT8_MAX);
+
+ page4_data_log(p_page_data);
+}
+
+
+void ant_hrm_page_4_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page4_data_t * p_page_data)
+{
+ ant_hrm_page4_data_layout_t const * p_incoming_data =
+ (ant_hrm_page4_data_layout_t *)p_page_buffer;
+
+ uint32_t prev_beat = (uint32_t)((p_incoming_data->prev_beat_MSB << 8)
+ + p_incoming_data->prev_beat_LSB);
+
+ p_page_data->manuf_spec = p_incoming_data->manuf_spec;
+ p_page_data->prev_beat = prev_beat;
+
+ page4_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_HRM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h
new file mode 100644
index 0000000..f59cdde
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_PAGE_4_H__
+#define ANT_HRM_PAGE_4_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_page4 HRM profile page 4
+ * @{
+ * @ingroup ant_sdk_profiles_hrm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for HRM data page 4.
+ *
+ * This structure implements only page 4 specific data.
+ */
+typedef struct
+{
+ uint8_t manuf_spec; ///< Manufacturer specific byte.
+ uint16_t prev_beat; ///< Previous beat.
+} ant_hrm_page4_data_t;
+
+/**@brief Initialize page 4.
+ */
+#define DEFAULT_ANT_HRM_PAGE4() \
+ (ant_hrm_page4_data_t) \
+ { \
+ .manuf_spec = 0, \
+ .prev_beat = 0, \
+ }
+
+/**@brief Function for encoding page 4.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_hrm_page_4_encode(uint8_t * p_page_buffer,
+ ant_hrm_page4_data_t const * p_page_data);
+
+/**@brief Function for decoding page 4.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_hrm_page_4_decode(uint8_t const * p_page_buffer,
+ ant_hrm_page4_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_PAGE_3_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h
new file mode 100644
index 0000000..c1e328e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __ANT_HRM_PAGES_H
+#define __ANT_HRM_PAGES_H
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_pages Heart Rate Monitor profile pages
+ * @{
+ * @ingroup ant_hrm
+ * @brief This module implements functions for the HRM data pages.
+ */
+
+#include "ant_hrm_page_0.h"
+#include "ant_hrm_page_1.h"
+#include "ant_hrm_page_2.h"
+#include "ant_hrm_page_3.h"
+#include "ant_hrm_page_4.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ANT_HRM_PAGES_H
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c
new file mode 100644
index 0000000..e06c7a0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c
@@ -0,0 +1,148 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_config.h"
+#if ANT_HRM_ENABLED
+
+#include "ant_hrm_simulator.h"
+#include "ant_hrm_utils.h"
+#include "nordic_common.h"
+
+#define ITERATION_ANT_CYCLES HRM_MSG_PERIOD_4Hz ///< period of calculation [1/32678 s], defined in ANT device profile
+#define ITERATION_PERIOD (ITERATION_ANT_CYCLES * 1024 / ANT_CLOCK_FREQUENCY) ///< integer part of calculation's period [1/1024 s]
+#define ITERATION_FRACTION (ITERATION_ANT_CYCLES * 1024 % ANT_CLOCK_FREQUENCY) ///< fractional part of calculation's period [1/32678 s]
+
+void ant_hrm_simulator_init(ant_hrm_simulator_t * p_simulator,
+ ant_hrm_simulator_cfg_t const * p_config,
+ bool auto_change)
+{
+
+ p_simulator->p_profile = p_config->p_profile;
+ p_simulator->_cb.sensorsim_cfg = p_config->sensorsim_cfg;
+ p_simulator->_cb.auto_change = auto_change;
+ p_simulator->_cb.sensorsim_state.current_val = p_simulator->_cb.sensorsim_cfg.min;
+ p_simulator->_cb.time_since_last_hb = 0;
+ p_simulator->_cb.fraction_since_last_hb = 0;
+
+ sensorsim_init(&(p_simulator->_cb.sensorsim_state), &(p_simulator->_cb.sensorsim_cfg));
+}
+
+
+void ant_hrm_simulator_one_iteration(ant_hrm_simulator_t * p_simulator)
+{
+
+ if (p_simulator->_cb.auto_change)
+ {
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg)));
+ }
+
+ // @note: Take a local copy within scope in order to assist the compiler in variable register
+ // allocation.
+ const uint32_t computed_heart_rate_value = p_simulator->_cb.sensorsim_state.current_val;
+
+ // @note: This implementation assumes that the current instantaneous heart can vary and this
+ // function is called with static frequency.
+ // value and the heart rate pulse interval is derived from it. The computation is based on 60
+ // seconds in a minute and the used time base is 1/1024 seconds.
+ const uint32_t current_hb_pulse_interval = (60u * 1024u) / computed_heart_rate_value;
+
+ // update time from last hb detected
+ p_simulator->_cb.time_since_last_hb += ITERATION_PERIOD;
+
+ // extended celculadion by fraction make calculating accurat in long time perspective
+ p_simulator->_cb.fraction_since_last_hb += ITERATION_FRACTION;
+ uint32_t add_period = p_simulator->_cb.fraction_since_last_hb / ANT_CLOCK_FREQUENCY;
+
+ if (add_period > 0)
+ {
+ p_simulator->_cb.time_since_last_hb++;
+ p_simulator->_cb.fraction_since_last_hb %= ANT_CLOCK_FREQUENCY;
+ }
+
+ // calc number of hb as will fill
+ uint32_t new_beats = p_simulator->_cb.time_since_last_hb / current_hb_pulse_interval;
+ uint32_t add_event_time = new_beats * current_hb_pulse_interval;
+
+ if (new_beats > 0)
+ {
+ p_simulator->p_profile->HRM_PROFILE_computed_heart_rate =
+ (uint8_t)computed_heart_rate_value;
+
+ // Current heart beat event time is the previous event time added with the current heart rate
+ // pulse interval.
+ uint32_t current_heart_beat_event_time = p_simulator->p_profile->HRM_PROFILE_beat_time +
+ add_event_time;
+
+ // Set current event time.
+ p_simulator->p_profile->HRM_PROFILE_beat_time = current_heart_beat_event_time; // <- B<4,5> <-
+
+ // Set previous event time. // p4.B<2,3> <- B<4,5>
+ p_simulator->p_profile->HRM_PROFILE_prev_beat =
+ p_simulator->p_profile->HRM_PROFILE_beat_time - current_hb_pulse_interval;
+
+ // Event count.
+ p_simulator->p_profile->HRM_PROFILE_beat_count += new_beats; // B<6>
+
+ p_simulator->_cb.time_since_last_hb -= add_event_time;
+ }
+}
+
+
+void ant_hrm_simulator_increment(ant_hrm_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_increment(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg));
+ }
+}
+
+
+void ant_hrm_simulator_decrement(ant_hrm_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_decrement(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg));
+ }
+}
+
+
+#endif // ANT_HRM_ENABLED
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h
new file mode 100644
index 0000000..0d5b84e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h
@@ -0,0 +1,130 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_SIMULATOR_H__
+#define ANT_HRM_SIMULATOR_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_hrm_simulator ANT HRM simulator
+ * @{
+ * @ingroup ant_sdk_simulators
+ * @brief ANT HRM simulator module.
+ *
+ * @details This module simulates a pulse for the ANT HRM profile. The module calculates abstract values, which are handled
+ * by the HRM pages data model to ensure that they are compatible. It provides a handler for changing the heart rate
+ * value manually and functionality to change the heart rate value automatically.
+ *
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_hrm.h"
+#include "ant_hrm_utils.h"
+#include "sensorsim.h"
+#include "ant_hrm_simulator_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**@brief HRM simulator configuration structure. */
+typedef struct
+{
+ ant_hrm_profile_t * p_profile; ///< Related profile.
+ sensorsim_cfg_t sensorsim_cfg; ///< Sensorsim configuration.
+} ant_hrm_simulator_cfg_t;
+
+/**@brief Initialize @ref ant_hrm_simulator_cfg_t.
+ */
+#define DEFAULT_ANT_HRM_SIMULATOR_CFG(P_PROFILE, MIN_HEART_RATE, MAX_HEART_RATE, INCREMENT) \
+ { \
+ .p_profile = (P_PROFILE), \
+ .sensorsim_cfg.min = (MIN_HEART_RATE), \
+ .sensorsim_cfg.max = (MAX_HEART_RATE), \
+ .sensorsim_cfg.incr = (INCREMENT), \
+ .sensorsim_cfg.start_at_max = false, \
+ }
+
+/**@brief HRM simulator structure. */
+typedef struct
+{
+ ant_hrm_profile_t * p_profile; ///< Related profile.
+ ant_hrm_simulator_cb_t _cb; ///< Internal control block.
+} ant_hrm_simulator_t;
+
+
+/**@brief Function for initializing the ANT HRM simulator instance.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ * @param[in] p_config Pointer to the simulator configuration structure.
+ * @param[in] auto_change Enable or disable automatic changes of the cadence.
+ */
+void ant_hrm_simulator_init(ant_hrm_simulator_t * p_simulator,
+ ant_hrm_simulator_cfg_t const * p_config,
+ bool auto_change);
+
+/**@brief Function for simulating a device event.
+ *
+ * @details Based on this event, the transmitter data is simulated.
+ *
+ * This function should be called in the HRM TX event handler.
+ */
+void ant_hrm_simulator_one_iteration(ant_hrm_simulator_t * p_simulator);
+
+/**@brief Function for incrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_hrm_simulator_increment(ant_hrm_simulator_t * p_simulator);
+
+/**@brief Function for decrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_hrm_simulator_decrement(ant_hrm_simulator_t * p_simulator);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_SIMULATOR_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h
new file mode 100644
index 0000000..be16be6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_SIMULATOR_LOCAL_H__
+#define ANT_HRM_SIMULATOR_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_hrm.h"
+#include "sensorsim.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup ant_sdk_hrm_simulator
+ * @brief HRM simulator control block structure. */
+typedef struct
+{
+ bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually.
+ uint32_t time_since_last_hb; ///< Time since last heart beat occurred (integer part).
+ uint64_t fraction_since_last_hb; ///< Time since last heart beat occurred (fractional part).
+ sensorsim_state_t sensorsim_state; ///< State of the simulated sensor.
+ sensorsim_cfg_t sensorsim_cfg; ///< Configuration of the simulated sensor.
+} ant_hrm_simulator_cb_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_SIMULATOR_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h
new file mode 100644
index 0000000..a6849ac
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_HRM_UTILS_H__
+#define ANT_HRM_UTILS_H__
+
+#include "app_util.h"
+#include "nrf_assert.h"
+#include "nrf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_hrm_utils Heart Rate Monitor profile utilities
+ * @{
+ * @ingroup ant_hrm
+ * @brief This module implements utilities for the Heart Rate Monitor profile.
+ *
+ */
+
+/**@brief Unit for HRM operating time.
+ *
+ * @details According to the ANT HRM specification, the operating time unit is 2 seconds.
+ */
+#define ANT_HRM_OPERATING_TIME_UNIT 2u
+
+/**@brief This macro should be used to get the seconds part of the operating time.
+ */
+#define ANT_HRM_OPERATING_SECONDS(OPERATING_TIME) (((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) % 60)
+
+/**@brief This macro should be used to get the minutes part of the operating time.
+ */
+#define ANT_HRM_OPERATING_MINUTES(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / 60) % 60)
+
+/**@brief This macro should be used to get the hours part of the operating time.
+ */
+#define ANT_HRM_OPERATING_HOURS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / (60 * 60)) % 24)
+
+/**@brief This macro should be used to get the days part of the operating time.
+ */
+#define ANT_HRM_OPERATING_DAYS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / (60 * 60)) / 24)
+
+/**@brief Number of HRM beat time counts per second.
+ *
+ * @details According to the ANT HRM specification, the beat time unit is 1/1024 of a second.
+ */
+#define ANT_HRM_BEAT_TIME_COUNTS_PER_SEC 1024u
+
+/**@brief Beat time display required precision.
+ *
+ * @details This value is used to decode the number of milliseconds.
+ */
+#define ANT_HRM_BEAT_TIME_PRECISION 1000u
+
+/**@brief This macro should be used to get the seconds part of the HRM beat time.
+ */
+#define ANT_HRM_BEAT_TIME_SEC(BEAT_TIME) ((BEAT_TIME) / ANT_HRM_BEAT_TIME_COUNTS_PER_SEC)
+
+/**@brief This macro should be used to get the milliseconds part of the HRM beat time.
+ */
+#define ANT_HRM_BEAT_TIME_MSEC(BEAT_TIME) (((((BEAT_TIME) % ANT_HRM_BEAT_TIME_COUNTS_PER_SEC) * ANT_HRM_BEAT_TIME_PRECISION) \
+ + (ANT_HRM_BEAT_TIME_COUNTS_PER_SEC / 2)) \
+ / ANT_HRM_BEAT_TIME_COUNTS_PER_SEC)
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_HRM_UTILS_H__
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.c
new file mode 100644
index 0000000..ed1ea44
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.c
@@ -0,0 +1,409 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "nrf_assert.h"
+#include "app_error.h"
+#include "ant_interface.h"
+#include "ant_sdm.h"
+#include "app_error.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+#define COMMON_DATA_INTERVAL 64 /**< Common data page is sent every 65th message. */
+
+/**@brief SDM message data layout structure. */
+typedef struct
+{
+ ant_sdm_page_t page_number;
+ uint8_t page_payload[7];
+}ant_sdm_message_layout_t;
+
+/**@brief Function for initializing the ANT SDM profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ *
+ * @retval NRF_SUCCESS Successful initialization.
+ * Error code when initialization failed.
+ */
+static ret_code_t ant_sdm_init(ant_sdm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config)
+{
+ p_profile->channel_number = p_channel_config->channel_number;
+
+ p_profile->page_1 = DEFAULT_ANT_SDM_PAGE1();
+ p_profile->page_2 = DEFAULT_ANT_SDM_PAGE2();
+ p_profile->page_3 = DEFAULT_ANT_SDM_PAGE3();
+ p_profile->page_22 = DEFAULT_ANT_SDM_PAGE22();
+ p_profile->common = DEFAULT_ANT_SDM_COMMON_DATA();
+ p_profile->page_80 = DEFAULT_ANT_COMMON_page80();
+ p_profile->page_81 = DEFAULT_ANT_COMMON_page81();
+
+ NRF_LOG_INFO("ANT SDM channel %u init", p_profile->channel_number);
+ return ant_channel_init(p_channel_config);
+}
+
+ret_code_t ant_sdm_disp_init(ant_sdm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_sdm_disp_config_t const * p_disp_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_disp_config != NULL);
+ ASSERT(p_disp_config->p_cb != NULL);
+ ASSERT(p_disp_config->evt_handler != NULL);
+
+ p_profile->evt_handler = p_disp_config->evt_handler;
+ p_profile->_cb.p_disp_cb = p_disp_config->p_cb;
+ ant_request_controller_init(&(p_profile->_cb.p_disp_cb->req_controller));
+
+ return ant_sdm_init(p_profile, p_channel_config);
+}
+
+ret_code_t ant_sdm_sens_init(ant_sdm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_sdm_sens_config_t const * p_sens_config)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_channel_config != NULL);
+ ASSERT(p_sens_config != NULL);
+ ASSERT(p_sens_config->p_cb != NULL);
+ ASSERT(p_sens_config->evt_handler != NULL);
+ ASSERT(p_sens_config->supplementary_page_number == ANT_SDM_PAGE_1
+ || p_sens_config->supplementary_page_number == ANT_SDM_PAGE_2
+ || p_sens_config->supplementary_page_number == ANT_SDM_PAGE_3);
+
+ p_profile->evt_handler = p_sens_config->evt_handler;
+ p_profile->_cb.p_sens_cb = p_sens_config->p_cb;
+ ant_request_controller_init(&(p_profile->_cb.p_sens_cb->req_controller));
+
+ p_profile->_cb.p_sens_cb->message_counter = 0;
+ p_profile->_cb.p_sens_cb->supp_page_control = 0;
+ p_profile->_cb.p_sens_cb->supp_page_number = p_sens_config->supplementary_page_number;
+ p_profile->_cb.p_sens_cb->common_page_number = ANT_SDM_PAGE_80;
+
+ return ant_sdm_init(p_profile, p_channel_config);
+}
+
+ret_code_t ant_sdm_page_request(ant_sdm_profile_t * p_profile, ant_common_page70_data_t * p_page_70)
+{
+ ASSERT(p_profile != NULL);
+ ASSERT(p_page_70 != NULL);
+
+ uint32_t err_code = ant_request_controller_request(&(p_profile->_cb.p_disp_cb->req_controller),
+ p_profile->channel_number, p_page_70);
+ NRF_LOG_INFO("");
+
+ return err_code;
+}
+
+/**@brief Function for getting next page number to send.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @return Next page number.
+ */
+static ant_sdm_page_t next_page_number_get(ant_sdm_profile_t * p_profile)
+{
+ ant_sdm_sens_cb_t * p_sdm_cb = p_profile->_cb.p_sens_cb;
+ ant_sdm_page_t page_number;
+
+ if (ant_request_controller_pending_get(&(p_sdm_cb->req_controller), (uint8_t *)&page_number))
+ {
+ // No implementation needed
+ }
+ else if (p_sdm_cb->message_counter == (COMMON_DATA_INTERVAL))
+ {
+ page_number = p_sdm_cb->common_page_number;
+ p_sdm_cb->message_counter++;
+ }
+ else if (p_sdm_cb->message_counter == (COMMON_DATA_INTERVAL + 1))
+ {
+ page_number = p_sdm_cb->common_page_number;
+ p_sdm_cb->common_page_number = (p_sdm_cb->common_page_number == ANT_SDM_PAGE_80)
+ ? ANT_SDM_PAGE_81 : ANT_SDM_PAGE_80;
+ p_sdm_cb->message_counter = 0;
+ }
+ else
+ {
+ if (p_sdm_cb->supp_page_control)
+ {
+ page_number = p_sdm_cb->supp_page_number;
+ }
+ else
+ {
+ page_number = ANT_SDM_PAGE_1;
+ }
+
+ if ((p_sdm_cb->message_counter % 2) == 1)
+ {
+ p_sdm_cb->supp_page_control = !p_sdm_cb->supp_page_control;
+ }
+ p_sdm_cb->message_counter++;
+ }
+ return page_number;
+}
+
+/**@brief Function for encoding SDM message.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_message_payload Pointer to the message payload.
+ *
+ * @note Assume to be call each time when Tx window will occur.
+ */
+static void sens_message_encode(ant_sdm_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ ant_sdm_message_layout_t * p_sdm_message_payload =
+ (ant_sdm_message_layout_t *)p_message_payload;
+
+ p_sdm_message_payload->page_number = next_page_number_get(p_profile);
+
+ NRF_LOG_INFO("SDM Page number: %u", p_sdm_message_payload->page_number);
+
+ switch (p_sdm_message_payload->page_number)
+ {
+ case ANT_SDM_PAGE_1:
+ ant_sdm_page_1_encode(p_sdm_message_payload->page_payload, &(p_profile->page_1),
+ &(p_profile->common));
+ ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_2:
+ ant_sdm_page_2_encode(p_sdm_message_payload->page_payload, &(p_profile->page_2));
+ ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_3:
+ ant_sdm_page_2_encode(p_sdm_message_payload->page_payload, &(p_profile->page_2));
+ ant_sdm_page_3_encode(p_sdm_message_payload->page_payload, &(p_profile->page_3));
+ ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_16:
+ ant_sdm_page_16_encode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_22:
+ ant_sdm_page_22_encode(p_sdm_message_payload->page_payload, &(p_profile->page_22));
+ break;
+
+ case ANT_SDM_PAGE_80:
+ ant_common_page_80_encode(p_sdm_message_payload->page_payload, &(p_profile->page_80));
+ break;
+
+ case ANT_SDM_PAGE_81:
+ ant_common_page_81_encode(p_sdm_message_payload->page_payload, &(p_profile->page_81));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_sdm_evt_t)p_sdm_message_payload->page_number);
+}
+
+void ant_sdm_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ASSERT(p_context != NULL);
+ ASSERT(p_ant_evt != NULL);
+ ant_sdm_profile_t * p_profile = (ant_sdm_profile_t *)p_context;
+
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ uint32_t err_code;
+ uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE];
+ ant_sdm_sens_cb_t * p_sdm_cb = p_profile->_cb.p_sens_cb;
+ ant_request_controller_sens_evt_handler(&(p_sdm_cb->req_controller), p_ant_evt);
+
+ switch (p_ant_evt->event)
+ {
+ case EVENT_TX:
+ case EVENT_TRANSFER_TX_FAILED:
+ case EVENT_TRANSFER_TX_COMPLETED:
+ sens_message_encode(p_profile, p_message_payload);
+ if (ant_request_controller_ack_needed(&(p_sdm_cb->req_controller)))
+ {
+ err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number,
+ sizeof(p_message_payload),
+ p_message_payload);
+ }
+ else
+ {
+ err_code = sd_ant_broadcast_message_tx(p_profile->channel_number,
+ sizeof(p_message_payload),
+ p_message_payload);
+ }
+ APP_ERROR_CHECK(err_code);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+ret_code_t ant_sdm_disp_open(ant_sdm_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ NRF_LOG_INFO("ANT SDM channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+ret_code_t ant_sdm_sens_open(ant_sdm_profile_t * p_profile)
+{
+ ASSERT(p_profile != NULL);
+
+ // Fill tx buffer for the first frame
+ uint32_t err_code;
+ uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE];
+
+ sens_message_encode(p_profile, p_message_payload);
+ err_code =
+ sd_ant_broadcast_message_tx(p_profile->channel_number,
+ sizeof(p_message_payload),
+ p_message_payload);
+ APP_ERROR_CHECK(err_code);
+
+ NRF_LOG_INFO("ANT SDM channel %u open", p_profile->channel_number);
+ return sd_ant_channel_open(p_profile->channel_number);
+}
+
+
+/**@brief Function for decoding SDM message.
+ *
+ * @note Assume to be call each time when Rx window will occur.
+ */
+static void disp_message_decode(ant_sdm_profile_t * p_profile, uint8_t * p_message_payload)
+{
+ const ant_sdm_message_layout_t * p_sdm_message_payload =
+ (ant_sdm_message_layout_t *)p_message_payload;
+
+ NRF_LOG_INFO("SDM Page number: %u", p_sdm_message_payload->page_number);
+
+ switch (p_sdm_message_payload->page_number)
+ {
+ case ANT_SDM_PAGE_1:
+ ant_sdm_page_1_decode(p_sdm_message_payload->page_payload,
+ &(p_profile->page_1),
+ &(p_profile->common));
+ ant_sdm_speed_decode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_3:
+ ant_sdm_page_3_decode(p_sdm_message_payload->page_payload, &(p_profile->page_3));
+ /* fall through */
+ case ANT_SDM_PAGE_2:
+ ant_sdm_page_2_decode(p_sdm_message_payload->page_payload, &(p_profile->page_2));
+ ant_sdm_speed_decode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_16:
+ ant_sdm_page_16_decode(p_sdm_message_payload->page_payload, &(p_profile->common));
+ break;
+
+ case ANT_SDM_PAGE_22:
+ ant_sdm_page_22_decode(p_sdm_message_payload->page_payload, &(p_profile->page_22));
+ break;
+
+ case ANT_SDM_PAGE_80:
+ ant_common_page_80_decode(p_sdm_message_payload->page_payload, &(p_profile->page_80));
+ break;
+
+ case ANT_SDM_PAGE_81:
+ ant_common_page_81_decode(p_sdm_message_payload->page_payload, &(p_profile->page_81));
+ break;
+
+ default:
+ return;
+ }
+
+ p_profile->evt_handler(p_profile, (ant_sdm_evt_t)p_sdm_message_payload->page_number);
+}
+
+void ant_sdm_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ASSERT(p_context != NULL);
+ ASSERT(p_ant_evt != NULL);
+ ant_sdm_profile_t * p_profile = ( ant_sdm_profile_t *)p_context;
+
+ if (p_ant_evt->channel == p_profile->channel_number)
+ {
+ ant_sdm_disp_cb_t * p_sdm_cb = p_profile->_cb.p_disp_cb;
+
+ switch (ant_request_controller_disp_evt_handler(&(p_sdm_cb->req_controller), p_ant_evt))
+ {
+ case ANT_REQUEST_CONTROLLER_SUCCESS:
+ p_profile->evt_handler(p_profile, ANT_SDM_PAGE_REQUEST_SUCCESS);
+ break;
+ case ANT_REQUEST_CONTROLLER_FAILED:
+ p_profile->evt_handler(p_profile, ANT_SDM_PAGE_REQUEST_FAILED);
+ break;
+ default:
+ break;
+ }
+
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX:
+ if (p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID
+ || p_ant_evt->message.ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID)
+ {
+ disp_message_decode(p_profile, p_ant_evt->message.ANT_MESSAGE_aucPayload);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.h
new file mode 100644
index 0000000..c71591c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm.h
@@ -0,0 +1,331 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/** @file
+ *
+ * @defgroup ant_sdm Stride Based Speed and Distance Monitor profile
+ * @{
+ * @ingroup ant_sdk_profiles
+ * @brief This module implements the Stride Based Speed and Distance Monitor profile.
+ *
+ */
+
+#ifndef ANT_SDM_H__
+#define ANT_SDM_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_parameters.h"
+#include "nrf_sdh_ant.h"
+#include "ant_channel_config.h"
+#include "ant_request_controller.h"
+#include "ant_sdm_pages.h"
+#include "sdk_errors.h"
+
+#define SDM_DEVICE_TYPE 0x7Cu ///< Device type reserved for ANT+ SDM.
+#define SDM_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz).
+
+#define SDM_MSG_PERIOD_4Hz 0x1FC6u ///< Message period, decimal 8134 (4.03 Hz).
+#define SDM_MSG_PERIOD_2Hz 0x3F8Cu ///< Message period, decimal 16268 (2.01 Hz).
+
+#define SDM_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+#define SDM_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE ///< RX SDM channel type.
+#define SDM_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< TX SDM channel type.
+
+/**@brief Initialize an ANT channel configuration structure for the SDM profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ * @param[in] SDM_MSG_PERIOD Channel period in 32 kHz counts. The SDM profile supports only the following periods:
+ * @ref SDM_MSG_PERIOD_4Hz, @ref SDM_MSG_PERIOD_2Hz.
+ */
+#define SDM_DISP_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER, \
+ SDM_MSG_PERIOD) \
+static const ant_channel_config_t CONCAT_2(NAME,_channel_sdm_disp_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = SDM_DISP_CHANNEL_TYPE, \
+ .ext_assign = SDM_EXT_ASSIGN, \
+ .rf_freq = SDM_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = SDM_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = (SDM_MSG_PERIOD), \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define SDM_DISP_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME,_channel_sdm_disp_config)
+
+/**@brief Initialize an ANT channel configuration structure for the SDM profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
+ * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
+ * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
+ * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
+ */
+#define SDM_SENS_CHANNEL_CONFIG_DEF(NAME, \
+ CHANNEL_NUMBER, \
+ TRANSMISSION_TYPE, \
+ DEVICE_NUMBER, \
+ NETWORK_NUMBER) \
+static const ant_channel_config_t CONCAT_2(NAME,_channel_sdm_sens_config) = \
+ { \
+ .channel_number = (CHANNEL_NUMBER), \
+ .channel_type = SDM_SENS_CHANNEL_TYPE, \
+ .ext_assign = SDM_EXT_ASSIGN, \
+ .rf_freq = SDM_ANTPLUS_RF_FREQ, \
+ .transmission_type = (TRANSMISSION_TYPE), \
+ .device_type = SDM_DEVICE_TYPE, \
+ .device_number = (DEVICE_NUMBER), \
+ .channel_period = SDM_MSG_PERIOD_4Hz, \
+ .network_number = (NETWORK_NUMBER), \
+ }
+#define SDM_SENS_CHANNEL_CONFIG(NAME) &CONCAT_2(NAME,_channel_sdm_sens_config)
+
+/**@brief Initialize an ANT profile configuration structure for the SDM profile (Display).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the SDM profile.
+ */
+#define SDM_DISP_PROFILE_CONFIG_DEF(NAME, \
+ EVT_HANDLER) \
+static ant_sdm_disp_cb_t CONCAT_2(NAME,_sdm_disp_cb); \
+static const ant_sdm_disp_config_t CONCAT_2(NAME,_profile_sdm_disp_config) = \
+ { \
+ .p_cb = &CONCAT_2(NAME,_sdm_disp_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define SDM_DISP_PROFILE_CONFIG(NAME) &CONCAT_2(NAME,_profile_sdm_disp_config)
+
+
+/**@brief Initialize an ANT profile configuration structure for the SDM profile (Sensor).
+ *
+ * @param[in] NAME Name of related instance.
+ * @param[in] SUPPLEMENTARY_PAGE_NUMBER Supplementary data page (ANT_SDM_PAGE_2 or ANT_SDM_PAGE_3). Use ANT_SDM_PAGE_1 to disable.
+ * @param[in] EVT_HANDLER Event handler to be called for handling events in the SDM profile.
+ */
+#define SDM_SENS_PROFILE_CONFIG_DEF(NAME, \
+ SUPPLEMENTARY_PAGE_NUMBER, \
+ EVT_HANDLER) \
+static ant_sdm_sens_cb_t CONCAT_2(NAME,_sdm_sens_cb); \
+static const ant_sdm_sens_config_t CONCAT_2(NAME,_profile_sdm_sens_config) = \
+ { \
+ .supplementary_page_number = (SUPPLEMENTARY_PAGE_NUMBER), \
+ .p_cb = &CONCAT_2(NAME,_sdm_sens_cb), \
+ .evt_handler = (EVT_HANDLER), \
+ }
+#define SDM_SENS_PROFILE_CONFIG(NAME) &CONCAT_2(NAME,_profile_sdm_sens_config)
+
+
+/**@brief SDM page number type. */
+typedef enum{
+ ANT_SDM_PAGE_1 = 1, ///< Required data page 1.
+ ANT_SDM_PAGE_2 = 2, ///< Supplementary data page 2.
+ ANT_SDM_PAGE_3 = 3, ///< Supplementary data page 3.
+ ANT_SDM_PAGE_16 = 16, ///< Page 16 (sent on request).
+ ANT_SDM_PAGE_22 = 22, ///< Page 22 (sent on request).
+ ANT_SDM_PAGE_70 = ANT_COMMON_PAGE_70,
+ ANT_SDM_PAGE_80 = ANT_COMMON_PAGE_80,
+ ANT_SDM_PAGE_81 = ANT_COMMON_PAGE_81,
+} ant_sdm_page_t;
+
+/**@brief SDM profile event type. */
+typedef enum{
+ ANT_SDM_PAGE_1_UPDATED = ANT_SDM_PAGE_1, ///< Data page 1 and speed have been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_2_UPDATED = ANT_SDM_PAGE_2, ///< Data page 2 and speed have been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_3_UPDATED = ANT_SDM_PAGE_3, ///< Data page 3 and speed have been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_16_UPDATED = ANT_SDM_PAGE_16, ///< Data page 16 has been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_22_UPDATED = ANT_SDM_PAGE_22, ///< Data page 22 has been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_80_UPDATED = ANT_SDM_PAGE_80, ///< Data page 80 has been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_81_UPDATED = ANT_SDM_PAGE_81, ///< Data page 81 has been updated (Display) or sent (Sensor).
+ ANT_SDM_PAGE_REQUEST_SUCCESS, ///< Data page request reached the destination.
+ ANT_SDM_PAGE_REQUEST_FAILED, ///< Data page request did not reach the destination.
+} ant_sdm_evt_t;
+
+// Forward declaration of the ant_sdm_profile_t type.
+typedef struct ant_sdm_profile_s ant_sdm_profile_t;
+
+/**@brief SDM event handler type. */
+typedef void (* ant_sdm_evt_handler_t) (ant_sdm_profile_t *, ant_sdm_evt_t);
+
+#include "ant_sdm_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief SDM Sensor configuration structure. */
+typedef struct
+{
+ ant_sdm_page_t supplementary_page_number; ///< Supplementary data page (ANT_SDM_PAGE_2 or ANT_SDM_PAGE_3). Use ANT_SDM_PAGE_1 to disable.
+ ant_sdm_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile.
+} ant_sdm_sens_config_t;
+
+/**@brief SDM Display configuration structure. */
+typedef struct
+{
+ ant_sdm_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use.
+ ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile.
+} ant_sdm_disp_config_t;
+
+/**@brief SDM profile structure. */
+struct ant_sdm_profile_s
+{
+ uint8_t channel_number; ///< Channel number assigned to the profile.
+ union {
+ ant_sdm_disp_cb_t * p_disp_cb;
+ ant_sdm_sens_cb_t * p_sens_cb;
+ } _cb; ///< Pointer to internal control block.
+ ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile.
+ ant_sdm_page1_data_t page_1; ///< Page 1.
+ ant_sdm_page2_data_t page_2; ///< Page 2.
+ ant_sdm_page3_data_t page_3; ///< Page 3.
+ ant_sdm_page22_data_t page_22; ///< Page 22.
+ ant_common_page80_data_t page_80; ///< Page 80.
+ ant_common_page81_data_t page_81; ///< Page 81.
+ ant_sdm_common_data_t common; ///< SDM common data.
+};
+
+/** @name Defines for accessing ant_sdm_profile_t members variables
+@{ */
+#define SDM_PROFILE_update_latency page_1.update_latency
+#define SDM_PROFILE_time page_1.time
+#define SDM_PROFILE_status page_2.status.items
+#define SDM_PROFILE_cadence page_2.cadence
+#define SDM_PROFILE_calories page_3.calories
+#define SDM_PROFILE_capabilities page_22.capabilities.items
+#define SDM_PROFILE_speed common.speed
+#define SDM_PROFILE_distance common.distance
+#define SDM_PROFILE_strides common.strides
+#define SDM_PROFILE_hw_revision page_80.hw_revision
+#define SDM_PROFILE_manufacturer_id page_80.manufacturer_id
+#define SDM_PROFILE_model_number page_80.model_number
+#define SDM_PROFILE_sw_revision_minor page_81.sw_revision_minor
+#define SDM_PROFILE_sw_revision_major page_81.sw_revision_major
+#define SDM_PROFILE_serial_number page_81.serial_number
+/** @} */
+
+/**@brief Function for initializing the ANT SDM RX profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_disp_config Pointer to the SDM Display configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_sdm_disp_init(ant_sdm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_sdm_disp_config_t const * p_disp_config);
+
+/**@brief Function for initializing the ANT SDM TX profile instance.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_channel_config Pointer to the ANT channel configuration structure.
+ * @param[in] p_sens_config Pointer to the SDM Sensor configuration structure.
+ *
+ * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
+ */
+ret_code_t ant_sdm_sens_init(ant_sdm_profile_t * p_profile,
+ ant_channel_config_t const * p_channel_config,
+ ant_sdm_sens_config_t const * p_sens_config);
+
+/**@brief Function for opening the profile instance channel for ANT SDM Display.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_sdm_disp_open(ant_sdm_profile_t * p_profile);
+
+/**@brief Function for opening the profile instance channel for ANT SDM Sensor.
+ *
+ * Before calling this function, pages should be configured.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
+ */
+ret_code_t ant_sdm_sens_open(ant_sdm_profile_t * p_profile);
+
+/**@brief Function for sending a data page request.
+ *
+ * This function can be called only on the display side.
+ *
+ * @param[in] p_profile Pointer to the profile instance.
+ * @param[in] p_page_70 Pointer to the prepared page 70.
+ *
+ * @retval NRF_SUCCESS If the request has been sent. Otherwise, an error code is returned.
+ */
+ret_code_t ant_sdm_page_request(ant_sdm_profile_t * p_profile, ant_common_page70_data_t * p_page_70);
+
+/**@brief Function for handling the Sensor ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the SDM Sensor profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_sdm_sens_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+/**@brief Function for handling the Display ANT events.
+ *
+ * @details This function handles all events from the ANT stack that are of interest to the SDM Display profile.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Pointer to the profile instance.
+ */
+void ant_sdm_disp_evt_handler(ant_evt_t * p_ant_evt, void * p_context);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h
new file mode 100644
index 0000000..910aa5d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_LOCAL_H__
+#define ANT_SDM_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_sdm.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ant_sdm
+ * @{
+ */
+
+/** @brief SDM Display control block. */
+typedef struct
+{
+ ant_request_controller_t req_controller;
+}ant_sdm_disp_cb_t;
+
+/**@brief SDM Sensor control block. */
+typedef struct
+{
+ uint8_t supp_page_control;
+ ant_sdm_page_t supp_page_number;
+ ant_sdm_page_t common_page_number;
+ uint8_t message_counter;
+ ant_request_controller_t req_controller;
+}ant_sdm_sens_cb_t;
+
+/**
+ * @}
+ */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c
new file mode 100644
index 0000000..8378d31
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_common_data.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM common page data layout structure. */
+typedef struct
+{
+ uint8_t reserved0[3];
+ uint8_t speed_integer :4;
+ uint8_t reserved1 :4;
+ uint8_t speed_fractional;
+ uint8_t reserved2[2];
+}ant_sdm_speed_data_layout_t;
+
+/**@brief Function for tracing common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ */
+static void speed_data_log(ant_sdm_common_data_t const * p_common_data)
+{
+ uint32_t speed = ANT_SDM_SPEED_RESCALE(p_common_data->speed);
+ UNUSED_VARIABLE(speed);
+
+ NRF_LOG_INFO("Speed %u.%02u m/s\r\n\n",
+ (unsigned int)(speed / ANT_SDM_SPEED_DISP_PRECISION),
+ (unsigned int)(speed % ANT_SDM_SPEED_DISP_PRECISION));
+}
+
+void ant_sdm_speed_encode(uint8_t * p_page_buffer,
+ ant_sdm_common_data_t const * p_common_data)
+{
+ ant_sdm_speed_data_layout_t * p_outcoming_data = (ant_sdm_speed_data_layout_t *)p_page_buffer;
+ uint16_t speed = p_common_data->speed;
+
+ p_outcoming_data->speed_integer = speed / ANT_SDM_SPEED_UNIT_REVERSAL;
+ p_outcoming_data->speed_fractional = speed % ANT_SDM_SPEED_UNIT_REVERSAL;
+
+ speed_data_log(p_common_data);
+}
+
+void ant_sdm_speed_decode(uint8_t const * p_page_buffer,
+ ant_sdm_common_data_t * p_common_data)
+{
+ ant_sdm_speed_data_layout_t const * p_incoming_data = (ant_sdm_speed_data_layout_t *)p_page_buffer;
+ uint16_t speed = (p_incoming_data->speed_integer
+ * ANT_SDM_SPEED_UNIT_REVERSAL)
+ + p_incoming_data->speed_fractional;
+
+ p_common_data->speed = speed;
+
+ speed_data_log(p_common_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h
new file mode 100644
index 0000000..d22c491
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_COMMON_DATA_H__
+#define ANT_SDM_COMMON_DATA_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_common_data_page Stride Based Speed and Distance Monitor profile common data
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for SDM common data.
+ *
+ * @details This structure stores data that is not associated with a particular page.
+ */
+typedef struct
+{
+ uint16_t speed; ///< Actual speed.
+ uint32_t distance; ///< Accumulated distance.
+ uint32_t strides; ///< Accumulated strides.
+} ant_sdm_common_data_t;
+
+/**@brief Initialize common data.
+ */
+#define DEFAULT_ANT_SDM_COMMON_DATA() \
+ (ant_sdm_common_data_t) \
+ { \
+ .speed = 0, \
+ .distance = 0, \
+ .strides = 0, \
+ }
+
+/**@brief Function for encoding speed.
+ *
+ * This function can be used for pages 2 and 3.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_speed_encode(uint8_t * p_page_buffer,
+ ant_sdm_common_data_t const * p_common_data);
+
+/**@brief Function for decoding speed.
+ *
+ * This function can be used for pages 2 and 3.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_common_data Pointer to the common data.
+ */
+void ant_sdm_speed_decode(uint8_t const * p_page_buffer,
+ ant_sdm_common_data_t * p_common_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_COMMON_DATA_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c
new file mode 100644
index 0000000..b2e4eed
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c
@@ -0,0 +1,144 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_page_1.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM page 1 data layout structure. */
+typedef struct
+{
+ uint8_t time_fractional;
+ uint8_t time_integer;
+ uint8_t distance_integer;
+ uint8_t reserved0 : 4;
+ uint8_t distance_fractional : 4;
+ uint8_t reserved1;
+ uint8_t strides;
+ uint8_t update_latency;
+}ant_sdm_page1_data_layout_t;
+
+STATIC_ASSERT(ANT_SDM_UPDATE_LATENCY_DISP_PRECISION == 1000); ///< Display format need to be updated
+STATIC_ASSERT(ANT_SDM_TIME_DISP_PRECISION == 1000); ///< Display format need to be updated
+STATIC_ASSERT(ANT_SDM_DISTANCE_DISP_PRECISION == 10); ///< Display format need to be updated
+
+/**@brief Function for tracing page 1 and common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[in] p_page_data Pointer to the page 1 data.
+ */
+static void page_1_data_log(ant_sdm_page1_data_t const * p_page_data,
+ ant_sdm_common_data_t const * p_common_data)
+{
+ uint32_t strides = p_common_data->strides;
+ uint64_t distance = ANT_SDM_DISTANCE_RESCALE(p_common_data->distance);
+ uint16_t update_latency = ANT_SDM_UPDATE_LATENCY_RESCALE(p_page_data->update_latency);
+ uint32_t time = ANT_SDM_TIME_RESCALE(p_page_data->time);
+
+ NRF_LOG_INFO("Update latency %u.%03u s",
+ update_latency / ANT_SDM_UPDATE_LATENCY_DISP_PRECISION,
+ update_latency % ANT_SDM_UPDATE_LATENCY_DISP_PRECISION);
+ NRF_LOG_INFO("Time %u.%03u s",
+ (unsigned int)(time / ANT_SDM_TIME_DISP_PRECISION),
+ (unsigned int)(time % ANT_SDM_TIME_DISP_PRECISION));
+ NRF_LOG_INFO("Distance %u.%01um ",
+ (unsigned int)(distance / ANT_SDM_DISTANCE_DISP_PRECISION),
+ (unsigned int)(distance % ANT_SDM_DISTANCE_DISP_PRECISION));
+ NRF_LOG_INFO("Strides %u", (unsigned int)strides);
+}
+
+
+void ant_sdm_page_1_encode(uint8_t * p_page_buffer,
+ ant_sdm_page1_data_t const * p_page_data,
+ ant_sdm_common_data_t const * p_common_data)
+{
+ ant_sdm_page1_data_layout_t * p_outcoming_data = (ant_sdm_page1_data_layout_t *)p_page_buffer;
+ uint32_t distance = p_common_data->distance;
+ uint16_t time = p_page_data->time;
+
+ p_outcoming_data->time_fractional = time % ANT_SDM_TIME_UNIT_REVERSAL;
+ p_outcoming_data->time_integer = time / ANT_SDM_TIME_UNIT_REVERSAL;
+ p_outcoming_data->distance_integer =
+ (UINT8_MAX & (distance / ANT_SDM_DISTANCE_UNIT_REVERSAL)); // Only LSB
+ p_outcoming_data->distance_fractional = distance % ANT_SDM_DISTANCE_UNIT_REVERSAL;
+ p_outcoming_data->strides = (UINT8_MAX & p_common_data->strides); // Only LSB
+ p_outcoming_data->update_latency = p_page_data->update_latency;
+
+ page_1_data_log(p_page_data, p_common_data);
+}
+
+
+void ant_sdm_page_1_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page1_data_t * p_page_data,
+ ant_sdm_common_data_t * p_common_data)
+{
+ ant_sdm_page1_data_layout_t const * p_incoming_data =
+ (ant_sdm_page1_data_layout_t *)p_page_buffer;
+
+ uint16_t distance = p_incoming_data->distance_integer * ANT_SDM_DISTANCE_UNIT_REVERSAL
+ + p_incoming_data->distance_fractional;
+ uint16_t time = p_incoming_data->time_integer * ANT_SDM_TIME_UNIT_REVERSAL
+ + p_incoming_data->time_fractional;
+
+ uint8_t prev_strides = p_common_data->strides;
+
+ p_common_data->strides += ((p_incoming_data->strides - prev_strides) & UINT8_MAX);
+
+ uint16_t prev_distance = p_common_data->distance;
+ p_common_data->distance += ((distance - prev_distance) & 0xFFF);
+
+ p_page_data->update_latency = p_incoming_data->update_latency;
+ p_page_data->time = time;
+ p_page_data->strides = p_incoming_data->strides;
+
+ page_1_data_log(p_page_data, p_common_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h
new file mode 100644
index 0000000..e9afca3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_PAGE_1_H__
+#define ANT_SDM_PAGE_1_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_page1 Stride Based Speed and Distance Monitor profile page 1
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+#include "ant_sdm_common_data.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for SDM data page 1.
+ */
+typedef struct
+{
+ uint8_t update_latency; ///< Update latency.
+ uint8_t strides; ///< Strides (writing to this field has no effect).
+ uint16_t time; ///< Time.
+} ant_sdm_page1_data_t;
+
+/**@brief Initialize page 1.
+ */
+#define DEFAULT_ANT_SDM_PAGE1() \
+ (ant_sdm_page1_data_t) \
+ { \
+ .update_latency = 0, \
+ .time = 0, \
+ }
+
+/**@brief Function for encoding page 1.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[in] p_common_data Pointer to the common data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_page_1_encode(uint8_t * p_page_buffer,
+ ant_sdm_page1_data_t const * p_page_data,
+ ant_sdm_common_data_t const * p_common_data);
+
+/**@brief Function for decoding page 1.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ * @param[out] p_common_data Pointer to the common data.
+ */
+void ant_sdm_page_1_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page1_data_t * p_page_data,
+ ant_sdm_common_data_t * p_common_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_PAGE_1_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c
new file mode 100644
index 0000000..f557db6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_page_16.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM page 16 data layout structure. */
+typedef struct
+{
+ uint8_t strides[3];
+ uint8_t distance[4];
+}ant_sdm_page16_data_layout_t;
+
+STATIC_ASSERT(ANT_SDM_DISTANCE_DISP_PRECISION == 10); ///< Display format need to be updated
+
+/**@brief Function for tracing common data.
+ *
+ * @param[in] p_common_data Pointer to the common data.
+ */
+static void page_16_data_log(ant_sdm_common_data_t const * p_common_data)
+{
+ uint64_t distance = ANT_SDM_DISTANCE_RESCALE(p_common_data->distance);
+
+ NRF_LOG_INFO("Distance %u.%01u m",
+ (unsigned int)(distance / ANT_SDM_DISTANCE_DISP_PRECISION),
+ (unsigned int)(distance % ANT_SDM_DISTANCE_DISP_PRECISION));
+ NRF_LOG_INFO("Strides %u\r\n\n",
+ (unsigned int)p_common_data->strides);
+}
+
+
+void ant_sdm_page_16_encode(uint8_t * p_page_buffer,
+ ant_sdm_common_data_t const * p_common_data)
+{
+ ant_sdm_page16_data_layout_t * p_outcoming_data = (ant_sdm_page16_data_layout_t *)p_page_buffer;
+
+ UNUSED_PARAMETER(uint24_encode(p_common_data->strides, p_outcoming_data->strides));
+ UNUSED_PARAMETER(uint32_encode(p_common_data->distance << 4, p_outcoming_data->distance));
+
+ page_16_data_log(p_common_data);
+}
+
+
+void ant_sdm_page_16_decode(uint8_t const * p_page_buffer,
+ ant_sdm_common_data_t * p_common_data)
+{
+ ant_sdm_page16_data_layout_t const * p_incoming_data =
+ (ant_sdm_page16_data_layout_t *)p_page_buffer;
+
+ p_common_data->strides = uint24_decode(p_incoming_data->strides);
+ p_common_data->distance = uint32_decode(p_incoming_data->distance) >> 4;
+
+ page_16_data_log(p_common_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h
new file mode 100644
index 0000000..7bb80ee
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_PAGE_16_H__
+#define ANT_SDM_PAGE_16_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_page16 Stride Based Speed and Distance Monitor profile page 16
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+#include "ant_sdm_common_data.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Function for encoding page 16.
+ *
+ * @param[in] p_common_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_page_16_encode(uint8_t * p_page_buffer,
+ ant_sdm_common_data_t const * p_common_data);
+
+/**@brief Function for decoding page 16.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_common_data Pointer to the page data.
+ */
+void ant_sdm_page_16_decode(uint8_t const * p_page_buffer,
+ ant_sdm_common_data_t * p_common_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_PAGE_16_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c
new file mode 100644
index 0000000..5302827
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c
@@ -0,0 +1,128 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_page_2.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM page 2 data layout structure. */
+typedef struct
+{
+ uint8_t reserved0[2];
+ uint8_t cadence_integer;
+ uint8_t reserved1 : 4;
+ uint8_t cadence_fractional : 4;
+ uint8_t reserved2;
+ uint8_t reserved3;
+ uint8_t status;
+}ant_sdm_page2_data_layout_t;
+
+/**@brief Function for page 2 data.
+ *
+ * @param[in] p_common_data Pointer to the page 2 data.
+ */
+static void page_2_data_log(ant_sdm_page2_data_t const * p_page_data)
+{
+ static const char * p_location[4] = {"Laces", "Midsole", "Other", "Ankle"};
+ static const char * p_battery[4] = {"New", "Good", "OK", "Low"};
+ static const char * p_health[4] = {"OK", "Error", "Warning", ""};
+ static const char * p_state[4] = {"Inactive", "Active", "", ""};
+
+ uint16_t cadence = ANT_SDM_CADENCE_RESCALE(p_page_data->cadence);
+
+ NRF_LOG_INFO("Status:");
+ NRF_LOG_INFO("state: %s",
+ (uint32_t)p_state[p_page_data->status.items.state]);
+ NRF_LOG_INFO("health: %s",
+ (uint32_t)p_health[p_page_data->status.items.health]);
+ NRF_LOG_INFO("battery: %s",
+ (uint32_t)p_battery[p_page_data->status.items.battery]);
+ NRF_LOG_INFO("location: %s",
+ (uint32_t)p_location[p_page_data->status.items.location]);
+ NRF_LOG_INFO("Cadence %u.%01u strides/min",
+ cadence / ANT_SDM_CADENCE_DISP_PRECISION,
+ cadence % ANT_SDM_CADENCE_DISP_PRECISION);
+}
+
+
+void ant_sdm_page_2_encode(uint8_t * p_page_buffer,
+ ant_sdm_page2_data_t const * p_page_data)
+{
+ ant_sdm_page2_data_layout_t * p_outcoming_data = (ant_sdm_page2_data_layout_t *)p_page_buffer;
+ uint8_t status = p_page_data->status.byte;
+ uint16_t cadence = p_page_data->cadence;
+
+ p_outcoming_data->reserved0[0] = UINT8_MAX;
+ p_outcoming_data->reserved0[1] = UINT8_MAX;
+ p_outcoming_data->cadence_integer = cadence / ANT_SDM_CADENCE_UNIT_REVERSAL;
+ p_outcoming_data->cadence_fractional = cadence % ANT_SDM_CADENCE_UNIT_REVERSAL;
+ p_outcoming_data->reserved3 = UINT8_MAX;
+ p_outcoming_data->status = status;
+ page_2_data_log(p_page_data);
+}
+
+
+void ant_sdm_page_2_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page2_data_t * p_page_data)
+{
+ ant_sdm_page2_data_layout_t const * p_incoming_data =
+ (ant_sdm_page2_data_layout_t *)p_page_buffer;
+
+ uint8_t status = p_incoming_data->status;
+ uint16_t cadence = p_incoming_data->cadence_integer * ANT_SDM_CADENCE_UNIT_REVERSAL
+ + p_incoming_data->cadence_fractional;
+
+ p_page_data->cadence = cadence;
+ p_page_data->status.byte = status;
+
+ page_2_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h
new file mode 100644
index 0000000..6243be0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_PAGE_2_H__
+#define ANT_SDM_PAGE_2_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_page2 Stride Based Speed and Distance Monitor profile page 2
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for SDM data page 2.
+ */
+typedef struct
+{
+ union
+ {
+ struct
+ {
+ enum
+ {
+ ANT_SDM_USE_STATE_INACTIVE = 0x00,
+ ANT_SDM_USE_STATE_ACTIVE = 0x01,
+ ANT_SDM_STATE_RESERVED0 = 0x02,
+ ANT_SDM_STATE_RESERVED1 = 0x03,
+ } state : 2; ///< Use state.
+ enum
+ {
+ ANT_SDM_HEALTH_OK = 0x00,
+ ANT_SDM_HEALTH_ERROR = 0x01,
+ ANT_SDM_HEALTH_WARNING = 0x02,
+ ANT_SDM_HEALTH_RESERVED = 0x03,
+ } health : 2; ///< SDM health.
+ enum
+ {
+ ANT_SDM_BATTERY_STATUS_NEW = 0x00,
+ ANT_SDM_BATTERY_STATUS_GOOD = 0x01,
+ ANT_SDM_BATTERY_STATUS_OK = 0x02,
+ ANT_SDM_BATTERY_STATUS_LOW = 0x03,
+ } battery : 2; ///< Battery status.
+ enum
+ {
+ ANT_SDM_LOCATION_LACES = 0x00,
+ ANT_SDM_LOCATION_MIDSOLE = 0x01,
+ ANT_SDM_LOCATION_OTHER = 0x02,
+ ANT_SDM_LOCATION_ANKLE = 0x03,
+ } location : 2; ///< Location of the SDM sensor.
+ } items;
+ uint8_t byte;
+ } status; ///< Actual status.
+ uint16_t cadence; ///< Actual cadence.
+} ant_sdm_page2_data_t;
+
+/**@brief Initialize page 2.
+ */
+#define DEFAULT_ANT_SDM_PAGE2() \
+ (ant_sdm_page2_data_t) \
+ { \
+ .status.byte = 0, \
+ .cadence = 0, \
+ }
+
+/**@brief Function for encoding page 2.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_page_2_encode(uint8_t * p_page_buffer,
+ ant_sdm_page2_data_t const * p_page_data);
+
+/**@brief Function for decoding page 2.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_sdm_page_2_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page2_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_PAGE_2_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c
new file mode 100644
index 0000000..4f489e5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c
@@ -0,0 +1,127 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include <string.h>
+#include "ant_sdm_page_22.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM page 22 data layout structure. */
+typedef struct
+{
+ uint8_t capabilities;
+ uint8_t reserved[6];
+}ant_sdm_page22_data_layout_t;
+
+/**@brief Function for tracing page 22 data.
+ *
+ * @param[in] p_page_data Pointer to the page 22 data.
+ */
+static void page_22_data_log(ant_sdm_page22_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Capabilities: ");
+
+ if (p_page_data->capabilities.items.time_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" time");
+ }
+
+ if (p_page_data->capabilities.items.distance_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" distance");
+ }
+
+ if (p_page_data->capabilities.items.speed_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" speed");
+ }
+
+ if (p_page_data->capabilities.items.latency_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" latency");
+ }
+
+ if (p_page_data->capabilities.items.cadency_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" cadence");
+ }
+
+ if (p_page_data->capabilities.items.calorie_is_valid)
+ {
+ NRF_LOG_RAW_INFO(" calories");
+ }
+ NRF_LOG_RAW_INFO("\r\n\n");
+}
+
+
+void ant_sdm_page_22_encode(uint8_t * p_page_buffer,
+ ant_sdm_page22_data_t const * p_page_data)
+{
+ ant_sdm_page22_data_layout_t * p_outcoming_data = (ant_sdm_page22_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->capabilities = p_page_data->capabilities.byte;
+ memset(p_outcoming_data->reserved, UINT8_MAX, sizeof (p_outcoming_data->reserved));
+
+ page_22_data_log(p_page_data);
+}
+
+
+void ant_sdm_page_22_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page22_data_t * p_page_data)
+{
+ ant_sdm_page22_data_layout_t const * p_incoming_data =
+ (ant_sdm_page22_data_layout_t *)p_page_buffer;
+
+ p_page_data->capabilities.byte = p_incoming_data->capabilities;
+
+ page_22_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h
new file mode 100644
index 0000000..42e2697
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_PAGE_22_H__
+#define ANT_SDM_PAGE_22_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_page22 Stride Based Speed and Distance Monitor profile page 22
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for SDM data page 22.
+ */
+typedef struct
+{
+ union
+ {
+ struct
+ {
+ bool time_is_valid : 1; ///< Transmitted time is valid.
+ bool distance_is_valid : 1; ///< Transmitted distance is valid.
+ bool speed_is_valid : 1; ///< Transmitted speed is valid.
+ bool latency_is_valid : 1; ///< Transmitted latency is valid.
+ bool cadency_is_valid : 1; ///< Transmitted cadency is valid.
+ bool calorie_is_valid : 1; ///< Transmitted calorie is valid.
+ } items;
+ uint8_t byte;
+ } capabilities;
+} ant_sdm_page22_data_t;
+
+/**@brief Initialize page 2.
+ */
+#define DEFAULT_ANT_SDM_PAGE22() \
+ (ant_sdm_page22_data_t) \
+ { \
+ .capabilities.byte = 0, \
+ }
+
+/**@brief Function for encoding page 22.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_page_22_encode(uint8_t * p_page_buffer,
+ ant_sdm_page22_data_t const * p_page_data);
+
+/**@brief Function for decoding page 22.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_sdm_page_22_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page22_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_PAGE_22_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c
new file mode 100644
index 0000000..7a3e092
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_page_3.h"
+#include "ant_sdm_utils.h"
+
+#define NRF_LOG_MODULE_NAME ant_sdm
+#if ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL ANT_SDM_LOG_LEVEL
+#define NRF_LOG_INFO_COLOR ANT_SDM_INFO_COLOR
+#else // ANT_SDM_LOG_ENABLED
+#define NRF_LOG_LEVEL 0
+#endif // ANT_SDM_LOG_ENABLED
+#include "nrf_log.h"
+
+/**@brief SDM page 3 data layout structure. */
+typedef struct
+{
+ uint8_t reserved0[5];
+ uint8_t calories;
+ uint8_t reserved1;
+}ant_sdm_page3_data_layout_t;
+
+static void page_3_data_log(ant_sdm_page3_data_t const * p_page_data)
+{
+ NRF_LOG_INFO("Calories: %u\r\n\n", p_page_data->calories);
+}
+
+
+void ant_sdm_page_3_encode(uint8_t * p_page_buffer,
+ ant_sdm_page3_data_t const * p_page_data)
+{
+ ant_sdm_page3_data_layout_t * p_outcoming_data = (ant_sdm_page3_data_layout_t *)p_page_buffer;
+
+ p_outcoming_data->calories = p_page_data->calories;
+ page_3_data_log(p_page_data);
+}
+
+
+void ant_sdm_page_3_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page3_data_t * p_page_data)
+{
+ ant_sdm_page3_data_layout_t const * p_incoming_data =
+ (ant_sdm_page3_data_layout_t *)p_page_buffer;
+
+ uint8_t prev_calories = (uint8_t) p_page_data->calories;
+
+ p_page_data->calories += ((p_incoming_data->calories - prev_calories) & UINT8_MAX);
+
+ page_3_data_log(p_page_data);
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h
new file mode 100644
index 0000000..0321ee1
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_PAGE_3_H__
+#define ANT_SDM_PAGE_3_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_page3 Stride Based Speed and Distance Monitor profile page 3
+ * @{
+ * @ingroup ant_sdk_profiles_sdm_pages
+ */
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Data structure for SDM data page 3.
+ */
+typedef struct
+{
+ uint32_t calories; ///< Calories.
+} ant_sdm_page3_data_t;
+
+/**@brief Initialize page 3.
+ */
+#define DEFAULT_ANT_SDM_PAGE3() \
+ (ant_sdm_page3_data_t) \
+ { \
+ .calories = 0, \
+ }
+
+/**@brief Function for encoding page 3.
+ *
+ * @param[in] p_page_data Pointer to the page data.
+ * @param[out] p_page_buffer Pointer to the data buffer.
+ */
+void ant_sdm_page_3_encode(uint8_t * p_page_buffer,
+ ant_sdm_page3_data_t const * p_page_data);
+
+/**@brief Function for decoding page 3.
+ *
+ * @param[in] p_page_buffer Pointer to the data buffer.
+ * @param[out] p_page_data Pointer to the page data.
+ */
+void ant_sdm_page_3_decode(uint8_t const * p_page_buffer,
+ ant_sdm_page3_data_t * p_page_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_PAGE_3_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h
new file mode 100644
index 0000000..55a8643
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __ANT_SDM_PAGES_H
+#define __ANT_SDM_PAGES_H
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_pages Stride Based Speed and Distance Monitor profile pages
+ * @{
+ * @ingroup ant_sdm
+ * @brief This module implements functions for the SDM data pages.
+ */
+
+#include "ant_sdm_page_1.h"
+#include "ant_sdm_page_2.h"
+#include "ant_sdm_page_3.h"
+#include "ant_sdm_page_16.h"
+#include "ant_sdm_page_22.h"
+#include "ant_sdm_common_data.h"
+#include "ant_common_page_70.h"
+#include "ant_common_page_80.h"
+#include "ant_common_page_81.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ANT_SDM_PAGES_H
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c
new file mode 100644
index 0000000..5dbfe80
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c
@@ -0,0 +1,159 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SDM)
+
+#include "ant_sdm_simulator.h"
+#include "ant_sdm_utils.h"
+
+#define SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL 100 ///< Stride length unit is cm.
+#define SIMULATOR_BURN_RATE_UNIT 1000 ///< Burn rate uinit is kcal per km.
+#define SIMULATOR_TIME_INCREMENT SDM_MSG_PERIOD_4Hz ///< Ticks between two cycles.
+#define SIMULATOR_TIME_UNIT_REVERSAL ANT_CLOCK_FREQUENCY ///< Simulation time frequency.
+#define SEC_PER_MIN 60 ///< Number of seconds per minute.
+#define SIMULATOR_STRIDE_UNIT_REVERSAL (SIMULATOR_TIME_UNIT_REVERSAL * \
+ ANT_SDM_CADENCE_UNIT_REVERSAL * SEC_PER_MIN)
+
+
+void ant_sdm_simulator_init(ant_sdm_simulator_t * p_simulator,
+ ant_sdm_simulator_cfg_t const * p_config,
+ bool auto_change)
+{
+ p_simulator->p_profile = p_config->p_profile;
+ p_simulator->_cb.stride_length = p_config->stride_length;
+ p_simulator->_cb.burn_rate = p_config->burn_rate;
+ p_simulator->_cb.sensorsim_cfg = p_config->sensorsim_cfg;
+ p_simulator->_cb.auto_change = auto_change;
+ p_simulator->_cb.sensorsim_state.current_val = p_simulator->_cb.sensorsim_cfg.min;
+ p_simulator->_cb.stride_incr = 0;
+ p_simulator->_cb.time = 0;
+
+
+ sensorsim_init(&(p_simulator->_cb.sensorsim_state), &(p_simulator->_cb.sensorsim_cfg));
+}
+
+
+void ant_sdm_simulator_one_iteration(ant_sdm_simulator_t * p_simulator)
+{
+ if (p_simulator->_cb.auto_change)
+ {
+ UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg)));
+ }
+
+ p_simulator->_cb.time += SIMULATOR_TIME_INCREMENT;
+
+ p_simulator->_cb.stride_incr += p_simulator->_cb.sensorsim_state.current_val *
+ SIMULATOR_TIME_INCREMENT;
+ p_simulator->p_profile->SDM_PROFILE_strides += p_simulator->_cb.stride_incr /
+ SIMULATOR_STRIDE_UNIT_REVERSAL;
+ p_simulator->_cb.stride_incr = p_simulator->_cb.stride_incr %
+ SIMULATOR_STRIDE_UNIT_REVERSAL;
+
+
+ uint32_t distance = value_rescale(
+ p_simulator->p_profile->SDM_PROFILE_strides * p_simulator->_cb.stride_length,
+ SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL,
+ ANT_SDM_DISTANCE_UNIT_REVERSAL);
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.cadency_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_cadence = p_simulator->_cb.sensorsim_state.current_val;
+ }
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.speed_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_speed = value_rescale(
+ p_simulator->_cb.sensorsim_state.current_val * p_simulator->_cb.stride_length,
+ ANT_SDM_CADENCE_UNIT_REVERSAL * SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL * SEC_PER_MIN,
+ ANT_SDM_SPEED_UNIT_REVERSAL);
+ }
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.distance_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_distance = distance;
+ }
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.calorie_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_calories = value_rescale(distance,
+ SIMULATOR_BURN_RATE_UNIT
+ * ANT_SDM_DISTANCE_UNIT_REVERSAL,
+ p_simulator->_cb.burn_rate);
+ }
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.time_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_time = value_rescale(p_simulator->_cb.time,
+ SIMULATOR_TIME_UNIT_REVERSAL,
+ ANT_SDM_TIME_UNIT_REVERSAL);
+ }
+
+ if (p_simulator->p_profile->SDM_PROFILE_capabilities.latency_is_valid)
+ {
+ p_simulator->p_profile->SDM_PROFILE_update_latency =
+ ROUNDED_DIV(((uint64_t)p_simulator->_cb.stride_incr *
+ ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL),
+ (uint64_t)SIMULATOR_TIME_UNIT_REVERSAL *
+ p_simulator->_cb.sensorsim_state.current_val);
+ }
+}
+
+
+void ant_sdm_simulator_increment(ant_sdm_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_increment(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg));
+ }
+}
+
+
+void ant_sdm_simulator_decrement(ant_sdm_simulator_t * p_simulator)
+{
+ if (!p_simulator->_cb.auto_change)
+ {
+ sensorsim_decrement(&(p_simulator->_cb.sensorsim_state),
+ &(p_simulator->_cb.sensorsim_cfg));
+ }
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SDM)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h
new file mode 100644
index 0000000..e18cd48
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h
@@ -0,0 +1,139 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_SIMULATOR_H__
+#define ANT_SDM_SIMULATOR_H__
+
+/** @file
+ *
+ * @defgroup ant_sdk_sdm_simulator ANT SDM simulator
+ * @{
+ * @ingroup ant_sdk_simulators
+ * @brief ANT SDM simulator module.
+ *
+ * @details This module simulates strides for the ANT SDM profile. The module calculates
+ * abstract values, which are handled by the SDM pages data model to ensure that they are
+ * compatible. It provides a handler for changing the cadence value manually and functionality
+ * for changing the cadence automatically.
+ *
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_sdm.h"
+#include "ant_sdm_utils.h"
+#include "sensorsim.h"
+#include "ant_sdm_simulator_local.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief SDM simulator configuration structure. */
+typedef struct
+{
+ ant_sdm_profile_t * p_profile; ///< Related profile.
+ uint32_t stride_length; ///< Length of a stride in cm.
+ uint32_t burn_rate; ///< Kcal per kilometer.
+ sensorsim_cfg_t sensorsim_cfg; ///< Sensorsim configuration.
+} ant_sdm_simulator_cfg_t;
+
+/**@brief Initialize @ref ant_sdm_simulator_cfg_t.
+ */
+#define DEFAULT_ANT_SDM_SIMULATOR_CFG(P_PROFILE, \
+ STRIDE_LEN, \
+ BURN_RATE, \
+ MIN_CADENCE, \
+ MAX_CADENCE, \
+ INCREMENT) \
+ { \
+ .p_profile = (P_PROFILE), \
+ .stride_length = (STRIDE_LEN), \
+ .burn_rate = (BURN_RATE), \
+ .sensorsim_cfg.min = (MIN_CADENCE) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \
+ .sensorsim_cfg.max = (MAX_CADENCE) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \
+ .sensorsim_cfg.incr = (INCREMENT) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \
+ .sensorsim_cfg.start_at_max = false, \
+ }
+
+/**@brief SDM simulator structure. */
+typedef struct
+{
+ ant_sdm_profile_t * p_profile; ///< Related profile.
+ ant_sdm_simulator_cb_t _cb; ///< Internal control block.
+} ant_sdm_simulator_t;
+
+
+/**@brief Function for initializing the ANT SDM simulator instance.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ * @param[in] p_config Pointer to the simulator configuration structure.
+ * @param[in] auto_change Enable or disable automatic changes of the cadence.
+ */
+void ant_sdm_simulator_init(ant_sdm_simulator_t * p_simulator,
+ ant_sdm_simulator_cfg_t const * p_config,
+ bool auto_change);
+
+/**@brief Function for simulating a device event.
+ *
+ * @details Based on this event, the transmitter data is simulated.
+ *
+ * This function should be called in the SDM TX event handler.
+ */
+void ant_sdm_simulator_one_iteration(ant_sdm_simulator_t * p_simulator);
+
+/**@brief Function for incrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_sdm_simulator_increment(ant_sdm_simulator_t * p_simulator);
+
+/**@brief Function for decrementing the cadence value.
+ *
+ * @param[in] p_simulator Pointer to the simulator instance.
+ */
+void ant_sdm_simulator_decrement(ant_sdm_simulator_t * p_simulator);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_SIMULATOR_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h
new file mode 100644
index 0000000..732e98e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_SIMULATOR_LOCAL_H__
+#define ANT_SDM_SIMULATOR_LOCAL_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "ant_sdm.h"
+#include "sensorsim.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup ant_sdk_sdm_simulator
+ * @brief SDM simulator control block structure. */
+typedef struct
+{
+ bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually.
+ uint8_t stride_length; ///< Length of a stride (in cm).
+ uint8_t burn_rate; ///< Kcal per kilometer.
+ uint32_t stride_incr; ///< Fractional part of stride increment.
+ uint64_t time; ///< Simulation time.
+ sensorsim_state_t sensorsim_state; ///< State of the simulated sensor.
+ sensorsim_cfg_t sensorsim_cfg; ///< Configuration of the simulated sensor.
+}ant_sdm_simulator_cb_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_SIMULATOR_LOCAL_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h
new file mode 100644
index 0000000..a68a8d0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SDM_UTILS_H__
+#define ANT_SDM_UTILS_H__
+
+#include "nrf_assert.h"
+#include "nrf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ *
+ * @defgroup ant_sdk_profiles_sdm_utils Stride Based Speed and Distance Monitor profile utilities
+ * @{
+ * @ingroup ant_sdm
+ * @brief This module implements utilities for the Stride Based Speed and Distance Monitor profile.
+ *
+ */
+
+/*@brief A reversal of time unit.
+ *
+ * @details According to the ANT SDM specification, the time unit (fractional part) is 1/200 of a second.
+ */
+#define ANT_SDM_TIME_UNIT_REVERSAL 200
+#define ANT_SDM_TIME_DISP_PRECISION 1000
+#define ANT_SDM_TIME_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_TIME_UNIT_REVERSAL, \
+ ANT_SDM_TIME_DISP_PRECISION)
+
+/*@brief A reversal of distance unit.
+ *
+ * @details According to the ANT SDM specification, the distance unit (page 1 - fractional part) is 1/16 of a meter.
+ */
+#define ANT_SDM_DISTANCE_UNIT_REVERSAL 16
+#define ANT_SDM_DISTANCE_DISP_PRECISION 10
+#define ANT_SDM_DISTANCE_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_DISTANCE_UNIT_REVERSAL, \
+ ANT_SDM_DISTANCE_DISP_PRECISION)
+
+/*@brief A reversal of speed unit.
+ *
+ * @details According to the ANT SDM specification, the speed unit (fractional part) is 1/256 of m/s.
+ */
+#define ANT_SDM_SPEED_UNIT_REVERSAL 256
+#define ANT_SDM_SPEED_DISP_PRECISION 100
+#define ANT_SDM_SPEED_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_SPEED_UNIT_REVERSAL, \
+ ANT_SDM_SPEED_DISP_PRECISION)
+
+/*@brief A reversal of update latency unit.
+ *
+ * @details According to the ANT SDM specification, the update latency unit (fractional part) is 1/32 of a second.
+ */
+#define ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL 32
+#define ANT_SDM_UPDATE_LATENCY_DISP_PRECISION 1000
+#define ANT_SDM_UPDATE_LATENCY_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL, \
+ ANT_SDM_UPDATE_LATENCY_DISP_PRECISION)
+
+/*@brief A reversal of cadence unit.
+ *
+ * @details According to the ANT SDM specification, the cadence unit (fractional part) is 1/16 of strides/minute.
+ */
+#define ANT_SDM_CADENCE_UNIT_REVERSAL 16
+#define ANT_SDM_CADENCE_DISP_PRECISION 10
+#define ANT_SDM_CADENCE_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_CADENCE_UNIT_REVERSAL, \
+ ANT_SDM_CADENCE_DISP_PRECISION)
+
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SDM_UTILS_H__
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.c
new file mode 100644
index 0000000..3314b81
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.c
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_SEARCH_CONFIG)
+
+#include "ant_search_config.h"
+#include "ant_interface.h"
+
+uint32_t ant_search_init(ant_search_config_t const * p_config)
+{
+ uint32_t err_code;
+
+ if (p_config->low_priority_timeout == ANT_LOW_PRIORITY_SEARCH_DISABLE
+ && p_config->high_priority_timeout == ANT_HIGH_PRIORITY_SEARCH_DISABLE)
+ {
+ return NRF_ERROR_INVALID_PARAM;
+ }
+
+ err_code = sd_ant_search_channel_priority_set(p_config->channel_number,
+ p_config->search_priority);
+ VERIFY_SUCCESS(err_code);
+
+ err_code = sd_ant_search_waveform_set(p_config->channel_number,
+ p_config->waveform);
+ VERIFY_SUCCESS(err_code);
+
+ err_code = sd_ant_channel_rx_search_timeout_set(p_config->channel_number,
+ p_config->high_priority_timeout);
+ VERIFY_SUCCESS(err_code);
+
+ err_code = sd_ant_channel_low_priority_rx_search_timeout_set(p_config->channel_number,
+ p_config->low_priority_timeout);
+ VERIFY_SUCCESS(err_code);
+
+ err_code = sd_ant_active_search_sharing_cycles_set(p_config->channel_number,
+ p_config->search_sharing_cycles);
+ return err_code;
+}
+
+#endif // NRF_MODULE_ENABLED(ANT_SEARCH_CONFIG)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.h
new file mode 100644
index 0000000..72395e3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_search_config/ant_search_config.h
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ANT_SEARCH_CONFIG_H__
+#define ANT_SEARCH_CONFIG_H__
+
+/** @file
+ *
+ * @defgroup ant_search_config ANT search configuration
+ * @{
+ * @ingroup ant_sdk_utils
+ * @brief ANT channel search configuration module.
+ */
+
+#include <stdint.h>
+#include "ant_parameters.h"
+#include "sdk_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANT_SEARCH_SHARING_CYCLES_DISABLE 0x00 ///< Disable search sharing.
+
+#define ANT_LOW_PRIORITY_SEARCH_DISABLE 0x00 ///< Disable low priority search.
+#define ANT_LOW_PRIORITY_TIMEOUT_DISABLE 0xFF ///< Disable low priority search time-out.
+
+#define ANT_HIGH_PRIORITY_SEARCH_DISABLE 0x00 ///< Disable high priority search.
+#define ANT_HIGH_PRIORITY_TIMEOUT_DISABLE 0xFF ///< Disable high priority search time-out.
+
+/**@brief Search priority. */
+typedef enum
+{
+ ANT_SEARCH_PRIORITY_DEFAULT = 0, ///< Default search priority level.
+ ANT_SEARCH_PRIORITY_LOWEST = ANT_SEARCH_PRIORITY_DEFAULT, ///< Lowest search priority level.
+ ANT_SEARCH_PRIORITY_0 = ANT_SEARCH_PRIORITY_LOWEST,
+ ANT_SEARCH_PRIORITY_1 = 1,
+ ANT_SEARCH_PRIORITY_2 = 2,
+ ANT_SEARCH_PRIORITY_3 = 3,
+ ANT_SEARCH_PRIORITY_4 = 4,
+ ANT_SEARCH_PRIORITY_5 = 5,
+ ANT_SEARCH_PRIORITY_6 = 6,
+ ANT_SEARCH_PRIORITY_7 = 7,
+ ANT_SEARCH_PRIORITY_HIGHEST = ANT_SEARCH_PRIORITY_7, ///< Highest search priority level.
+} ant_search_priority_t;
+
+/**@brief ANT search waveform. */
+typedef enum
+{
+ ANT_WAVEFORM_DEFAULT = 316, ///< Standard search waveform value.
+ ANT_WAVEFORM_FAST = 97, ///< Accelerated search waveform value.
+} ant_waveform_t;
+
+/**@brief ANT search configuration structure. */
+typedef struct
+{
+ uint8_t channel_number; ///< Assigned channel number.
+ uint8_t low_priority_timeout; ///< Low priority time-out (in 2.5 second increments).
+ uint8_t high_priority_timeout; ///< High priority time-out (in 2.5 second increments).
+ uint8_t search_sharing_cycles; ///< Number of search cycles to run before alternating searches. Search sharing can be disabled by @ref ANT_SEARCH_SHARING_CYCLES_DISABLE.
+ ant_search_priority_t search_priority; ///< Search priority.
+ ant_waveform_t waveform; ///< Search waveform. Do not use custom values.
+} ant_search_config_t;
+
+/**@brief Initializes the default ANT search configuration structure.
+ *
+ * @param[in] CHANNEL_NUMBER Number of the channel.
+ */
+#define DEFAULT_ANT_SEARCH_CONFIG(CHANNEL_NUMBER) \
+{ \
+ .channel_number = CHANNEL_NUMBER, \
+ .low_priority_timeout = ANT_DEFAULT_LOW_PRIORITY_TIMEOUT, \
+ .high_priority_timeout = ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT, \
+ .search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE, \
+ .search_priority = ANT_SEARCH_PRIORITY_DEFAULT, \
+ .waveform = ANT_WAVEFORM_DEFAULT, \
+}
+
+/**@brief Function for configuring the ANT channel search.
+ *
+ * @param[in] p_config Pointer to the search configuration structure.
+ *
+ * @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned.
+ */
+uint32_t ant_search_init(ant_search_config_t const * p_config);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_SEARCH_CONFIG_H__
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.c
new file mode 100644
index 0000000..1b4b2c5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.c
@@ -0,0 +1,145 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(ANT_STATE_INDICATOR)
+#include "ant_state_indicator.h"
+#include "bsp.h"
+#include "app_error.h"
+#include "nrf_sdh.h"
+#include "nrf_sdh_ant.h"
+#include "nrf_pwr_mgmt.h"
+
+static uint8_t m_channel = UINT8_MAX; /**< ANT channel number linked to indication. */
+static uint8_t m_channel_type; /**< Type of linked ANT channel. */
+
+ret_code_t ant_state_indicator_init( uint8_t channel, uint8_t channel_type)
+{
+ m_channel = channel;
+ m_channel_type = channel_type;
+
+ return bsp_indication_set(BSP_INDICATE_IDLE);
+}
+
+ret_code_t ant_state_indicator_channel_opened(void)
+{
+ ret_code_t err_code = NRF_SUCCESS;
+
+ switch (m_channel_type)
+ {
+ case CHANNEL_TYPE_SLAVE:
+ /* fall through */
+ case CHANNEL_TYPE_SLAVE_RX_ONLY:
+ err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
+ break;
+
+ case CHANNEL_TYPE_MASTER:
+ err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
+ break;
+ }
+
+ return err_code;
+}
+
+/**
+ * @brief Function for handling ANT events.
+ *
+ * @param[in] p_ant_evt Event received from the ANT stack.
+ * @param[in] p_context Context.
+ */
+static void ant_evt_handler(ant_evt_t * p_ant_evt, void * p_context)
+{
+ ret_code_t err_code = NRF_SUCCESS;
+
+ if (m_channel != p_ant_evt->channel)
+ {
+ return;
+ }
+
+ switch (m_channel_type)
+ {
+ case CHANNEL_TYPE_SLAVE:
+ /* fall through */
+ case CHANNEL_TYPE_SLAVE_RX_ONLY:
+ switch (p_ant_evt->event)
+ {
+ case EVENT_RX:
+ err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
+ break;
+
+ case EVENT_RX_FAIL:
+ err_code = bsp_indication_set(BSP_INDICATE_RCV_ERROR);
+ break;
+
+ case EVENT_RX_FAIL_GO_TO_SEARCH:
+ err_code = bsp_indication_set(BSP_INDICATE_SCANNING);
+ break;
+
+ case EVENT_CHANNEL_CLOSED:
+ nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
+ break;
+
+ case EVENT_RX_SEARCH_TIMEOUT:
+ err_code = bsp_indication_set(BSP_INDICATE_IDLE);
+ break;
+ }
+ break;
+ }
+ APP_ERROR_CHECK(err_code);
+}
+
+NRF_SDH_ANT_OBSERVER(m_ant_observer, ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO, ant_evt_handler, NULL);
+
+/**
+ * @brief Function for shutdown events.
+ *
+ * @param[in] event Shutdown type.
+ */
+static bool m_shutdown_handler(nrf_pwr_mgmt_evt_t event)
+{
+ ret_code_t err_code = bsp_indication_set(BSP_INDICATE_IDLE);
+ APP_ERROR_CHECK(err_code);
+
+ return true;
+}
+
+
+NRF_PWR_MGMT_HANDLER_REGISTER(m_shutdown_handler, ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY);
+
+#endif // NRF_MODULE_ENABLED(ANT_STATE_INDICATOR)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.h
new file mode 100644
index 0000000..a1745f5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_state_indicator/ant_state_indicator.h
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __ANT_STATE_INDICATOR_H
+#define __ANT_STATE_INDICATOR_H
+
+/** @file
+ *
+ * @defgroup ant_state_indicator ANT channel state indicator
+ * @{
+ * @ingroup ant_sdk_utils
+ * @brief ANT channel state indicator module.
+ *
+ * @details This module provides functionality for indicating the ANT channel state.
+ */
+
+#include <stdint.h>
+#include "sdk_errors.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Function for initializing the ANT channel state indicator.
+ *
+ * @details This function links the signaling procedure with a specific ANT channel.
+ *
+ * Before calling this function, you must initiate the @ref lib_bsp to be able to use the LEDs.
+ *
+ * @param[in] channel ANT channel number.
+ * @param[in] channel_type ANT channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters).
+ *
+ * @retval NRF_SUCCESS If the module was initialized successfully. Otherwise, a propagated error
+ * code is returned.
+ */
+ret_code_t ant_state_indicator_init(uint8_t channel, uint8_t channel_type);
+
+/**
+ * @brief Function for indicating the channel opening.
+ *
+ * @details This function should be called after the opening of the channel.
+ *
+ * @retval NRF_SUCCESS If the state was successfully indicated.
+ * @retval NRF_ERROR_NO_MEM If the internal timer operations queue was full.
+ * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized
+ * or the internal timer has not been created.
+ *
+ * @retval NRF_SUCCESS If the state was indicated successfully. Otherwise, a propagated error
+ * code is returned.
+ */
+ret_code_t ant_state_indicator_channel_opened(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ANT_STATE_INDICATOR_H__
+/** @} */