diff options
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages')
11 files changed, 1088 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c new file mode 100644 index 0000000..4f383a1 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(ANT_HRM) + +#include "ant_hrm_page_0.h" +#include "ant_hrm_utils.h" + +#define NRF_LOG_MODULE_NAME ant_hrm_page_0 +#if ANT_HRM_PAGE_0_LOG_ENABLED +#define NRF_LOG_LEVEL ANT_HRM_PAGE_0_LOG_LEVEL +#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_0_INFO_COLOR +#else // ANT_HRM_PAGE_0_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // ANT_HRM_PAGE_0_LOG_ENABLED +#include "nrf_log.h" +NRF_LOG_MODULE_REGISTER(); + +/**@brief HRM page 0 data layout structure. */ +typedef struct +{ + uint8_t reserved[3]; + uint8_t heart_beat_evt_time_LSB; + uint8_t heart_beat_evt_time_MSB; + uint8_t heart_beat_count; + uint8_t computed_heart_rate; +}ant_hrm_page0_data_layout_t; + +/**@brief Function for tracing page 0 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 0 data. + */ +static void page0_data_log(ant_hrm_page0_data_t const * p_page_data) +{ + NRF_LOG_INFO("Heart beat count: %u", (unsigned int)p_page_data->beat_count); + NRF_LOG_INFO("Computed heart rate: %u", + (unsigned int) p_page_data->computed_heart_rate); + NRF_LOG_INFO("Heart beat event time: %u.%03us\r\n\n", + (unsigned int) ANT_HRM_BEAT_TIME_SEC(p_page_data->beat_time), + (unsigned int) ANT_HRM_BEAT_TIME_MSEC(p_page_data->beat_time)); +} + + +void ant_hrm_page_0_encode(uint8_t * p_page_buffer, + ant_hrm_page0_data_t const * p_page_data) +{ + ant_hrm_page0_data_layout_t * p_outcoming_data = (ant_hrm_page0_data_layout_t *)p_page_buffer; + uint32_t beat_time = p_page_data->beat_time; + + p_outcoming_data->reserved[0] = UINT8_MAX; + p_outcoming_data->reserved[1] = UINT8_MAX; + p_outcoming_data->reserved[2] = UINT8_MAX; + p_outcoming_data->heart_beat_evt_time_LSB = (uint8_t)(beat_time & UINT8_MAX); + p_outcoming_data->heart_beat_evt_time_MSB = (uint8_t)((beat_time >> 8) & UINT8_MAX); + p_outcoming_data->heart_beat_count = (uint8_t)p_page_data->beat_count; + p_outcoming_data->computed_heart_rate = (uint8_t)p_page_data->computed_heart_rate; + + page0_data_log(p_page_data); +} + + +void ant_hrm_page_0_decode(uint8_t const * p_page_buffer, + ant_hrm_page0_data_t * p_page_data) +{ + ant_hrm_page0_data_layout_t const * p_incoming_data = + (ant_hrm_page0_data_layout_t *)p_page_buffer; + + uint32_t beat_time = (uint32_t)((p_incoming_data->heart_beat_evt_time_MSB << 8) + + p_incoming_data->heart_beat_evt_time_LSB); + + p_page_data->beat_count = (uint32_t)p_incoming_data->heart_beat_count; + p_page_data->computed_heart_rate = (uint32_t)p_incoming_data->computed_heart_rate; + p_page_data->beat_time = beat_time; + + page0_data_log(p_page_data); +} + +#endif // NRF_MODULE_ENABLED(ANT_HRM) diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h new file mode 100644 index 0000000..1b06e9a --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ANT_HRM_PAGE_0_H__ +#define ANT_HRM_PAGE_0_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page0 HRM profile page 0 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Data structure for HRM data page 0. + * + * This structure is used as a common page. + */ +typedef struct +{ + uint8_t beat_count; ///< Beat count. + uint8_t computed_heart_rate; ///< Computed heart rate. + uint16_t beat_time; ///< Beat time. +} ant_hrm_page0_data_t; + +/**@brief Initialize page 0. + */ +#define DEFAULT_ANT_HRM_PAGE0() \ + (ant_hrm_page0_data_t) \ + { \ + .beat_count = 0, \ + .computed_heart_rate = 0, \ + .beat_time = 0, \ + } + +/**@brief Function for encoding page 0. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_0_encode(uint8_t * p_page_buffer, + ant_hrm_page0_data_t const * p_page_data); + +/**@brief Function for decoding page 0. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_0_decode(uint8_t const * p_page_buffer, + ant_hrm_page0_data_t * p_page_data); + + +#ifdef __cplusplus +} +#endif + +#endif // ANT_HRM_PAGE_0_H__ +/** @} */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c new file mode 100644 index 0000000..90eee6f --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(ANT_HRM) + +#include "ant_hrm_page_1.h" +#include "ant_hrm_utils.h" + +#define NRF_LOG_MODULE_NAME ant_hrm_page_1 +#if ANT_HRM_PAGE_1_LOG_ENABLED +#define NRF_LOG_LEVEL ANT_HRM_PAGE_1_LOG_LEVEL +#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_1_INFO_COLOR +#else // ANT_HRM_PAGE_1_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // ANT_HRM_PAGE_1_LOG_ENABLED +#include "nrf_log.h" +NRF_LOG_MODULE_REGISTER(); + +/**@brief HRM page 1 data layout structure. */ +typedef struct +{ + uint8_t cumulative_operating_time[3]; + uint8_t reserved[4]; +}ant_hrm_page1_data_layout_t; + +/**@brief Function for tracing page 1 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 1 data. + */ +static void page1_data_log(ant_hrm_page1_data_t const * p_page_data) +{ + NRF_LOG_INFO("Cumulative operating time: %ud %uh %um %us\r\n\n", + (unsigned int) ANT_HRM_OPERATING_DAYS(p_page_data->operating_time), + (unsigned int) ANT_HRM_OPERATING_HOURS(p_page_data->operating_time), + (unsigned int) ANT_HRM_OPERATING_MINUTES(p_page_data->operating_time), + (unsigned int) ANT_HRM_OPERATING_SECONDS(p_page_data->operating_time)); +} + + +void ant_hrm_page_1_encode(uint8_t * p_page_buffer, + ant_hrm_page1_data_t const * p_page_data) +{ + ant_hrm_page1_data_layout_t * p_outcoming_data = (ant_hrm_page1_data_layout_t *)p_page_buffer; + uint32_t operating_time = p_page_data->operating_time; + + UNUSED_PARAMETER(uint24_encode(operating_time, p_outcoming_data->cumulative_operating_time)); + page1_data_log(p_page_data); +} + + +void ant_hrm_page_1_decode(uint8_t const * p_page_buffer, + ant_hrm_page1_data_t * p_page_data) +{ + ant_hrm_page1_data_layout_t const * p_incoming_data = + (ant_hrm_page1_data_layout_t *)p_page_buffer; + + uint32_t operating_time = uint24_decode(p_incoming_data->cumulative_operating_time); + + p_page_data->operating_time = operating_time; + + page1_data_log(p_page_data); +} + +#endif // NRF_MODULE_ENABLED(ANT_HRM) diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h new file mode 100644 index 0000000..5162025 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ANT_HRM_PAGE_1_H__ +#define ANT_HRM_PAGE_1_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page1 HRM profile page 1 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Data structure for HRM data page 1. + * + * This structure implements only page 1 specific data. + */ +typedef struct +{ + uint32_t operating_time; ///< Operating time. +} ant_hrm_page1_data_t; + +/**@brief Initialize page 1. + */ +#define DEFAULT_ANT_HRM_PAGE1() \ + (ant_hrm_page1_data_t) \ + { \ + .operating_time = 0, \ + } + +/**@brief Function for encoding page 1. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_1_encode(uint8_t * p_page_buffer, + ant_hrm_page1_data_t const * p_page_data); + +/**@brief Function for decoding page 1. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_1_decode(uint8_t const * p_page_buffer, + ant_hrm_page1_data_t * p_page_data); + + +#ifdef __cplusplus +} +#endif + +#endif // ANT_HRM_PAGE_1_H__ +/** @} */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c new file mode 100644 index 0000000..1873b93 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(ANT_HRM) + +#include "ant_hrm_page_2.h" + +#define NRF_LOG_MODULE_NAME ant_hrm_page_2 +#if ANT_HRM_PAGE_2_LOG_ENABLED +#define NRF_LOG_LEVEL ANT_HRM_PAGE_2_LOG_LEVEL +#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_2_INFO_COLOR +#else // ANT_HRM_PAGE_2_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // ANT_HRM_PAGE_2_LOG_ENABLED +#include "nrf_log.h" +NRF_LOG_MODULE_REGISTER(); + +/**@brief HRM page 2 data layout structure. */ +typedef struct +{ + uint8_t manuf_id; + uint8_t serial_num_LSB; + uint8_t serial_num_MSB; + uint8_t reserved[4]; +}ant_hrm_page2_data_layout_t; + +/**@brief Function for tracing page 2 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 2 data. + */ +static void page2_data_log(ant_hrm_page2_data_t const * p_page_data) +{ + NRF_LOG_INFO("Manufacturer ID: %u", (unsigned int)p_page_data->manuf_id); + NRF_LOG_INFO("Serial No (upper 16-bits): 0x%X\r\n\n", (unsigned int)p_page_data->serial_num); +} + + +void ant_hrm_page_2_encode(uint8_t * p_page_buffer, + ant_hrm_page2_data_t const * p_page_data) +{ + ant_hrm_page2_data_layout_t * p_outcoming_data = (ant_hrm_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = p_page_data->serial_num; + + p_outcoming_data->manuf_id = (uint8_t)p_page_data->manuf_id; + p_outcoming_data->serial_num_LSB = (uint8_t)(serial_num & UINT8_MAX); + p_outcoming_data->serial_num_MSB = (uint8_t)((serial_num >> 8) & UINT8_MAX); + + page2_data_log(p_page_data); +} + + +void ant_hrm_page_2_decode(uint8_t const * p_page_buffer, + ant_hrm_page2_data_t * p_page_data) +{ + ant_hrm_page2_data_layout_t const * p_incoming_data = + (ant_hrm_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = + (uint32_t)((p_incoming_data->serial_num_MSB << 8) + + p_incoming_data-> + serial_num_LSB); + + p_page_data->manuf_id = (uint32_t)p_incoming_data->manuf_id; + p_page_data->serial_num = serial_num; + + page2_data_log(p_page_data); +} + +#endif // NRF_MODULE_ENABLED(ANT_HRM) diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h new file mode 100644 index 0000000..4460373 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ANT_HRM_PAGE_2_H__ +#define ANT_HRM_PAGE_2_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page2 HRM profile page 2 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Data structure for HRM data page 2. + * + * This structure implements only page 2 specific data. + */ +typedef struct +{ + uint8_t manuf_id; ///< Manufacturer ID. + uint16_t serial_num; ///< Serial number. +} ant_hrm_page2_data_t; + +/**@brief Initialize page 2. + */ +#define DEFAULT_ANT_HRM_PAGE2() \ + (ant_hrm_page2_data_t) \ + { \ + .manuf_id = 0, \ + .serial_num = 0, \ + } + +/**@brief Function for encoding page 2. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_2_encode(uint8_t * p_page_buffer, + ant_hrm_page2_data_t const * p_page_data); + +/**@brief Function for decoding page 2. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_2_decode(uint8_t const * p_page_buffer, + ant_hrm_page2_data_t * p_page_data); + + +#ifdef __cplusplus +} +#endif + +#endif // ANT_HRM_PAGE_2_H__ +/** @} */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c new file mode 100644 index 0000000..aa1ec7e --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(ANT_HRM) + +#include "ant_hrm_page_3.h" + +#define NRF_LOG_MODULE_NAME ant_hrm_page_3 +#if ANT_HRM_PAGE_3_LOG_ENABLED +#define NRF_LOG_LEVEL ANT_HRM_PAGE_3_LOG_LEVEL +#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_3_INFO_COLOR +#else // ANT_HRM_PAGE_3_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // ANT_HRM_PAGE_3_LOG_ENABLED +#include "nrf_log.h" +NRF_LOG_MODULE_REGISTER(); + +/**@brief HRM page 3 data layout structure. */ +typedef struct +{ + uint8_t hw_version; + uint8_t sw_version; + uint8_t model_num; + uint8_t reserved[4]; +}ant_hrm_page3_data_layout_t; + +/**@brief Function for tracing page 3 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 3 data. + */ +static void page3_data_log(ant_hrm_page3_data_t const * p_page_data) +{ + NRF_LOG_INFO("Hardware Rev ID %u", (unsigned int)p_page_data->hw_version); + NRF_LOG_INFO("Model %u", (unsigned int)p_page_data->model_num); + NRF_LOG_INFO("Software Ver ID %u\r\n\n", (unsigned int)p_page_data->sw_version); +} + + +void ant_hrm_page_3_encode(uint8_t * p_page_buffer, + ant_hrm_page3_data_t const * p_page_data) +{ + ant_hrm_page3_data_layout_t * p_outcoming_data = (ant_hrm_page3_data_layout_t *)p_page_buffer; + + p_outcoming_data->hw_version = (uint8_t)p_page_data->hw_version; + p_outcoming_data->sw_version = (uint8_t)p_page_data->sw_version; + p_outcoming_data->model_num = (uint8_t)p_page_data->model_num; + + page3_data_log(p_page_data); +} + + +void ant_hrm_page_3_decode(uint8_t const * p_page_buffer, + ant_hrm_page3_data_t * p_page_data) +{ + ant_hrm_page3_data_layout_t const * p_incoming_data = + (ant_hrm_page3_data_layout_t *)p_page_buffer; + + p_page_data->hw_version = (uint32_t)p_incoming_data->hw_version; + p_page_data->sw_version = (uint32_t)p_incoming_data->sw_version; + p_page_data->model_num = (uint32_t)p_incoming_data->model_num; + + page3_data_log(p_page_data); +} + +#endif // NRF_MODULE_ENABLED(ANT_HRM) diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h new file mode 100644 index 0000000..1fed280 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ANT_HRM_PAGE_3_H__ +#define ANT_HRM_PAGE_3_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page3 HRM profile page 3 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Data structure for HRM data page 3. + * + * This structure implements only page 3 specific data. + */ +typedef struct +{ + uint8_t hw_version; ///< Hardware version. + uint8_t sw_version; ///< Software version. + uint8_t model_num; ///< Model number. +} ant_hrm_page3_data_t; + +/**@brief Initialize page 3. + */ +#define DEFAULT_ANT_HRM_PAGE3() \ + (ant_hrm_page3_data_t) \ + { \ + .hw_version = 0, \ + .sw_version = 0, \ + .model_num = 0, \ + } + +/**@brief Function for encoding page 3. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_3_encode(uint8_t * p_page_buffer, + ant_hrm_page3_data_t const * p_page_data); + +/**@brief Function for decoding page 3. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_3_decode(uint8_t const * p_page_buffer, + ant_hrm_page3_data_t * p_page_data); + + +#ifdef __cplusplus +} +#endif + +#endif // ANT_HRM_PAGE_3_H__ +/** @} */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c new file mode 100644 index 0000000..62bd683 --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sdk_common.h" +#if NRF_MODULE_ENABLED(ANT_HRM) + +#include "ant_hrm_page_4.h" +#include "ant_hrm_utils.h" + +#define NRF_LOG_MODULE_NAME ant_hrm_page_4 +#if ANT_HRM_PAGE_4_LOG_ENABLED +#define NRF_LOG_LEVEL ANT_HRM_PAGE_4_LOG_LEVEL +#define NRF_LOG_INFO_COLOR ANT_HRM_PAGE_4_INFO_COLOR +#else // ANT_HRM_PAGE_4_LOG_ENABLED +#define NRF_LOG_LEVEL 0 +#endif // ANT_HRM_PAGE_4_LOG_ENABLED +#include "nrf_log.h" +NRF_LOG_MODULE_REGISTER(); + +/**@brief HRM page 4 data layout structure. */ +typedef struct +{ + uint8_t manuf_spec; + uint8_t prev_beat_LSB; + uint8_t prev_beat_MSB; + uint8_t reserved[4]; +}ant_hrm_page4_data_layout_t; + +/**@brief Function for tracing page 4 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 4 data. + */ +static void page4_data_log(ant_hrm_page4_data_t const * p_page_data) +{ + NRF_LOG_INFO("Previous heart beat event time: %u.%03us\r\n\n", + (unsigned int)ANT_HRM_BEAT_TIME_SEC(p_page_data->prev_beat), + (unsigned int)ANT_HRM_BEAT_TIME_MSEC(p_page_data->prev_beat)); +} + + +void ant_hrm_page_4_encode(uint8_t * p_page_buffer, + ant_hrm_page4_data_t const * p_page_data) +{ + ant_hrm_page4_data_layout_t * p_outcoming_data = (ant_hrm_page4_data_layout_t *)p_page_buffer; + uint32_t prev_beat = p_page_data->prev_beat; + + p_outcoming_data->manuf_spec = p_page_data->manuf_spec; + p_outcoming_data->prev_beat_LSB = (uint8_t)(prev_beat & UINT8_MAX); + p_outcoming_data->prev_beat_MSB = (uint8_t)((prev_beat >> 8) & UINT8_MAX); + + page4_data_log(p_page_data); +} + + +void ant_hrm_page_4_decode(uint8_t const * p_page_buffer, + ant_hrm_page4_data_t * p_page_data) +{ + ant_hrm_page4_data_layout_t const * p_incoming_data = + (ant_hrm_page4_data_layout_t *)p_page_buffer; + + uint32_t prev_beat = (uint32_t)((p_incoming_data->prev_beat_MSB << 8) + + p_incoming_data->prev_beat_LSB); + + p_page_data->manuf_spec = p_incoming_data->manuf_spec; + p_page_data->prev_beat = prev_beat; + + page4_data_log(p_page_data); +} + +#endif // NRF_MODULE_ENABLED(ANT_HRM) diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h new file mode 100644 index 0000000..f59cdde --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ANT_HRM_PAGE_4_H__ +#define ANT_HRM_PAGE_4_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page4 HRM profile page 4 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Data structure for HRM data page 4. + * + * This structure implements only page 4 specific data. + */ +typedef struct +{ + uint8_t manuf_spec; ///< Manufacturer specific byte. + uint16_t prev_beat; ///< Previous beat. +} ant_hrm_page4_data_t; + +/**@brief Initialize page 4. + */ +#define DEFAULT_ANT_HRM_PAGE4() \ + (ant_hrm_page4_data_t) \ + { \ + .manuf_spec = 0, \ + .prev_beat = 0, \ + } + +/**@brief Function for encoding page 4. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_4_encode(uint8_t * p_page_buffer, + ant_hrm_page4_data_t const * p_page_data); + +/**@brief Function for decoding page 4. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_4_decode(uint8_t const * p_page_buffer, + ant_hrm_page4_data_t * p_page_data); + + +#ifdef __cplusplus +} +#endif + +#endif // ANT_HRM_PAGE_3_H__ +/** @} */ diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h new file mode 100644 index 0000000..c1e328e --- /dev/null +++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2015 - 2018, Nordic Semiconductor ASA + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form, except as embedded into a Nordic + * Semiconductor ASA integrated circuit in a product or a software update for + * such product, must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * 4. This software, with or without modification, must only be used with a + * Nordic Semiconductor ASA integrated circuit. + * + * 5. Any software provided in binary form under this license must not be reverse + * engineered, decompiled, modified and/or disassembled. + * + * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __ANT_HRM_PAGES_H +#define __ANT_HRM_PAGES_H + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_pages Heart Rate Monitor profile pages + * @{ + * @ingroup ant_hrm + * @brief This module implements functions for the HRM data pages. + */ + +#include "ant_hrm_page_0.h" +#include "ant_hrm_page_1.h" +#include "ant_hrm_page_2.h" +#include "ant_hrm_page_3.h" +#include "ant_hrm_page_4.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif // __ANT_HRM_PAGES_H +/** @} */ |