Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

483 lines
24KB

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