Data Page 33 is the command page sent from an ANT+ controller to an ANT+ bike light to initiate a connection with a new ANT+ bike light. The command includes the light index and settings that should be used in the connected state, as well as the channel ID variables (i.e. device number and transmission type) to search for (if applicable). This command should be sent as a confirmation message from the ANT+ controller.
All fields in this message shall be set as described in Table 7-34.
/*********************************************
Function name: ant_BikeLight_SHARED_MASTER_Init
Function: Shared channel initialization
Form parameter: ch--> 0--main light shared channel (can send and receive) 1--secondary light shared channel (only receive)
return value:
Remark:
Author: Xue Jianqiang
Time: 2020/02/27
use:
**********************************************/
void ant_BikeLight_SHARED_MASTER_Init(void)
{
uint32_t err_code = 0;
/*Shared channel*/
if (SystemInit_Type.ANT_SHARED_MASTER == 0)
{
err_code = sd_ant_channel_unassign(BikeLight_Shared_CHANNEL_NUMBER);
SEGGER_RTT_printf(0, "ANT BikeLight Shared channel_unassign %u close %dnr", BikeLight_Shared_CHANNEL_NUMBER, err_code);
if ( m_ant_BikeLight . page_33 . Light_Index_Set == 1 ) / / ID = 1 , one
{
ant_channel_Shared.channel_type = BikeLight_SENS_CHANNEL_TYPE_Shared;
ant_channel_Shared.device_number = BikeLight_DEVICE_NUMBER; //Set the ANT device number to the MAC address
//ant_channel_Shared.device_number = NRF_FICR->DEVICEADDR[0]; //Set the ANT device number to the MAC address
}
else if (m_ant_BikeLight.page_33.Light_Index_Set > 1)//ID>1,副灯
{
ant_channel_Shared.channel_type = BikeLight_DISP_CHANNEL_TYPE_Shared;
ant_channel_Shared.device_number = BikeLight_DEVICE_NUMBER; //Set the ANT device number to the MAC address
//ant_channel_Shared.device_number = NRF_FICR->DEVICEADDR[0]; //Set the ANT device number to the MAC address
}
else
{
SEGGER_RTT_printf(0, "Shared_open_fail,not Light_Index!!! %drn", m_ant_BikeLight.page_33.Light_Index_Set);
return;
}
// m_ant_BikeLight_Shared.channel_number = BikeLight_Shared_CHANNEL_NUMBER; //通道号
ant_channel_Shared.channel_number = BikeLight_Shared_CHANNEL_NUMBER;//通道号
ant_channel_Shared.ext_assign = BikeLight_EXT_ASSIGN; //ANT external assignment.
ant_channel_Shared.rf_freq = BikeLight_ANTPLUS_RF_FREQ; //frequency
ant_channel_Shared.transmission_type = m_ant_BikeLight.page_33.Transmission_Type; //Transmission type of the main light
ant_channel_Shared.device_type = BikeLight_DEVICE_TYPE_Shared; //Device type
ant_channel_Shared.device_number = m_ant_BikeLight.page_33.DeviceNumber_MSB << 8 | m_ant_BikeLight.page_33.DeviceNumber_LSB;
ant_channel_Shared.channel_period = BikeLight_MSG_PERIOD_8Hz; //Message period
ant_channel_Shared.network_number = 0;
err_code = ant_channel_init(&ant_channel_Shared);
APP_ERROR_CHECK(err_code);
err_code = ant_BikeLight_Shared_open(&ant_channel_Shared);
SEGGER_RTT_printf(0, "Shared_open,err_code=%02X device_number:%d transmission_type:%drn", err_code, ant_channel_Shared.device_number, ant_channel_Shared.transmission_type);
APP_ERROR_CHECK(err_code);
}
}
7.17.1 Setting the Light Index
The Light Index Settings fields should be interpreted as follows for unconnected lights (i.e. lights that currently have a light index of 0):
ANT+ bike lights should have their light index set to the value specified in the Light Index Settings field.
• If the Light Index is set to 1, the ANT+ bike light is designated as the Master light for the network and should turn on the shared Master channel as detailed in section 6.5.
• Alternatively, if the light index is set to 2 – 63, the ANT+ bike light is assigned as an auxiliary light and the shared slave channel should be turned on as described in section 6.4.
Note that ANT+ controllers should assign light indices in order, starting with the first fill light having its light index set to 2. For any fill light in the shared network, the light index setting field must not be more than one greater than the "Fll Light" field in the connect command sent to the master light.
Light index 255 (0xFF) should only be used when controlling unconnected lights, such as setting the light type or light state settings, without changing the light index or affecting the channel the light turns on.
The light index settings fields should be interpreted as follows for connected rays (i.e. lights with current light index > 0):
• ANT+ bike lights must not change their light index.
• If the light index is set to 1, the connect command only applies to the main light.
• If the light index is set to 2 – 63, the connect command will apply to the fill light with the specified light index. If the main light receives this command, it should forward it to the specified fill light.
Note that connected lights should ignore connect commands with a light index of 255 (0xFF).
7.17.2 # Secondary Light
This field indicates the number of fill lights that will be connected to the shared channel so that the master light knows which light index to poll. For example, if the number of fill lights is 5, the master light should poll light indexes 2-6.
7.17.3 Controller ID
The Controller ID field should be filled by the ANT+ controller with the LSB of its serial number. ANT+ controllers without a serial number should assign a fixed value to this field.
7.17.4 Sub-lamp index
The Sublight Index field indicates the sublight to which the Light State and Light Type settings should be applied. If the Sublight Index is set to 0, the commanded light settings should only be applied to the main ANT+ bike light and not any sublights.
This field should not be set to the values 5, 6, or 7.
7.17.5 Lighting status settings
ANT+ controllers can use the Light State settings field to command ANT+ bike lights to turn off, flash, or turn on the beam (steady). ANT+ bike lights should respond to commands immediately.
Note that the Light State Setup field provides an ANT+ controller with limited control over the state of an ANT+ bike light. This feature can be used during network configuration to allow basic control of an ANT+ bike light without requiring the ANT+ controller to get full mode information from the bike light.
An ANT+ bike light that receives a "blink" command should set itself to whatever mode the light is blinking in.
An ANT+ bike light that receives a "steady on" command should set itself to any mode with a steady light brightness.
7.17.6 Lighting type settings
ANT+ controllers should use this field to configure their ANT+ bike lights as needed. ANT+ controllers should not attempt to set an ANT+ bike light's light type to an unsupported type. ANT+ bike lights should configure their light type as requested. ANT+ bike lights should ignore any request to set their light type to something unsupported. .
7.17.7 Device Number and Transfer Type Fields
The Device Number and Transmission Type fields contain the Channel ID parameters for the master light. These values should be included as valid values whenever the light metrics are set to a value between 2 and 63. ANT+ bicycle lights should use the parameters specified in Table 7-37 and Table 7-38.
Note that when the light index is set to 0, the Device Number and Transfer Type fields should be set to invalid.
/* 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_33.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 connection command (0x21) Page 33 data layout structure. */
typedef struct
{
uint8_t Light_Index_Set; //Light index setting [1-63]
uint8_t Secondary_Lights; //Auxiliary lights [1-62] Invalid: 255 (0xFF)
uint8_t Controller_ID; //Controller ID [0-255]
uint8_t SubLight_Index : 3; //Sublight index [0-2] 5-7: Reserved, do not use
uint8_t Light_State_Setting : 2; //Light state setting [3-4] 0: Invalid 1: Turn off 2: Flashing 3: Always on
uint8_t Light_Type_Setting : 3; //Light type setting [5-7] 0: Headlight 2: Taillight 3: Signal light 4: Signal light - left 5: Signal light - right
uint8_t DeviceNumber_LSB; //The device number LSB of the main light
uint8_t DeviceNumber_MSB; //MSB of the device number of the main light
uint8_t Transmission_Type; //Transmission type of the main light [1-255]
} ant_BikeLight_page33_data_layout_t;
static void page33_data_log(ant_BikeLight_page33_data_t const *p_page_data)
{
SEGGER_RTT_printf(0, "page33:Light_Index_Set: %drn", (uint8_t)p_page_data->Light_Index_Set);
}
void ant_BikeLight_page_33_encode(uint8_t *p_page_buffer,
ant_BikeLight_page33_data_t const *p_page_data)
{
// ant_BikeLight_page33_data_layout_t *p_outcoming_data = (ant_BikeLight_page33_data_layout_t *)p_page_buffer;
// p_outcoming_data->Light_Index_Set = p_page_data->Light_Index_Set;
// p_outcoming_data->Secondary_Lights = p_page_data->Secondary_Lights;
// p_outcoming_data->Controller_ID = p_page_data->Controller_ID;
// p_outcoming_data->SubLight_Index = p_page_data->SubLight_Index;
// p_outcoming_data->Light_State_Setting = p_page_data->Light_State_Setting;
// p_outcoming_data->Light_Type_Setting = p_page_data->Light_Type_Setting;
// p_outcoming_data->DeviceNumber_LSB = p_page_data->DeviceNumber_LSB;
Previous article:[ANT+][nrf51422][s210] Bicycle Light Data Page 35 - Channel Cycle Extraction
Next article:[ANT+][nrf51422][s210] Bicycle Lights Generic Page 80 (0x50) – Manufacturer Identification
Recommended ReadingLatest update time:2024-11-23 01:43
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- DAC8552 of MSP430F5529 microcontroller
- New preferential policies for the semiconductor industry
- Several important questions about Zigbee
- CY8CKIT-149 PSoC 4100S PLUS PROTOTYPING KIT Resources
- Have any students participated in previous TI invitational competitions? Is it necessary to use a TI board as the development board?
- Embedded people are blessed, these four lines of code are enough to change your life
- STM32 Tmall flagship store bought several microcontrollers
- How to modify the circuit if the simulation results are not available?
- [ESP32-Audio-Kit Audio Development Board] - 1: Blink (esp-idf)
- Award-winning live broadcast: Application of Infineon gate driver chips and corresponding solutions of Avnet are now open for registration...