Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. #ifndef _LIBANT_H_
  2. #define _LIBANT_H_
  3. #define WHEEL_CIRCUMFERENCE 2122
  4. #define ANT_TRANSMISSION_SLAVE 0x00
  5. #define ANT_TRANSMISSION_MASTER 0x05
  6. #define ANT_PERIOD_HRM 8070
  7. #define ANT_PERIOD_SPDCAD 8086
  8. #define ANT_PERIOD_POWER 8182
  9. #define ANT_PERIOD_STRIDE 8134 // footpod
  10. #define ANT_PERIOD_SPEED 8118
  11. #define ANT_PERIOD_CADENCE 8102
  12. #define ANT_PERIOD_CONTROL 8192
  13. #define ANT_PERIOD_KICKR 2048
  14. #define ANT_PERIOD_MOXY 8192
  15. #define ANT_PERIOD_TACX_VORTEX 8192
  16. #define ANT_PERIOD_ITNESS_EQUIPMENT 8192
  17. #define ANT_PERIOD_QUARQ (8182*4)
  18. #define ANT_PERIOD_QUARQ_FAST (8182/16)
  19. #define ANT_FREQUENCY_SPORT 57
  20. #define ANT_FREQUENCY_STRIDE 57
  21. #define ANT_FREQUENCY_FAST_QUARQ 61
  22. #define ANT_FREQUENCY_QUARQ 61
  23. #define ANT_FREQUENCY_KICKR 52
  24. #define ANT_FREQUENCY_MOXY 57
  25. #define ANT_FREQUENCY_TACX_VORTEX 66
  26. #define ANT_FREQUENCY_FITNESS_EQUIPMENT 57
  27. #define ANT_DEVICE_ANTFS 1
  28. #define ANT_DEVICE_POWER 11
  29. //#define ANT_DEVICE_QUARQ_FAST_OLD 11
  30. #define ANT_DEVICE_ENVIRONMENT_LEGACY 12
  31. #define ANT_DEVICE_MULTISPORT_SPDST 15
  32. #define ANT_DEVICE_CONTROL 16
  33. #define ANT_DEVICE_FITNESS_EQUIPMENT 17
  34. #define ANT_DEVICE_BLOOD_PRESSURE 18
  35. #define ANT_DEVICE_GEOCACHE_NODE 19
  36. #define ANT_DEVICE_LIGHT_VEHICLE 20
  37. #define ANT_DEVICE_ENV_SENSOR 25
  38. #define ANT_DEVICE_MOXY 31
  39. #define ANT_DEVICE_TACX_VORTEX 61
  40. #define ANT_DEVICE_QUARQ_FAST 96
  41. #define ANT_DEVICE_QUARQ 96
  42. #define ANT_DEVICE_WEIGHT_SCALE 119
  43. #define ANT_DEVICE_HRM 120
  44. #define ANT_DEVICE_SPDCAD 121
  45. #define ANT_DEVICE_CADENCE 122
  46. #define ANT_DEVICE_SPEED 123
  47. #define ANT_DEVICE_STRIDE 124 // footpod
  48. // ANT_DEVICE_POWER broadcast types
  49. #define ANT_POWER_STANDARD 0x10
  50. #define ANT_POWER_WHEELTORQUE 0x11
  51. #define ANT_POWER_CRANKTORQUE 0x12
  52. #define ANT_POWER_TE_AND_PS 0x13
  53. #define ANT_POWER_CRANKSRM 0x20
  54. #define ANT_CHANNEL_STATUS_UNASSIGNED 0
  55. #define ANT_CHANNEL_STATUS_ASSIGNED 1
  56. #define ANT_CHANNEL_STATUS_SEARCHING 2
  57. #define ANT_CHANNEL_STATUS_TRACKING 3
  58. #define ANT_CHANNEL_STATUS_UNKNOWN 4 /*shouldn't see this */
  59. #define ANT_CHANNEL_STATUS_MASK 0x03
  60. #define ANT_CHANNEL_TYPE_SLAVE ((uint8_t)0x00) //Slave channel (PARAMETER_RX_NOT_TX).
  61. #define ANT_CHANNEL_TYPE_MASTER ((uint8_t)0x10) //Master channel (PARAMETER_TX_NOT_RX).
  62. #define ANT_CHANNEL_TYPE_SLAVE_RX_ONLY ((uint8_t)0x40) //Slave rx only channel (PARAMETER_RX_NOT_TX | PARAMETER_RX_ONLY).
  63. #define ANT_CHANNEL_TYPE_MASTER_TX_ONLY ((uint8_t)0x50) //Master tx only channel (PARAMETER_TX_NOT_RX | PARAMETER_NO_TX_GUARD_BAND).
  64. #define ANT_CHANNEL_TYPE_SHARED_SLAVE ((uint8_t)0x20) //Shared slave channel (PARAMETER_RX_NOT_TX | PARAMETER_SHARED_CHANNEL).
  65. #define ANT_CHANNEL_TYPE_SHARED_MASTER ((uint8_t)0x30) //Shared master channel (PARAMETER_TX_NOT_RX | PARAMETER_SHARED_CHANNEL).
  66. #define ANT_STARTUP_RESET_POWERON 0x00
  67. #define ANT_STARTUP_RESET_HARDWARE 0x01
  68. #define ANT_STARTUP_RESET_WATCHDOG 0x02
  69. #define ANT_STARTUP_RESET_COMMAND 0x20
  70. #define ANT_STARTUP_RESET_SYNC 0x40
  71. #define ANT_STARTUP_RESET_SUSPEND 0x80
  72. #define STREAM_SYNC 0
  73. #define STREAM_LENGTH 1
  74. #define STREAM_MESSAGE 2
  75. #define STREAM_DATA 3
  76. #define STREAM_CHANNEL STREAM_DATA
  77. #define STREAM_CHANNEL_ID 0
  78. #define STREAM_CHANNEL_STATUS 1
  79. #define STREAM_EVENT_CHANNEL_ID 0
  80. #define STREAM_EVENT_RESPONSE_ID 1
  81. #define STREAM_CAP_MAXCHANNELS 0
  82. #define STREAM_CAP_MAXNETWORKS 1
  83. #define STREAM_CAP_STDOPTIONS 2
  84. #define STREAM_CAP_ADVANCED 3
  85. #define STREAM_CAP_ADVANCED2 4
  86. #define STREAM_STARTUP_REASON 0
  87. #define STREAM_CHANNELSTATUS_STATUS 1
  88. #define STREAM_VERSION_STRING 0
  89. #define STREAM_CHANNELID_DEVNO_LO 1
  90. #define STREAM_CHANNELID_DEVNO_HI 2
  91. #define STREAM_CHANNELID_DEVTYPE 3
  92. #define STREAM_CHANNELID_TRANTYPE 4
  93. #define STREAM_EVENT_EVENTID 2
  94. #define STREAM_RXBROADCAST_DEV120_BEATLO 5
  95. #define STREAM_RXBROADCAST_DEV120_BEATHI 6
  96. #define STREAM_RXBROADCAST_DEV120_SEQ 7
  97. #define STREAM_RXBROADCAST_DEV120_HR 8
  98. #define RESET_FLAGS_MASK ((uint8_t)0xE0)
  99. #define RESET_SUSPEND ((uint8_t)0x80) // this must follow bitfield def
  100. #define RESET_SYNC ((uint8_t)0x40) // this must follow bitfield def
  101. #define RESET_CMD ((uint8_t)0x20) // this must follow bitfield def
  102. #define RESET_WDT ((uint8_t)0x02)
  103. #define RESET_RST ((uint8_t)0x01)
  104. #define RESET_POR ((uint8_t)0x00)
  105. //////////////////////////////////////////////
  106. // Assign Channel Parameters
  107. //////////////////////////////////////////////
  108. #define PARAMETER_RX_NOT_TX ((uint8_t)0x00)
  109. #define PARAMETER_TX_NOT_RX ((uint8_t)0x10)
  110. #define PARAMETER_SHARED_CHANNEL ((uint8_t)0x20)
  111. #define PARAMETER_NO_TX_GUARD_BAND ((uint8_t)0x40)
  112. #define PARAMETER_ALWAYS_RX_WILD_CARD_SEARCH_ID ((uint8_t)0x40) //Pre-AP2
  113. #define PARAMETER_RX_ONLY ((uint8_t)0x40)
  114. //////////////////////////////////////////////
  115. // Ext. Assign Channel Parameters
  116. //////////////////////////////////////////////
  117. #define EXT_PARAM_ALWAYS_SEARCH ((uint8_t)0x01)
  118. #define EXT_PARAM_FREQUENCY_AGILITY ((uint8_t)0x04)
  119. /////////////////////////////////////////////////////////////////////////////
  120. // Message Format
  121. // Messages are in the format:
  122. //
  123. // AX XX YY -------- CK
  124. //
  125. // where: AX is the 1 byte sync byte either transmit or recieve
  126. // XX is the 1 byte size of the message (0-249) NOTE: THIS WILL BE LIMITED BY THE EMBEDDED RECEIVE BUFFER SIZE
  127. // YY is the 1 byte ID of the message (1-255, 0 is invalid)
  128. // ----- is the data of the message (0-249 bytes of data)
  129. // CK is the 1 byte Checksum of the message
  130. /////////////////////////////////////////////////////////////////////////////
  131. #define MESG_TX_SYNC ((uint8_t)0xA4)
  132. #define MESG_RX_SYNC ((uint8_t)0xA5)
  133. #define MESG_SYNC_SIZE ((uint8_t)1)
  134. #define MESG_SIZE_SIZE ((uint8_t)1)
  135. #define MESG_ID_SIZE ((uint8_t)1)
  136. #define MESG_CHANNEL_NUM_SIZE ((uint8_t)1)
  137. #define MESG_EXT_MESG_BF_SIZE ((uint8_t)1) // NOTE: this could increase in the future
  138. #define MESG_CHECKSUM_SIZE ((uint8_t)1)
  139. #define MESG_DATA_SIZE ((uint8_t)9)
  140. // The largest serial message is an ANT data message with all of the extended fields
  141. #define MESG_ANT_MAX_PAYLOAD_SIZE ANT_STANDARD_DATA_PAYLOAD_SIZE
  142. #define MESG_MAX_EXT_DATA_SIZE (ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE + 4 + 2) // ANT device ID (4 bytes) + (4 bytes) + (2 bytes)
  143. #define MESG_MAX_DATA_SIZE (MESG_ANT_MAX_PAYLOAD_SIZE + MESG_EXT_MESG_BF_SIZE + MESG_MAX_EXT_DATA_SIZE) // ANT data payload (8 bytes) + extended bitfield (1 byte) + extended data (10 bytes)
  144. #define MESG_MAX_SIZE_VALUE (MESG_MAX_DATA_SIZE + MESG_CHANNEL_NUM_SIZE) // this is the maximum value that the serial message size value is allowed to be
  145. #define MESG_BUFFER_SIZE (MESG_SIZE_SIZE + MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE + MESG_CHECKSUM_SIZE)
  146. #define MESG_FRAMED_SIZE (MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE)
  147. #define MESG_HEADER_SIZE (MESG_SYNC_SIZE + MESG_SIZE_SIZE + MESG_ID_SIZE)
  148. #define MESG_FRAME_SIZE (MESG_HEADER_SIZE + MESG_CHECKSUM_SIZE)
  149. #define MESG_MAX_SIZE (MESG_MAX_DATA_SIZE + MESG_FRAME_SIZE)
  150. #define MESG_SIZE_OFFSET (MESG_SYNC_SIZE)
  151. #define MESG_ID_OFFSET (MESG_SYNC_SIZE + MESG_SIZE_SIZE)
  152. #define MESG_DATA_OFFSET (MESG_HEADER_SIZE)
  153. #define MESG_RECOMMENDED_BUFFER_SIZE ((uint8_t)ANTPLUS_MAXPACKETSIZE)
  154. //////////////////////////////////////////////
  155. // Message ID's
  156. //////////////////////////////////////////////
  157. #define MESG_INVALID_ID ((uint8_t)0x00)
  158. #define MESG_EVENT_ID ((uint8_t)0x01)
  159. #define MESG_VERSION_ID ((uint8_t)0x3E)
  160. #define MESG_RESPONSE_EVENT_ID ((uint8_t)0x40)
  161. #define MESG_UNASSIGN_CHANNEL_ID ((uint8_t)0x41)
  162. #define MESG_ASSIGN_CHANNEL_ID ((uint8_t)0x42)
  163. #define MESG_CHANNEL_MESG_PERIOD_ID ((uint8_t)0x43)
  164. #define MESG_CHANNEL_SEARCH_TIMEOUT_ID ((uint8_t)0x44)
  165. #define MESG_CHANNEL_RADIO_FREQ_ID ((uint8_t)0x45)
  166. #define MESG_NETWORK_KEY_ID ((uint8_t)0x46)
  167. #define MESG_RADIO_TX_POWER_ID ((uint8_t)0x47)
  168. #define MESG_RADIO_CW_MODE_ID ((uint8_t)0x48)
  169. #define MESG_SEARCH_WAVEFORM_ID ((uint8_t)0x49)
  170. #define MESG_SYSTEM_RESET_ID ((uint8_t)0x4A)
  171. #define MESG_OPEN_CHANNEL_ID ((uint8_t)0x4B)
  172. #define MESG_CLOSE_CHANNEL_ID ((uint8_t)0x4C)
  173. #define MESG_REQUEST_ID ((uint8_t)0x4D)
  174. #define MESG_BROADCAST_DATA_ID ((uint8_t)0x4E)
  175. #define MESG_ACKNOWLEDGED_DATA_ID ((uint8_t)0x4F)
  176. #define MESG_BURST_DATA_ID ((uint8_t)0x50)
  177. #define MESG_CHANNEL_ID_ID ((uint8_t)0x51)
  178. #define MESG_CHANNEL_STATUS_ID ((uint8_t)0x52)
  179. #define MESG_RADIO_CW_INIT_ID ((uint8_t)0x53)
  180. #define MESG_CAPABILITIES_ID ((uint8_t)0x54)
  181. #define MESG_STACKLIMIT_ID ((uint8_t)0x55)
  182. #define MESG_SCRIPT_DATA_ID ((uint8_t)0x56)
  183. #define MESG_SCRIPT_CMD_ID ((uint8_t)0x57)
  184. #define MESG_ID_LIST_ADD_ID ((uint8_t)0x59)
  185. #define MESG_ID_LIST_CONFIG_ID ((uint8_t)0x5A)
  186. #define MESG_OPEN_RX_SCAN_ID ((uint8_t)0x5B)
  187. #define MESG_EXT_CHANNEL_RADIO_FREQ_ID ((uint8_t)0x5C) // OBSOLETE: (for 905 radio)
  188. #define MESG_EXT_BROADCAST_DATA_ID ((uint8_t)0x5D)
  189. #define MESG_EXT_ACKNOWLEDGED_DATA_ID ((uint8_t)0x5E)
  190. #define MESG_EXT_BURST_DATA_ID ((uint8_t)0x5F)
  191. #define MESG_CHANNEL_RADIO_TX_POWER_ID ((uint8_t)0x60)
  192. #define MESG_GET_SERIAL_NUM_ID ((uint8_t)0x61)
  193. #define MESG_GET_TEMP_CAL_ID ((uint8_t)0x62)
  194. #define MESG_SET_LP_SEARCH_TIMEOUT_ID ((uint8_t)0x63)
  195. #define MESG_SET_TX_SEARCH_ON_NEXT_ID ((uint8_t)0x64)
  196. #define MESG_SERIAL_NUM_SET_CHANNEL_ID_ID ((uint8_t)0x65)
  197. #define MESG_RX_EXT_MESGS_ENABLE_ID ((uint8_t)0x66)
  198. #define MESG_RADIO_CONFIG_ALWAYS_ID ((uint8_t)0x67)
  199. #define MESG_ENABLE_LED_FLASH_ID ((uint8_t)0x68)
  200. #define MESG_XTAL_ENABLE_ID ((uint8_t)0x6D)
  201. #define MESG_STARTUP_MESG_ID ((uint8_t)0x6F)
  202. #define MESG_AUTO_FREQ_CONFIG_ID ((uint8_t)0x70)
  203. #define MESG_PROX_SEARCH_CONFIG_ID ((uint8_t)0x71)
  204. #define MESG_CUBE_CMD_ID ((uint8_t)0x80)
  205. #define MESG_GET_PIN_DIODE_CONTROL_ID ((uint8_t)0x8D)
  206. #define MESG_PIN_DIODE_CONTROL_ID ((uint8_t)0x8E)
  207. #define MESG_FIT1_SET_AGC_ID ((uint8_t)0x8F)
  208. #define MESG_FIT1_SET_EQUIP_STATE_ID ((uint8_t)0x91) // *** CONFLICT: w/ Sensrcore, Fit1 will never have sensrcore enabled
  209. // Sensrcore Messages
  210. #define MESG_SET_CHANNEL_INPUT_MASK_ID ((uint8_t)0x90)
  211. #define MESG_SET_CHANNEL_DATA_TYPE_ID ((uint8_t)0x91)
  212. #define MESG_READ_PINS_FOR_SECT_ID ((uint8_t)0x92)
  213. #define MESG_TIMER_SELECT_ID ((uint8_t)0x93)
  214. #define MESG_ATOD_SETTINGS_ID ((uint8_t)0x94)
  215. #define MESG_SET_SHARED_ADDRESS_ID ((uint8_t)0x95)
  216. #define MESG_ATOD_EXTERNAL_ENABLE_ID ((uint8_t)0x96)
  217. #define MESG_ATOD_PIN_SETUP_ID ((uint8_t)0x97)
  218. #define MESG_SETUP_ALARM_ID ((uint8_t)0x98)
  219. #define MESG_ALARM_VARIABLE_MODIFY_TEST_ID ((uint8_t)0x99)
  220. #define MESG_PARTIAL_RESET_ID ((uint8_t)0x9A)
  221. #define MESG_OVERWRITE_TEMP_CAL_ID ((uint8_t)0x9B)
  222. #define MESG_SERIAL_PASSTHRU_SETTINGS_ID ((uint8_t)0x9C)
  223. #define MESG_READ_SEGA_ID ((uint8_t)0xA0)
  224. #define MESG_SEGA_CMD_ID ((uint8_t)0xA1)
  225. #define MESG_SEGA_DATA_ID ((uint8_t)0xA2)
  226. #define MESG_SEGA_ERASE_ID ((uint8_t)0xA3)
  227. #define MESG_SEGA_WRITE_ID ((uint8_t)0xA4)
  228. #define AVOID_USING_SYNC_BYTES_FOR_MESG_IDS ((uint8_t)0xA5)
  229. #define MESG_SEGA_LOCK_ID ((uint8_t)0xA6)
  230. #define MESG_FLASH_PROTECTION_CHECK_ID ((uint8_t)0xA7)
  231. #define MESG_UARTREG_ID ((uint8_t)0xA8)
  232. #define MESG_MAN_TEMP_ID ((uint8_t)0xA9)
  233. #define MESG_BIST_ID ((uint8_t)0xAA)
  234. #define MESG_SELFERASE_ID ((uint8_t)0xAB)
  235. #define MESG_SET_MFG_BITS_ID ((uint8_t)0xAC)
  236. #define MESG_UNLOCK_INTERFACE_ID ((uint8_t)0xAD)
  237. #define MESG_SERIAL_ERROR_ID ((uint8_t)0xAE)
  238. #define MESG_SET_ID_STRING_ID ((uint8_t)0xAF)
  239. #define MESG_IO_STATE_ID ((uint8_t)0xB0)
  240. #define MESG_CFG_STATE_ID ((uint8_t)0xB1)
  241. #define MESG_BLOWFUSE_ID ((uint8_t)0xB2)
  242. #define MESG_MASTERIOCTRL_ID ((uint8_t)0xB3)
  243. #define MESG_PORT_GET_IO_STATE_ID ((uint8_t)0xB4)
  244. #define MESG_PORT_SET_IO_STATE_ID ((uint8_t)0xB5)
  245. #define MESG_SLEEP_ID ((uint8_t)0xC5)
  246. #define MESG_GET_GRMN_ESN_ID ((uint8_t)0xC6)
  247. #define MESG_DEBUG_ID ((uint8_t)0xF0) // use 2 byte sub-index identifier
  248. //////////////////////////////////////////////
  249. // Message Sizes
  250. //////////////////////////////////////////////
  251. #define MESG_INVALID_SIZE ((uint8_t)0)
  252. #define MESG_VERSION_SIZE ((uint8_t)13)
  253. #define MESG_RESPONSE_EVENT_SIZE ((uint8_t)3)
  254. #define MESG_CHANNEL_STATUS_SIZE ((uint8_t)2)
  255. #define MESG_UNASSIGN_CHANNEL_SIZE ((uint8_t)1)
  256. #define MESG_ASSIGN_CHANNEL_SIZE ((uint8_t)3)
  257. #define MESG_CHANNEL_ID_SIZE ((uint8_t)5)
  258. #define MESG_CHANNEL_MESG_PERIOD_SIZE ((uint8_t)3)
  259. #define MESG_CHANNEL_SEARCH_TIMEOUT_SIZE ((uint8_t)2)
  260. #define MESG_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)2)
  261. #define MESG_CHANNEL_RADIO_TX_POWER_SIZE ((uint8_t)2)
  262. #define MESG_NETWORK_KEY_SIZE ((uint8_t)9)
  263. #define MESG_RADIO_TX_POWER_SIZE ((uint8_t)2)
  264. #define MESG_RADIO_CW_MODE_SIZE ((uint8_t)3)
  265. #define MESG_RADIO_CW_INIT_SIZE ((uint8_t)1)
  266. #define MESG_SYSTEM_RESET_SIZE ((uint8_t)1)
  267. #define MESG_OPEN_CHANNEL_SIZE ((uint8_t)1)
  268. #define MESG_CLOSE_CHANNEL_SIZE ((uint8_t)1)
  269. #define MESG_REQUEST_SIZE ((uint8_t)2)
  270. #define MESG_CAPABILITIES_SIZE ((uint8_t)6)
  271. #define MESG_STACKLIMIT_SIZE ((uint8_t)2)
  272. #define MESG_SCRIPT_DATA_SIZE ((uint8_t)10)
  273. #define MESG_SCRIPT_CMD_SIZE ((uint8_t)3)
  274. #define MESG_ID_LIST_ADD_SIZE ((uint8_t)6)
  275. #define MESG_ID_LIST_CONFIG_SIZE ((uint8_t)3)
  276. #define MESG_OPEN_RX_SCAN_SIZE ((uint8_t)1)
  277. #define MESG_EXT_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)3)
  278. #define MESG_RADIO_CONFIG_ALWAYS_SIZE ((uint8_t)2)
  279. #define MESG_RX_EXT_MESGS_ENABLE_SIZE ((uint8_t)2)
  280. #define MESG_SET_TX_SEARCH_ON_NEXT_SIZE ((uint8_t)2)
  281. #define MESG_SET_LP_SEARCH_TIMEOUT_SIZE ((uint8_t)2)
  282. #define MESG_SERIAL_NUM_SET_CHANNEL_ID_SIZE ((uint8_t)3)
  283. #define MESG_ENABLE_LED_FLASH_SIZE ((uint8_t)2)
  284. #define MESG_GET_SERIAL_NUM_SIZE ((uint8_t)4)
  285. #define MESG_GET_TEMP_CAL_SIZE ((uint8_t)4)
  286. #define MESG_CLOCK_DRIFT_DATA_SIZE ((uint8_t)9)
  287. #define MESG_AGC_CONFIG_SIZE ((uint8_t)2)
  288. #define MESG_RUN_SCRIPT_SIZE ((uint8_t)2)
  289. #define MESG_ANTLIB_CONFIG_SIZE ((uint8_t)2)
  290. #define MESG_XTAL_ENABLE_SIZE ((uint8_t)1)
  291. #define MESG_STARTUP_MESG_SIZE ((uint8_t)1)
  292. #define MESG_AUTO_FREQ_CONFIG_SIZE ((uint8_t)4)
  293. #define MESG_PROX_SEARCH_CONFIG_SIZE ((uint8_t)2)
  294. #define MESG_GET_PIN_DIODE_CONTROL_SIZE ((uint8_t)1)
  295. #define MESG_PIN_DIODE_CONTROL_ID_SIZE ((uint8_t)2)
  296. #define MESG_FIT1_SET_EQUIP_STATE_SIZE ((uint8_t)2)
  297. #define MESG_FIT1_SET_AGC_SIZE ((uint8_t)3)
  298. #define MESG_READ_SEGA_SIZE ((uint8_t)2)
  299. #define MESG_SEGA_CMD_SIZE ((uint8_t)3)
  300. #define MESG_SEGA_DATA_SIZE ((uint8_t)10)
  301. #define MESG_SEGA_ERASE_SIZE ((uint8_t)0)
  302. #define MESG_SEGA_WRITE_SIZE ((uint8_t)3)
  303. #define MESG_SEGA_LOCK_SIZE ((uint8_t)1)
  304. #define MESG_FLASH_PROTECTION_CHECK_SIZE ((uint8_t)1)
  305. #define MESG_UARTREG_SIZE ((uint8_t)2)
  306. #define MESG_MAN_TEMP_SIZE ((uint8_t)2)
  307. #define MESG_BIST_SIZE ((uint8_t)6)
  308. #define MESG_SELFERASE_SIZE ((uint8_t)2)
  309. #define MESG_SET_MFG_BITS_SIZE ((uint8_t)2)
  310. #define MESG_UNLOCK_INTERFACE_SIZE ((uint8_t)1)
  311. #define MESG_SET_SHARED_ADDRESS_SIZE ((uint8_t)3)
  312. #define MESG_GET_GRMN_ESN_SIZE ((uint8_t)5)
  313. #define MESG_IO_STATE_SIZE ((uint8_t)2)
  314. #define MESG_CFG_STATE_SIZE ((uint8_t)2)
  315. #define MESG_BLOWFUSE_SIZE ((uint8_t)1)
  316. #define MESG_MASTERIOCTRL_SIZE ((uint8_t)1)
  317. #define MESG_PORT_SET_IO_STATE_SIZE ((uint8_t)5)
  318. #define MESG_SLEEP_SIZE ((uint8_t)1)
  319. #define MESG_EXT_DATA_SIZE ((uint8_t)13)
  320. //////////////////////////////////////////////
  321. // PC Application Event Codes
  322. //////////////////////////////////////////////
  323. #define EVENT_RX_BROADCAST ((uint8_t)0x9A) // returned when module receives broadcast data
  324. #define EVENT_RX_ACKNOWLEDGED ((uint8_t)0x9B) // returned when module receives acknowledged data
  325. #define EVENT_RX_BURST_PACKET ((uint8_t)0x9C) // returned when module receives burst data
  326. #define EVENT_RX_EXT_BROADCAST ((uint8_t)0x9D) // returned when module receives broadcast data
  327. #define EVENT_RX_EXT_ACKNOWLEDGED ((uint8_t)0x9E) // returned when module receives acknowledged data
  328. #define EVENT_RX_EXT_BURST_PACKET ((uint8_t)0x9F) // returned when module receives burst data
  329. #define EVENT_RX_FLAG_BROADCAST ((uint8_t)0xA3) // returned when module receives broadcast data with flag attached
  330. #define EVENT_RX_FLAG_ACKNOWLEDGED ((uint8_t)0xA4) // returned when module receives acknowledged data with flag attached
  331. #define EVENT_RX_FLAG_BURST_PACKET ((uint8_t)0xA5) // returned when module receives burst data with flag attached
  332. //////////////////////////////////////////////
  333. // Response / Event Codes
  334. //////////////////////////////////////////////
  335. #define RESPONSE_NO_ERROR ((uint8_t)0x00)
  336. #define NO_EVENT ((uint8_t)0x00)
  337. #define EVENT_RX_SEARCH_TIMEOUT ((uint8_t)0x01)
  338. #define EVENT_RX_FAIL ((uint8_t)0x02)
  339. #define EVENT_TX ((uint8_t)0x03)
  340. #define EVENT_TRANSFER_RX_FAILED ((uint8_t)0x04)
  341. #define EVENT_TRANSFER_TX_COMPLETED ((uint8_t)0x05)
  342. #define EVENT_TRANSFER_TX_FAILED ((uint8_t)0x06)
  343. #define EVENT_CHANNEL_CLOSED ((uint8_t)0x07)
  344. #define EVENT_RX_FAIL_GO_TO_SEARCH ((uint8_t)0x08)
  345. #define EVENT_CHANNEL_COLLISION ((uint8_t)0x09)
  346. #define EVENT_TRANSFER_TX_START ((uint8_t)0x0A) // a pending transmit transfer has begun
  347. #define EVENT_CHANNEL_ACTIVE ((uint8_t)0x0F)
  348. #define EVENT_TRANSFER_TX_NEXT_MESSAGE ((uint8_t)0x11) // only enabled in FIT1
  349. #define CHANNEL_IN_WRONG_STATE ((uint8_t)0x15) // returned on attempt to perform an action from the wrong channel state
  350. #define CHANNEL_NOT_OPENED ((uint8_t)0x16) // returned on attempt to communicate on a channel that is not open
  351. #define CHANNEL_ID_NOT_SET ((uint8_t)0x18) // returned on attempt to open a channel without setting the channel ID
  352. #define CLOSE_ALL_CHANNELS ((uint8_t)0x19) // returned when attempting to start scanning mode, when channels are still open
  353. #define TRANSFER_IN_PROGRESS ((uint8_t)0x1F) // returned on attempt to communicate on a channel with a TX transfer in progress
  354. #define TRANSFER_SEQUENCE_NUMBER_ERROR ((uint8_t)0x20) // returned when sequence number is out of order on a Burst transfer
  355. #define TRANSFER_IN_ERROR ((uint8_t)0x21)
  356. #define TRANSFER_BUSY ((uint8_t)0x22)
  357. #define MESSAGE_SIZE_EXCEEDS_LIMIT ((uint8_t)0x27) // returned if a data message is provided that is too large
  358. #define INVALID_MESSAGE ((uint8_t)0x28) // returned when the message has an invalid parameter
  359. #define INVALID_NETWORK_NUMBER ((uint8_t)0x29) // returned when an invalid network number is provided
  360. #define INVALID_LIST_ID ((uint8_t)0x30) // returned when the provided list ID or size exceeds the limit
  361. #define INVALID_SCAN_TX_CHANNEL ((uint8_t)0x31) // returned when attempting to transmit on channel 0 when in scan mode
  362. #define INVALID_PARAMETER_PROVIDED ((uint8_t)0x33) // returned when an invalid parameter is specified in a configuration message
  363. #define EVENT_QUE_OVERFLOW ((uint8_t)0x35) // ANT event que has overflowed and lost 1 or more events
  364. #define EVENT_CLK_ERROR ((uint8_t)0x36) //!! debug XOSC16M
  365. #define SCRIPT_FULL_ERROR ((uint8_t)0x40) // error writing to script, memory is full
  366. #define SCRIPT_WRITE_ERROR ((uint8_t)0x41) // error writing to script, bytes not written correctly
  367. #define SCRIPT_INVALID_PAGE_ERROR ((uint8_t)0x42) // error accessing script page
  368. #define SCRIPT_LOCKED_ERROR ((uint8_t)0x43) // the scripts are locked and can't be dumped
  369. #define NO_RESPONSE_MESSAGE ((uint8_t)0x50) // returned to the Command_SerialMessageProcess function, so no reply message is generated
  370. #define RETURN_TO_MFG ((uint8_t)0x51) // default return to any mesg when the module determines that the mfg procedure has not been fully completed
  371. #define FIT_ACTIVE_SEARCH_TIMEOUT ((uint8_t)0x60) // Fit1 only event added for timeout of the pairing state after the Fit module becomes active
  372. #define FIT_WATCH_PAIR ((uint8_t)0x61) // Fit1 only
  373. #define FIT_WATCH_UNPAIR ((uint8_t)0x62) // Fit1 only
  374. // Internal only events below this point
  375. #define INTERNAL_ONLY_EVENTS ((uint8_t)0x80)
  376. #define EVENT_RX ((uint8_t)0x80) // INTERNAL: Event for a receive message
  377. #define EVENT_NEW_CHANNEL ((uint8_t)0x81) // INTERNAL: EVENT for a new active channel
  378. #define EVENT_PASS_THRU ((uint8_t)0x82) // INTERNAL: Event to allow an upper stack events to pass through lower stacks
  379. #define EVENT_TRANSFER_RX_COMPLETED ((uint8_t)0x83) // INTERNAL: Event for RX completed that indicates ANT library is ready for new messasges
  380. #define EVENT_BLOCKED ((uint8_t)0xFF) // INTERNAL: Event to replace any event we do not wish to go out, will also zero the size of the Tx message
  381. #endif