xref: /btstack/chipset/cc256x/ant_cmd.h (revision 75a994c4ca66bdd844ab093e82c3abfacd81828f)
1*75a994c4SMatthias Ringwald /*
2*75a994c4SMatthias Ringwald  * This software is subject to the ANT+ Shared Source License
3*75a994c4SMatthias Ringwald  * www.thisisant.com/developer/ant/licensing
4*75a994c4SMatthias Ringwald  *
5*75a994c4SMatthias Ringwald  * Copyright © Dynastream Innovations,
6*75a994c4SMatthias Ringwald  * Inc. 2012 All rights reserved.
7*75a994c4SMatthias Ringwald  *
8*75a994c4SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
9*75a994c4SMatthias Ringwald  * modification, are permitted provided that the following conditions are met:
10*75a994c4SMatthias Ringwald  *
11*75a994c4SMatthias Ringwald  * Redistributions of source code must retain the above copyright notice, this
12*75a994c4SMatthias Ringwald  * list of conditions and the following disclaimer. Redistributions in binary
13*75a994c4SMatthias Ringwald  * form must reproduce the above copyright notice, this list of conditions and
14*75a994c4SMatthias Ringwald  * the following disclaimer in the documentation and/or other materials provided
15*75a994c4SMatthias Ringwald  * with the distribution. Neither the name of Dynastream nor the names of its
16*75a994c4SMatthias Ringwald  * contributors may be used to endorse or promote products derived from this
17*75a994c4SMatthias Ringwald  * software without specific prior written permission. The following actions are
18*75a994c4SMatthias Ringwald  * prohibited:
19*75a994c4SMatthias Ringwald  *
20*75a994c4SMatthias Ringwald  * Redistribution of source code containing the ANT+ Network Key. The ANT+
21*75a994c4SMatthias Ringwald  * Network Key is available to ANT+ Adopters. Please refer to
22*75a994c4SMatthias Ringwald  * http://thisisant.com to become an ANT+ Adopter and access the key. Reverse
23*75a994c4SMatthias Ringwald  * engineering, decompilation, and/or disassembly of software provided in binary
24*75a994c4SMatthias Ringwald  * form under this license. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
25*75a994c4SMatthias Ringwald  * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
26*75a994c4SMatthias Ringwald  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
27*75a994c4SMatthias Ringwald  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28*75a994c4SMatthias Ringwald  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29*75a994c4SMatthias Ringwald  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30*75a994c4SMatthias Ringwald  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31*75a994c4SMatthias Ringwald  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
32*75a994c4SMatthias Ringwald  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33*75a994c4SMatthias Ringwald  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34*75a994c4SMatthias Ringwald  * POSSIBILITY OF SUCH DAMAGE.
35*75a994c4SMatthias Ringwald  *
36*75a994c4SMatthias Ringwald  */
37*75a994c4SMatthias Ringwald 
38*75a994c4SMatthias Ringwald #ifndef __ANT_CMDS_H
39*75a994c4SMatthias Ringwald #define __ANT_CMDS_H
40*75a994c4SMatthias Ringwald 
41*75a994c4SMatthias Ringwald #include <stdint.h>
42*75a994c4SMatthias Ringwald #include "hci_cmd.h"
43*75a994c4SMatthias Ringwald 
44*75a994c4SMatthias Ringwald #if defined __cplusplus
45*75a994c4SMatthias Ringwald extern "C" {
46*75a994c4SMatthias Ringwald #endif
47*75a994c4SMatthias Ringwald 
48*75a994c4SMatthias Ringwald typedef uint8_t UCHAR;
49*75a994c4SMatthias Ringwald 
50*75a994c4SMatthias Ringwald //////////////////////////////////////////////
51*75a994c4SMatthias Ringwald // Message IDs from antmessage.h
52*75a994c4SMatthias Ringwald //////////////////////////////////////////////
53*75a994c4SMatthias Ringwald #define MESG_INVALID_ID                      ((UCHAR)0x00)
54*75a994c4SMatthias Ringwald #define MESG_EVENT_ID                        ((UCHAR)0x01)
55*75a994c4SMatthias Ringwald 
56*75a994c4SMatthias Ringwald #define MESG_VERSION_ID                      ((UCHAR)0x3E)
57*75a994c4SMatthias Ringwald #define MESG_RESPONSE_EVENT_ID               ((UCHAR)0x40)
58*75a994c4SMatthias Ringwald 
59*75a994c4SMatthias Ringwald #define MESG_UNASSIGN_CHANNEL_ID             ((UCHAR)0x41)
60*75a994c4SMatthias Ringwald #define MESG_ASSIGN_CHANNEL_ID               ((UCHAR)0x42)
61*75a994c4SMatthias Ringwald #define MESG_CHANNEL_MESG_PERIOD_ID          ((UCHAR)0x43)
62*75a994c4SMatthias Ringwald #define MESG_CHANNEL_SEARCH_TIMEOUT_ID       ((UCHAR)0x44)
63*75a994c4SMatthias Ringwald #define MESG_CHANNEL_RADIO_FREQ_ID           ((UCHAR)0x45)
64*75a994c4SMatthias Ringwald #define MESG_NETWORK_KEY_ID                  ((UCHAR)0x46)
65*75a994c4SMatthias Ringwald #define MESG_RADIO_TX_POWER_ID               ((UCHAR)0x47)
66*75a994c4SMatthias Ringwald #define MESG_RADIO_CW_MODE_ID                ((UCHAR)0x48)
67*75a994c4SMatthias Ringwald #define MESG_SYSTEM_RESET_ID                 ((UCHAR)0x4A)
68*75a994c4SMatthias Ringwald #define MESG_OPEN_CHANNEL_ID                 ((UCHAR)0x4B)
69*75a994c4SMatthias Ringwald #define MESG_CLOSE_CHANNEL_ID                ((UCHAR)0x4C)
70*75a994c4SMatthias Ringwald #define MESG_REQUEST_ID                      ((UCHAR)0x4D)
71*75a994c4SMatthias Ringwald 
72*75a994c4SMatthias Ringwald #define MESG_BROADCAST_DATA_ID               ((UCHAR)0x4E)
73*75a994c4SMatthias Ringwald #define MESG_ACKNOWLEDGED_DATA_ID            ((UCHAR)0x4F)
74*75a994c4SMatthias Ringwald #define MESG_BURST_DATA_ID                   ((UCHAR)0x50)
75*75a994c4SMatthias Ringwald 
76*75a994c4SMatthias Ringwald #define MESG_CHANNEL_ID_ID                   ((UCHAR)0x51)
77*75a994c4SMatthias Ringwald #define MESG_CHANNEL_STATUS_ID               ((UCHAR)0x52)
78*75a994c4SMatthias Ringwald #define MESG_RADIO_CW_INIT_ID                ((UCHAR)0x53)
79*75a994c4SMatthias Ringwald #define MESG_CAPABILITIES_ID                 ((UCHAR)0x54)
80*75a994c4SMatthias Ringwald 
81*75a994c4SMatthias Ringwald #define MESG_STACKLIMIT_ID                   ((UCHAR)0x55)
82*75a994c4SMatthias Ringwald 
83*75a994c4SMatthias Ringwald #define MESG_SCRIPT_DATA_ID                  ((UCHAR)0x56)
84*75a994c4SMatthias Ringwald #define MESG_SCRIPT_CMD_ID                   ((UCHAR)0x57)
85*75a994c4SMatthias Ringwald 
86*75a994c4SMatthias Ringwald #define MESG_ID_LIST_ADD_ID                  ((UCHAR)0x59)
87*75a994c4SMatthias Ringwald #define MESG_ID_LIST_CONFIG_ID               ((UCHAR)0x5A)
88*75a994c4SMatthias Ringwald #define MESG_OPEN_RX_SCAN_ID                 ((UCHAR)0x5B)
89*75a994c4SMatthias Ringwald 
90*75a994c4SMatthias Ringwald #define MESG_EXT_CHANNEL_RADIO_FREQ_ID       ((UCHAR)0x5C)  // OBSOLETE: (for 905 radio)
91*75a994c4SMatthias Ringwald #define MESG_EXT_BROADCAST_DATA_ID           ((UCHAR)0x5D)
92*75a994c4SMatthias Ringwald #define MESG_EXT_ACKNOWLEDGED_DATA_ID        ((UCHAR)0x5E)
93*75a994c4SMatthias Ringwald #define MESG_EXT_BURST_DATA_ID               ((UCHAR)0x5F)
94*75a994c4SMatthias Ringwald 
95*75a994c4SMatthias Ringwald #define MESG_CHANNEL_RADIO_TX_POWER_ID       ((UCHAR)0x60)
96*75a994c4SMatthias Ringwald #define MESG_GET_SERIAL_NUM_ID               ((UCHAR)0x61)
97*75a994c4SMatthias Ringwald #define MESG_GET_TEMP_CAL_ID                 ((UCHAR)0x62)
98*75a994c4SMatthias Ringwald #define MESG_SET_LP_SEARCH_TIMEOUT_ID        ((UCHAR)0x63)
99*75a994c4SMatthias Ringwald #define MESG_SET_TX_SEARCH_ON_NEXT_ID        ((UCHAR)0x64)
100*75a994c4SMatthias Ringwald #define MESG_SERIAL_NUM_SET_CHANNEL_ID_ID    ((UCHAR)0x65)
101*75a994c4SMatthias Ringwald #define MESG_RX_EXT_MESGS_ENABLE_ID          ((UCHAR)0x66)
102*75a994c4SMatthias Ringwald #define MESG_RADIO_CONFIG_ALWAYS_ID          ((UCHAR)0x67)
103*75a994c4SMatthias Ringwald #define MESG_ENABLE_LED_FLASH_ID             ((UCHAR)0x68)
104*75a994c4SMatthias Ringwald 
105*75a994c4SMatthias Ringwald #define MESG_XTAL_ENABLE_ID                  ((UCHAR)0x6D)
106*75a994c4SMatthias Ringwald 
107*75a994c4SMatthias Ringwald #define MESG_STARTUP_MESG_ID                 ((UCHAR)0x6F)
108*75a994c4SMatthias Ringwald #define MESG_AUTO_FREQ_CONFIG_ID             ((UCHAR)0x70)
109*75a994c4SMatthias Ringwald #define MESG_PROX_SEARCH_CONFIG_ID           ((UCHAR)0x71)
110*75a994c4SMatthias Ringwald 
111*75a994c4SMatthias Ringwald #define MESG_SET_SEARCH_CH_PRIORITY_ID       ((UCHAR)0x75)
112*75a994c4SMatthias Ringwald 
113*75a994c4SMatthias Ringwald #define MESG_CUBE_CMD_ID                     ((UCHAR)0x80)
114*75a994c4SMatthias Ringwald 
115*75a994c4SMatthias Ringwald #define MESG_GET_PIN_DIODE_CONTROL_ID        ((UCHAR)0x8D)
116*75a994c4SMatthias Ringwald #define MESG_PIN_DIODE_CONTROL_ID            ((UCHAR)0x8E)
117*75a994c4SMatthias Ringwald #define MESG_FIT1_SET_AGC_ID                 ((UCHAR)0x8F)
118*75a994c4SMatthias Ringwald 
119*75a994c4SMatthias Ringwald #define MESG_FIT1_SET_EQUIP_STATE_ID         ((UCHAR)0x91)  // *** CONFLICT: w/ Sensrcore, Fit1 will never have sensrcore enabled
120*75a994c4SMatthias Ringwald 
121*75a994c4SMatthias Ringwald // Sensrcore Messages
122*75a994c4SMatthias Ringwald #define MESG_SET_CHANNEL_INPUT_MASK_ID       ((UCHAR)0x90)
123*75a994c4SMatthias Ringwald #define MESG_SET_CHANNEL_DATA_TYPE_ID        ((UCHAR)0x91)
124*75a994c4SMatthias Ringwald #define MESG_READ_PINS_FOR_SECT_ID           ((UCHAR)0x92)
125*75a994c4SMatthias Ringwald #define MESG_TIMER_SELECT_ID                 ((UCHAR)0x93)
126*75a994c4SMatthias Ringwald #define MESG_ATOD_SETTINGS_ID                ((UCHAR)0x94)
127*75a994c4SMatthias Ringwald #define MESG_SET_SHARED_ADDRESS_ID           ((UCHAR)0x95)
128*75a994c4SMatthias Ringwald #define MESG_ATOD_EXTERNAL_ENABLE_ID         ((UCHAR)0x96)
129*75a994c4SMatthias Ringwald #define MESG_ATOD_PIN_SETUP_ID               ((UCHAR)0x97)
130*75a994c4SMatthias Ringwald #define MESG_SETUP_ALARM_ID                  ((UCHAR)0x98)
131*75a994c4SMatthias Ringwald #define MESG_ALARM_VARIABLE_MODIFY_TEST_ID   ((UCHAR)0x99)
132*75a994c4SMatthias Ringwald #define MESG_PARTIAL_RESET_ID                ((UCHAR)0x9A)
133*75a994c4SMatthias Ringwald #define MESG_OVERWRITE_TEMP_CAL_ID           ((UCHAR)0x9B)
134*75a994c4SMatthias Ringwald #define MESG_SERIAL_PASSTHRU_SETTINGS_ID     ((UCHAR)0x9C)
135*75a994c4SMatthias Ringwald 
136*75a994c4SMatthias Ringwald #define MESG_BIST_ID                         ((UCHAR)0xAA)
137*75a994c4SMatthias Ringwald #define MESG_UNLOCK_INTERFACE_ID             ((UCHAR)0xAD)
138*75a994c4SMatthias Ringwald #define MESG_SERIAL_ERROR_ID                 ((UCHAR)0xAE)
139*75a994c4SMatthias Ringwald #define MESG_SET_ID_STRING_ID                ((UCHAR)0xAF)
140*75a994c4SMatthias Ringwald 
141*75a994c4SMatthias Ringwald #define MESG_PORT_GET_IO_STATE_ID            ((UCHAR)0xB4)
142*75a994c4SMatthias Ringwald #define MESG_PORT_SET_IO_STATE_ID            ((UCHAR)0xB5)
143*75a994c4SMatthias Ringwald 
144*75a994c4SMatthias Ringwald #define MESG_SLEEP_ID                        ((UCHAR)0xC5)
145*75a994c4SMatthias Ringwald #define MESG_GET_GRMN_ESN_ID                 ((UCHAR)0xC6)
146*75a994c4SMatthias Ringwald #define MESG_SET_USB_INFO_ID                 ((UCHAR)0xC7)
147*75a994c4SMatthias Ringwald 
148*75a994c4SMatthias Ringwald // ANT HCI Commands - see ant_cmds.c for info on parameters
149*75a994c4SMatthias Ringwald extern const hci_cmd_t btstack_get_state;
150*75a994c4SMatthias Ringwald 
151*75a994c4SMatthias Ringwald /**
152*75a994c4SMatthias Ringwald  * compact ANT HCI Command packet description
153*75a994c4SMatthias Ringwald  */
154*75a994c4SMatthias Ringwald  typedef struct {
155*75a994c4SMatthias Ringwald     const uint8_t    message_id;
156*75a994c4SMatthias Ringwald     const char *format;
157*75a994c4SMatthias Ringwald } ant_cmd_t;
158*75a994c4SMatthias Ringwald 
159*75a994c4SMatthias Ringwald uint16_t ant_create_cmd(uint8_t *hci_cmd_buffer, const ant_cmd_t *cmd, ...);
160*75a994c4SMatthias Ringwald int ant_send_cmd(const ant_cmd_t *cmd, ...);
161*75a994c4SMatthias Ringwald 
162*75a994c4SMatthias Ringwald const ant_cmd_t ant_reset;
163*75a994c4SMatthias Ringwald const ant_cmd_t ant_assign_channel;
164*75a994c4SMatthias Ringwald const ant_cmd_t ant_un_assign_channel;
165*75a994c4SMatthias Ringwald const ant_cmd_t ant_search_timeout;
166*75a994c4SMatthias Ringwald const ant_cmd_t ant_lp_search_timeout;
167*75a994c4SMatthias Ringwald const ant_cmd_t ant_network_key;
168*75a994c4SMatthias Ringwald const ant_cmd_t ant_channel_id;
169*75a994c4SMatthias Ringwald const ant_cmd_t ant_channel_power;
170*75a994c4SMatthias Ringwald const ant_cmd_t ant_channel_period;
171*75a994c4SMatthias Ringwald const ant_cmd_t ant_prox_search_config;
172*75a994c4SMatthias Ringwald const ant_cmd_t ant_broadcast;
173*75a994c4SMatthias Ringwald const ant_cmd_t ant_acknowledged;
174*75a994c4SMatthias Ringwald const ant_cmd_t ant_burst_packet;
175*75a994c4SMatthias Ringwald const ant_cmd_t ant_open_channel;
176*75a994c4SMatthias Ringwald const ant_cmd_t ant_close_channel;
177*75a994c4SMatthias Ringwald const ant_cmd_t ant_request_message;
178*75a994c4SMatthias Ringwald 
179*75a994c4SMatthias Ringwald #if defined __cplusplus
180*75a994c4SMatthias Ringwald }
181*75a994c4SMatthias Ringwald #endif
182*75a994c4SMatthias Ringwald 
183*75a994c4SMatthias Ringwald #endif // __ANT_CMDS_H
184