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

LiSun

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

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

数据页16是当处于连接状态时从ANT+自行车灯广播的数据页之一。所有主灯应根据控制器的要求发送本页。作为数据页旋转的一部分,该页可以可选地包括为从ANT+自行车灯广播的主要数据页之一。此信息中的所有字段应按表7-25所述进行设置。
在这里插入图片描述

7.11.1 制造商ID
当前制造商ID值列表可在FIT.xls配置文件中找到(可从FIT SDK中获得,网址为www.thisisant.com)。新制造商必须成为ANT+联盟的成员才能被添加到此列表中;有关详细信息,请通过antalliance@thisisant.com与ANT+联盟联系。值255(0x00FF)已保留作为开发ID,尚未被分配值的制造商可以使用它

/* 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_16.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 互联灯的制造商信息 第16页数据布局结构. */
typedef struct
{
    uint8_t Light_Index;                             //灯光索引 2-63

    uint8_t Reserved;                                //保留
    uint8_t HW_Revision;                             //硬件修订

    uint8_t ManufacturerID_LSB;                      //制造商ID LSB
    uint8_t ManufacturerID_MSB;                      //制造商ID MSB

    uint8_t Model_Number_LSB;                        //设备型号LSB
    uint8_t Model_Number_MSB;                        //设备型号MSB

} ant_BikeLight_page16_data_layout_t;


static void page16_data_log(ant_BikeLight_page16_data_t const *p_page_data)
{
//    SEGGER_RTT_printf(0, "Light_Index:             %d\r\n", (uint8_t)p_page_data->Light_Index);
//    SEGGER_RTT_printf(0, "AutoIntensityMode:       %d\r\n", (uint8_t)p_page_data->Light_Properties_AutoIntensityMode);
//    SEGGER_RTT_printf(0, "Beam:                    %d\r\n", (uint8_t)p_page_data->Light_Properties_Beam);
//    SEGGER_RTT_printf(0, "SupportedModes:          %d\r\n", (uint8_t)p_page_data->Light_Properties_SupportedModes);
//    SEGGER_RTT_printf(0, "Battery_Capacity:        %d\r\n", (uint8_t)p_page_data->Battery_Capacity);
}


void ant_BikeLight_page_16_encode(uint8_t                     *p_page_buffer,
                                  ant_BikeLight_page16_data_t const *p_page_data)
{
    ant_BikeLight_page16_data_layout_t *p_outcoming_data = (ant_BikeLight_page16_data_layout_t *)p_page_buffer;

    p_outcoming_data->Light_Index                = p_page_data->Light_Index;
    p_outcoming_data->HW_Revision                = p_page_data->HW_Revision;
    p_outcoming_data->ManufacturerID_LSB         = p_page_data->ManufacturerID_LSB;
    p_outcoming_data->ManufacturerID_MSB         = p_page_data->ManufacturerID_MSB;
    p_outcoming_data->Model_Number_LSB           = p_page_data->Model_Number_LSB;
    p_outcoming_data->Model_Number_MSB           = p_page_data->Model_Number_MSB;
    ANT_PAGE_NEW = 0;
    page16_data_log(p_page_data);
}


void ant_BikeLight_page_16_decode(uint8_t const              *p_page_buffer,
                                  ant_BikeLight_page16_data_t *p_page_data)
{
    ant_BikeLight_page16_data_layout_t const *p_incoming_data =
        (ant_BikeLight_page16_data_layout_t *)p_page_buffer;

    p_page_data->Light_Index                = p_incoming_data->Light_Index;
    p_page_data->HW_Revision                = p_incoming_data->HW_Revision;
    p_page_data->ManufacturerID_LSB         = p_incoming_data->ManufacturerID_LSB;
    p_page_data->ManufacturerID_MSB         = p_incoming_data->ManufacturerID_MSB;
    p_page_data->Model_Number_LSB           = p_incoming_data->Model_Number_LSB;
    p_page_data->Model_Number_MSB           = p_incoming_data->Model_Number_MSB;

    /*处理信息*/
    page16_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_16_H__
#define ANT_BIKELIGHT_PAGE_16_H__

#include <stdint.h>

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

    uint8_t Reserved;                                //保留
    uint8_t HW_Revision;                             //硬件修订

    uint8_t ManufacturerID_LSB;                      //制造商ID LSB
    uint8_t ManufacturerID_MSB;                      //制造商ID MSB

    uint8_t Model_Number_LSB;                        //设备型号LSB
    uint8_t Model_Number_MSB;                        //设备型号MSB
} ant_BikeLight_page16_data_t;


#define DEFAULT_ANT_BikeLight_PAGE16()           \
    (ant_BikeLight_page16_data_t)                \
    {                                            \
        .Light_Index                     = 2,    \
        .Reserved                        = 0,    \
        .HW_Revision                     = 95,   \
        .ManufacturerID_LSB              = 10,   \
        .ManufacturerID_MSB              = 0,    \
        .Model_Number_LSB                = 20,   \
        .Model_Number_MSB                = 0,    \
    }


void ant_BikeLight_page_16_encode(uint8_t                          *p_page_buffer,
                                  ant_BikeLight_page16_data_t const *p_page_data);


void ant_BikeLight_page_16_decode(uint8_t const              *p_page_buffer,
                                  ant_BikeLight_page16_data_t *p_page_data);

#endif // ANT_BIKELIGHT_PAGE_16_H__
/** @} */

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