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