通用数据页80传输制造商的ID,型号和硬件版本。
注意,该数据页不得在共享通道上使用。当此数据页在广播频道上发送时,应始终描述发送该页的ANT+自行车灯。包含灯光索引字段的数据页16(0x10)应在共享通道上使用,并且主灯应使用它来描述辅助灯的制造商信息。
有关此页面的详细信息,请参考ANT+ Common Pages文档。
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#include "ant_BikeLight_page_80.h"
#include "ant_BikeLight_utils.h"
#include "ant_BikeLight_page_logger.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include "main.h"
/**@brief BikeLight 制造商标识 (0x50) 第80页数据布局结构. */
typedef struct
{
uint8_t reserved[2]; //未使用,填充0xFF
uint8_t hw_revision; //硬件版本
uint8_t manufacturer_id[2]; //制造商id
uint8_t model_number[2]; //产品型号
} ant_BikeLight_page80_data_layout_t;
static void page80_data_log(ant_BikeLight_page80_data_t const *p_page_data)
{
// SEGGER_RTT_printf(0, "hw revision: %unr", p_page_data->hw_revision);
// SEGGER_RTT_printf(0, "manufacturer id: %unr", p_page_data->manufacturer_id);
// SEGGER_RTT_printf(0, "model number: %unr", p_page_data->model_number);
}
void ant_BikeLight_page_80_encode(uint8_t *p_page_buffer,
ant_BikeLight_page80_data_t const *p_page_data)
{
ant_BikeLight_page80_data_layout_t *p_outcoming_data = (ant_BikeLight_page80_data_layout_t *)p_page_buffer;
memset(p_page_buffer, 0xFF, sizeof(ant_BikeLight_page80_data_layout_t));
p_outcoming_data->hw_revision = p_page_data->hw_revision;
UNUSED_PARAMETER(uint16_encode(p_page_data->manufacturer_id,
p_outcoming_data->manufacturer_id));
UNUSED_PARAMETER(uint16_encode(p_page_data->model_number, p_outcoming_data->model_number));
page80_data_log(p_page_data);
}
void ant_BikeLight_page_80_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page80_data_t *p_page_data)
{
ant_BikeLight_page80_data_layout_t const *p_incoming_data =
(ant_BikeLight_page80_data_layout_t *)p_page_buffer;
p_page_data->hw_revision = p_incoming_data->hw_revision;
p_page_data->manufacturer_id = uint16_decode(p_incoming_data->manufacturer_id);
p_page_data->model_number = uint16_decode(p_incoming_data->model_number);
m_ant_BikeLight.page_1.Last_Sequence_Number = 80;
page80_data_log(p_page_data);
}
/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
#ifndef ANT_BIKELIGHT_PAGE_80_H__
#define ANT_BIKELIGHT_PAGE_80_H__
#include typedef struct { uint8_t hw_revision; //硬件版本。 uint16_t manufacturer_id; //制造商ID。 uint16_t model_number; //型号。 } ant_BikeLight_page80_data_t; #define DEFAULT_ANT_BikeLight_PAGE80() (ant_BikeLight_page80_data_t) { .hw_revision = 0x00, .manufacturer_id = UINT8_MAX, .model_number = 0x00, } /**@brief Initialize page 80. */ #define ANT_BikeLight_page80(hw_rev, man_id, mod_num) (ant_BikeLight_page80_data_t) { .hw_revision = (hw_rev), .manufacturer_id = (man_id), .model_number = (mod_num), } void ant_BikeLight_page_80_encode(uint8_t *p_page_buffer, ant_BikeLight_page80_data_t const *p_page_data); void ant_BikeLight_page_80_decode(uint8_t const *p_page_buffer, ant_BikeLight_page80_data_t *p_page_data); #endif // ANT_BIKELIGHT_PAGE_80_H__ /** @} */
上一篇:[ANT+][nrf51422][s210] 自行车车灯 数据页33 –连接命令(0x21)
下一篇:[ANT+][nrf51422][s210] 自行车车灯 通用页面81(0x51)–产品信息
推荐阅读最新更新时间:2024-10-11 14:42
设计资源 培训 开发板 精华推荐
- LT3692AIUH FMEA 容错 3.3V/2A 和 5V/2A 双路降压转换器的典型应用电路
- 具有内置诊断功能的 TDA7563ASMTR 4 x 50W 多功能四路功率放大器的典型应用电路
- MIKROE-3480,用于 STM32 STM32F303RC 的 MCU 卡
- RD-FSB127H-T001,适用于游戏机的 16W、5V AC 至 DC 单路输出电源的参考设计
- LT1021BCN8-5 电压基准作为应变计调节器的典型应用
- 带有外部晶体管的典型降压应用 NCP3064 1.5A 升压/降压/反相开关稳压器,具有开/关功能
- 使用 Analog Devices 的 LTC3130EUDC-1 的参考设计
- 使用 Analog Devices 的 LTC1551LCS8 的参考设计
- 【物联网】鸿蒙WIFI开关+772984A
- 使用 Analog Devices 的 LT1934EDCB-1 的参考设计