记录开发过程中的问题和功能。毕se代做,小家电开发。 收徒带做企业级项目,帮助毕业生和转行人员顺利找到工作。

LiSun

记录开发过程中的问题和功能。毕se代做,小家电开发。 收徒带做企业级项目,帮助毕业生和转行人员顺利找到工作。

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

在这里插入图片描述

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

7.9.2 支持的自定义模式位字段
该位字段用于指示每个子灯支持哪些自定义模式,如下表所述。
在这里插入图片描述

/* 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__
/** @} */

posted on 2022-08-13 11:01  嵌入式单片机实验室  阅读(61)  评论(0)    收藏  举报
记录开发过程中的问题和功能。毕se代做,小家电开发。 收徒带做企业级项目,帮助毕业生和转行人员顺利找到工作。