首页 > 其他分享 >ANT+ 自行车车灯 数据页18页-主光的频道ID(0x12)

ANT+ 自行车车灯 数据页18页-主光的频道ID(0x12)

时间:2022-10-31 21:00:08浏览次数:45  
标签:ant -- 18 BikeLight 0x12 支持 ANT data page


数据页18应在ANT+控制器的请求下发送,并且可以选择性地包括在连接状态下作为从ANT+自行车灯广播的主要数据页之一。这个数据页允许控制器发现并连接到已经存在的网络,如5.2.2.1节中所描述的。此信息中的所有字段应按表7-29所述进行设置。

ANT+ 自行车车灯 数据页18页-主光的频道ID(0x12)_#include

7.13.1. 设备编号
此字段指示来自主灯光通道ID的2字节设备号。

7.13.2. 传输类型
来自主光的信道ID的8位广播信道传输类型(即包括扩展设备号的上半字节)。

/* 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_18.h"
#include "ant_BikeLight_utils.h"
#include "ant_BikeLight_page_logger.h"
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
#include "main.h"

/*************Light_State_ModeNum***支持的标准模式位字段************************
LSB:
0 保留以备将来使用。设置为0
1 常亮:81 - 100%亮度 0--不支持 1--支持
2 常亮:61 - 80%亮度 0--不支持 1--支持
3 常亮:41 - 60%亮度 0--不支持 1--支持
4 常亮:21 - 40%亮度 0--不支持 1--支持
5 常亮: 0 - 20%亮度 0--不支持 1--支持
6 慢闪烁 0--不支持 1--支持
7 快速闪烁 0--不支持 1--支持

MSB:
0 随机闪烁 0--不支持 1--支持
1 自动 0--不支持 1--支持
2 左转信号灯(自动取消) 0--不支持 1--支持
3 左转信号灯(持续) 0--不支持 1--支持
4 右转信号灯(自动取消) 0--不支持 1--支持
5 右转信号灯(持续) 0--不支持 1--支持
6 危险指示灯(左右指示灯连续闪烁) 0--不支持 1--支持
**********************************/
/**@brief BikeLight 主灯的通道ID(0x12) 第18页数据布局结构. 【可选项】【ping命令】 一般用于做心跳包*/
typedef struct
{
uint8_t Reserved[4]; //保留

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

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

uint8_t Supported_Light_Types; //支持的灯光类型 0:前灯 2:尾灯
} ant_BikeLight_page18_data_layout_t;


static void page18_data_log(ant_BikeLight_page18_data_t const *p_page_data)
{
// SEGGER_RTT_printf(0, "page18:is\r\n");

}


void ant_BikeLight_page_18_encode(uint8_t *p_page_buffer,
ant_BikeLight_page18_data_t const *p_page_data)
{
ant_BikeLight_page18_data_layout_t *p_outcoming_data = (ant_BikeLight_page18_data_layout_t *)p_page_buffer;

p_outcoming_data->LSB = p_page_data->LSB;
p_outcoming_data->MSB = p_page_data->MSB;
p_outcoming_data->BrakeLightLight = p_page_data->BrakeLightLight;
p_outcoming_data->Supported_Light_Types = p_page_data->Supported_Light_Types;

ANT_PAGE_NEW = 0;
page18_data_log(p_page_data);
}


void ant_BikeLight_page_18_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page18_data_t *p_page_data)
{
// ant_BikeLight_page18_data_layout_t const *p_incoming_data =
// (ant_BikeLight_page18_data_layout_t *)p_page_buffer;

// p_page_data->LSB = p_incoming_data->LSB;
// p_page_data->MSB = p_incoming_data->MSB;
// p_page_data->BrakeLightLight = p_incoming_data->BrakeLightLight;
// p_page_data->Supported_Light_Types = p_incoming_data->Supported_Light_Types;

/*处理信息*/
System_shutdown_count = 0;
LowPower_Tmr = 0; //清除低功耗累计时间
SystemReg.RunningState = 0;
/*不可以转发到共享通道,只做主灯的呼吸包*/
}
/* 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_18_H__
#define ANT_BIKELIGHT_PAGE_18_H__

#include <stdint.h>
/*************Light_State_ModeNum***支持的标准模式位字段************************
LSB:
0 保留以备将来使用。设置为0
1 常亮:81 - 100%亮度 0--不支持 1--支持
2 常亮:61 - 80%亮度 0--不支持 1--支持
3 常亮:41 - 60%亮度 0--不支持 1--支持
4 常亮:21 - 40%亮度 0--不支持 1--支持
5 常亮: 0 - 20%亮度 0--不支持 1--支持
6 慢闪烁 0--不支持 1--支持
7 快速闪烁 0--不支持 1--支持

MSB:
0 随机闪烁 0--不支持 1--支持
1 自动 0--不支持 1--支持
2 左转信号灯(自动取消) 0--不支持 1--支持
3 左转信号灯(持续) 0--不支持 1--支持
4 右转信号灯(自动取消) 0--不支持 1--支持
5 右转信号灯(持续) 0--不支持 1--支持
6 危险指示灯(左右指示灯连续闪烁) 0--不支持 1--支持
**********************************/
typedef struct
{
uint8_t Reserved[4]; //保留

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

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

uint8_t Supported_Light_Types; //支持的灯光类型 0:前灯 2:尾灯

} ant_BikeLight_page18_data_t;


#define DEFAULT_ANT_BikeLight_PAGE18() \
(ant_BikeLight_page18_data_t) \
{ \
.LSB = 0xFF, \
.MSB = 0xFE, \
.BrakeLightLight = 0, \
.Supported_Light_Types = 0, \
}


void ant_BikeLight_page_18_encode(uint8_t *p_page_buffer,
ant_BikeLight_page18_data_t const *p_page_data);


void ant_BikeLight_page_18_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page18_data_t *p_page_data);

#endif // ANT_BIKELIGHT_PAGE_18_H__
/** @} */


标签:ant,--,18,BikeLight,0x12,支持,ANT,data,page
From: https://blog.51cto.com/xuejianqiang/5811282

相关文章