aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_sdm')
-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
20 files changed, 2682 insertions, 0 deletions
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__
+