Generic Data Page 70 allows an ANT+ device to request a specific data page from another ANT+ device. In this device profile:
• Page 70 allows the controller to request a specific data page from an ANT+ bike light. The requested data page shall be sent using a recognized MES DROP by the ANT+ controller and shall be formatted as shown in Table 7-45.
• As described in Section 7.3.3.2, the primary indicator uses the shared format of Page 70 to request the data page for the secondary indicator. It is recommended that this page be sent as a broadcast message (to reduce power consumption), but acknowledgement messages are also allowed. The format of the request data page shall be as shown in Table 7-46.
7.22.3.1 Light Index
When a data page containing a light index field is requested, the light index field should be used to specify the light index, otherwise it should be set to invalid.
7.22.3.2 Descriptor Bytes 1 & 2
The Descriptor Bytes field is used to describe the requested subpage.
Descriptor byte 1 should be used to specify:
• Minor light index when requesting a data page containing a minor light index (1-4, 6, 16, 17)
• Mode number, when requesting data Page 5 – Mode Description
Otherwise set to invalid.
Descriptor byte 2 should be set to invalid.
7.22.3.3 Request transmission response
ANT+ Bike Lights SHOULD be able to support all requested transport response types, however, the ANT+ Bike Light Device Profile further specifies that ANT+ controllers MAY only request broadcast messages.
Note that some ANT+ bike lights do not support sending acknowledged messages and will respond with a broadcast message regardless of the requested response type.
ANT+ bike lights only need to support a maximum of two transmit response repetitions to minimize polling memory requirements on a shared network.
For more details on the Request Data page and possible Request Transport response types, see the ANT+ Common Pages documentation.
/* 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_70.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 request data page (0x46) Page 70 data layout structure. */
typedef struct
{
uint8_t Light_Index; //Light index 0-63
uint8_t reserved; //reserved
uint8_t descriptor[2]; //Descriptor: allows specifying data within the requested data page. Valid values: 0–254 Invalid: 255 (0xFF)
uint8_t req_trans_response_Repetitions: 6; //Requested data page, test that needs to be sent.
uint8_t req_trans_response_MSB: 1; //Requested data page, whether to wait for sending successfully
uint8_t req_page_number; //Requested page number
uint8_t command_type; /*Value for requesting data page = 1 (0x01) Value for requesting ANT-FS session = 2 (0x02)
The value of the slave request data page = 3 (0x03) The value of the request data page set = 4 (0x04) */
} ant_BikeLight_page70_data_layout_t;
//static void page70_data_log(ant_BikeLight_page70_data_t const *p_page_data)
//{
SEGGER_RTT_printf(0, "command_type: %drn", (uint8_t)p_page_data->command_type);
SEGGER_RTT_printf(0, "req_page_number: %drn", (uint8_t)p_page_data->req_page_number);
//}
void ant_BikeLight_page_70_encode(uint8_t *p_page_buffer,
ant_BikeLight_page70_data_t const *p_page_data)
{
ant_BikeLight_page70_data_layout_t *p_outcoming_data = (ant_BikeLight_page70_data_layout_t *)p_page_buffer;
memcpy(p_outcoming_data, p_page_data, sizeof(ant_BikeLight_page70_data_layout_t));
// ANT_PAGE_NEW = 0;
// page70_data_log(p_page_data);
}
void ant_BikeLight_page_70_decode(uint8_t const *p_page_buffer,
ant_BikeLight_page70_data_t *p_page_data,
uint8_t const Channel)
{
ant_BikeLight_page70_data_layout_t const *p_incoming_data = (ant_BikeLight_page70_data_layout_t *)p_page_buffer;
if (Channel == 0)
{
if (p_incoming_data->Light_Index == 0 || p_incoming_data->Light_Index == m_ant_BikeLight.page_1.Light_Index) //Judge the light index
{
p_page_data->descriptor[0] = p_incoming_data->descriptor[0];
p_page_data->descriptor[1] = p_incoming_data->descriptor[1];
p_page_data->req_page_number = p_incoming_data->req_page_number;
p_page_data->command_type = (ant_page70_command_t)p_incoming_data->command_type;
if (p_page_data->command_type == 1) //Request data page
{
if (p_page_data->req_page_number == 1 || p_page_data->req_page_number == 2 ||
p_page_data->req_page_number == 80 || p_page_data->req_page_number == 81 || p_page_data->req_page_number == 19)
{
switch (p_page_data->req_page_number)
{
case 1:
ANT_PAGE_NEW = 100;
break;
case 2:
ANT_PAGE_NEW = 0;
break;
case 80:
ANT_PAGE_NEW = 1;
break;
case 81:
ANT_PAGE_NEW = 2;
break;
case 19:
ANT_PAGE_NEW = 3;
break;
default:
break;
}
}
else
{
ANT_PAGE_NEW = p_page_data->req_page_number; //Send the specified page
}
}
m_ant_BikeLight.page_1.Last_Sequence_Number = 70;
/*Prevent low power consumption during broadcasting*/
LowPower_Tmr = 0;
System_shutdown_count = 0;
}
else//It is not your own thing, forward it
{
if (p_incoming_data->Light_Index == 0xff)
{
LowPower_Tmr = 0;
System_shutdown_count = 0;
}
if (p_incoming_data->Light_Index != 0xff && ANT_Relay_New_Share_Page != 32)
{
memcpy(ANT_message_payload_Shared_Wait, p_incoming_data, sizeof(ant_BikeLight_page70_data_layout_t)); //Copy non-self content to the shared channel buffer
ANT_Relay_New_Share_Page = 70; //Send the specified page
ANT_Shared_Channel_sens_message_encode(ANT_message_payload_Shared_Wait, ANT_Relay_New_Share_Page);//Reorganize the command
}
}
}
else if (Channel == BikeLight_Shared_CHANNEL_NUMBER) //The request sent from the shared channel needs to forward the specified content to the broadcast channel
{
// SEGGER_RTT_printf(0, "[channel1_MY]---ID:%d %d req_page_number:%dnr",
// m_ant_BikeLight.page_1.Light_Index,p_incoming_data->Light_Index, p_page_data->req_page_number); //c test
/*Prevent low power consumption during broadcasting*/
LowPower_Tmr = 0;
System_shutdown_count = 0;
if (p_incoming_data->Light_Index == m_ant_BikeLight.page_1.Light_Index) //Judge the light index
{
p_page_data->descriptor[0] = p_incoming_data->descriptor[0];
p_page_data->descriptor[1] = p_incoming_data->descriptor[1];
p_page_data->req_page_number = p_incoming_data->req_page_number;
p_page_data->command_type = (ant_page70_command_t)p_incoming_data->command_type;
if (p_page_data->command_type == 1) //Request data page
{
if (p_page_data->req_page_number == 1 || p_page_data->req_page_number == 2 || p_page_data->req_page_number == 19) //
{
if (ANT_Relay_New_Share_Page == 2 || ANT_Relay_New_Share_Page == 19)
{
return;
}
switch (p_page_data->req_page_number)
{
case 1:
memcpy(ANT_message_payload_Shared_Wait, &(m_ant_BikeLight.page_1), sizeof(ant_BikeLight_page1_data_t)); //Copy non-self content to the shared channel buffer
break;
case 2:
memcpy(ANT_message_payload_Shared_Wait, &(m_ant_BikeLight.page_2), sizeof(ant_BikeLight_page2_data_t)); //Copy non-self content to the shared channel buffer
break;
case 19:
memcpy(ANT_message_payload_Shared_Wait, &(m_ant_BikeLight.page_19), sizeof(ant_BikeLight_page19_data_t)); //Copy non-self content to the shared channel buffer
break;
default:
break;
}
ANT_Relay_New_Share_Page = p_page_data->req_page_number; //Send the specified page
ANT_Shared_Channel_sens_message_encode(ANT_message_payload_Shared_Wait, ANT_Relay_New_Share_Page);//Reorganize the command
//err_code = sd_ant_broadcast_message_tx(BikeLight_Shared_CHANNEL_NUMBER, 8, ANT_message_payload_Shared); //Send sharing command
// if (p_page_data->req_page_number == 2)
// {
// SEGGER_RTT_printf(0, "[channel1_MY]---TX page_%02d: %02X %02X %02X %02X %02X %02X %02X %02Xnr",
// ANT_Relay_New_Share_Page, Replace_Buff(ANT_message_payload_Shared_Wait)); //Print and send sharing command
// }
}
}
}
}
Previous article:[ANT+][nrf51422][s210] Bicycle Light General Page 81 (0x51) – Product Information
Next article:[ANT+][nrf51422][s210] Minimum data page requirements for bicycle lights
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- "In-depth understanding of BootLoader", introducing the development theory, process and examples of BootLoader
- Weekly review information is here~
- Analysis of DSP2407's frame pointer (FP) and stack pointer (SP)
- msp430 MCU rc522 radio frequency program and circuit diagram
- Shenzhen is so beautiful
- New mpy board
- EEWORLD University Hall----FPGA Design Skills and Specifications
- C8051F040 has a CAN interrupt, how to determine which mailbox caused the interrupt
- [RISC-V MCU CH32V103 Review] + EXTI interrupt input switch OLED
- TinyGo, the GO language for microcontrollers