首页 > 其他分享 >ANT+ 自行车车灯 数据页面6–辅助灯光模式支持(0x06)

ANT+ 自行车车灯 数据页面6–辅助灯光模式支持(0x06)

时间:2022-10-31 21:00:44浏览次数:44  
标签:ant 0x06 BikeLight uint8 ANT page6 data page 车灯


ANT+控制器可以请求此页面(如5.3节中所述),以确定每个子灯支持哪些自定义模式。当ANT+控制器请求时,数据页6从ANT+自行车灯广播。任何带有副灯的ANT+自行车灯均应支持此页面。该消息中的所有字段均应按照表7-22中的说明进行设置。

ANT+ 自行车车灯 数据页面6–辅助灯光模式支持(0x06)_字段

7.9.1 子灯索引
此页面中的数据描述了带有指示的子灯索引的子灯的功能。该字段不得设置为值0、5、6或7。

7.9.2 支持的自定义模式位字段

该位字段用于指示每个子灯支持哪些自定义模式,如下表所述。

ANT+ 自行车车灯 数据页面6–辅助灯光模式支持(0x06)_字段_02

/* 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_6.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 辅助灯光模式支持 第6页数据布局结构. */
typedef struct
{
uint8_t Light_Index; //灯光索引 0-63

uint8_t Sublight_Index : 3; //灯光索引 1-4
uint8_t Reserved : 5; //保留

uint8_t Reserved1[3]; //保留

uint8_t LSB; //支持的标准模式位字段LSB(上面有注释)

uint8_t MSB: 7; //支持的标准模式位字段MSB(上面有注释)
uint8_t BrakeLightLight: 1; //刹车灯光:0--不支持 1支持

} ant_BikeLight_page6_data_layout_t;


static void page6_data_log(ant_BikeLight_page6_data_t const *p_page_data)
{
// SEGGER_RTT_printf(0, "Light_Index: %d\r\n", (uint8_t)p_page_data->Light_Index);

}


void ant_BikeLight_page_6_encode(uint8_t *p_page_buffer,
ant_BikeLight_page6_data_t const *p_page_data)
{
ant_BikeLight_page6_data_layout_t *p_outcoming_data = (ant_BikeLight_page6_data_layout_t *)p_page_buffer;

p_outcoming_data->Light_Index = p_page_data->Light_Index;


page6_data_log(p_page_data);
}


void ant_BikeLight_page_6_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page6_data_t *p_page_data)
{
ant_BikeLight_page6_data_layout_t const *p_incoming_data =
(ant_BikeLight_page6_data_layout_t *)p_page_buffer;

p_page_data->Light_Index = p_incoming_data->Light_Index;

page6_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_6_H__
#define ANT_BIKELIGHT_PAGE_6_H__

#include <stdint.h>

typedef struct
{
uint8_t Light_Index; //灯光索引 0-63

uint8_t Sublight_Index : 3; //灯光索引 1-4
uint8_t Reserved : 5; //保留

uint8_t Reserved1[3]; //保留

uint8_t LSB; //支持的标准模式位字段LSB(上面有注释)

uint8_t MSB: 7; //支持的标准模式位字段MSB(上面有注释)
uint8_t BrakeLightLight: 1; //刹车灯光:0--不支持 1支持
} ant_BikeLight_page6_data_t;


#define DEFAULT_ANT_BikeLight_PAGE6() \
(ant_BikeLight_page6_data_t) \
{ \
.Light_Index = 0, \
.Sublight_Index = 1, \
.LSB = 0xff, \
.MSB = 0, \
.BrakeLightLight = 0, \
}


void ant_BikeLight_page_6_encode(uint8_t *p_page_buffer,
ant_BikeLight_page6_data_t const *p_page_data);


void ant_BikeLight_page_6_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page6_data_t *p_page_data);

#endif // ANT_BIKELIGHT_PAGE_6_H__
/** @} */


标签:ant,0x06,BikeLight,uint8,ANT,page6,data,page,车灯
From: https://blog.51cto.com/xuejianqiang/5811279

相关文章