通用数据页面81传输设备的软件版本及其32位序列号。
注意,该数据页不得在共享通道上使用。当此数据页在广播频道上发送时,应始终描述发送该页的ANT+自行车灯。包含光索引字段的数据页17(0x11)应在共享通道上使用,并且主灯应使用它来描述辅助灯的产品信息。
有关此页面的详细信息,请参考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_81.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 产品信息 (0x51) 第81页数据布局结构. */
typedef struct
{
uint8_t reserved;
uint8_t sw_revision_minor; //软件修订(补充) 补充,如果未使用,请填写0xFF。
uint8_t sw_revision_major; //主软件版本。
uint8_t serial_number[4];
} ant_BikeLight_page81_data_layout_t;
static void page81_data_log(ant_BikeLight_page81_data_t const *p_page_data)
{
// if (p_page_data->sw_revision_minor != UINT8_MAX)
// {
// SEGGER_RTT_printf(0, "sw revision:%u.%u\n\r",
// ((ant_BikeLight_page81_data_t const *) p_page_data)->sw_revision_major,
// ((ant_BikeLight_page81_data_t const *) p_page_data)->sw_revision_minor);
// }
// else
// {
// SEGGER_RTT_printf(0, "sw revision: %u\n\r", p_page_data->sw_revision_major);
// }
// SEGGER_RTT_printf(0, "serial number: %u\n\r", (unsigned int) p_page_data->serial_number);
}
void ant_BikeLight_page_81_encode(uint8_t *p_page_buffer,
ant_BikeLight_page81_data_t const *p_page_data)
{
ant_BikeLight_page81_data_layout_t *p_outcoming_data = (ant_BikeLight_page81_data_layout_t *)p_page_buffer;
memset(p_page_buffer, 0xFF, sizeof(ant_BikeLight_page81_data_layout_t));
p_outcoming_data->reserved = UINT8_MAX;
p_outcoming_data->sw_revision_minor = p_page_data->sw_revision_minor;
p_outcoming_data->sw_revision_major = p_page_data->sw_revision_major;
UNUSED_PARAMETER(uint32_encode(p_page_data->serial_number, p_outcoming_data->serial_number));
page81_data_log(p_page_data);
}
void ant_BikeLight_page_81_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page81_data_t *p_page_data)
{
ant_BikeLight_page81_data_layout_t const *p_incoming_data =
(ant_BikeLight_page81_data_layout_t *)p_page_buffer;
p_page_data->sw_revision_minor = p_incoming_data->sw_revision_minor;
p_page_data->sw_revision_major = p_incoming_data->sw_revision_major;
p_page_data->serial_number = uint32_decode(p_incoming_data->serial_number);
m_ant_BikeLight.page_1.Last_Sequence_Number = 81;
page81_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_81_H__
#define ANT_BIKELIGHT_PAGE_81_H__
#include <stdint.h>
typedef struct
{
uint8_t sw_revision_minor; //补充,如果未使用,请填写0xFF。
uint8_t sw_revision_major; //主软件版本。
uint32_t serial_number; //序列号的最低32 b,如果未使用,则填充0xfffffff。
} ant_BikeLight_page81_data_t;
#define DEFAULT_ANT_BikeLight_PAGE81() \
(ant_BikeLight_page81_data_t) \
{ \
.sw_revision_minor = UINT8_MAX, \
.sw_revision_major = UINT8_MAX, \
.serial_number = UINT32_MAX, \
}
#define ANT_BikeLight_page81(sw_major_rev, sw_minor_rev, seril_no) \
(ant_BikeLight_page81_data_t) \
{ \
.sw_revision_minor = (sw_minor_rev), \
.sw_revision_major = (sw_major_rev), \
.serial_number = (seril_no), \
}
void ant_BikeLight_page_81_encode(uint8_t *p_page_buffer,
ant_BikeLight_page81_data_t const *p_page_data);
void ant_BikeLight_page_81_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page81_data_t *p_page_data);
#endif // ANT_BIKELIGHT_PAGE_81_H__
/** @} */