PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

464 行
17KB

  1. /* Copyright (c) 2010 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. * $LastChangedRevision$
  12. */
  13. /**
  14. * @file
  15. *
  16. * @ingroup group_acilib
  17. *
  18. * @brief Prototypes for the acilib interfaces.
  19. */
  20. #ifndef _acilib_IF_H_
  21. #define _acilib_IF_H_
  22. /** @brief Encode the ACI message for set test mode command
  23. *
  24. * @param[in,out] buffer Pointer to ACI message buffer
  25. * @param[in] test_mode Pointer to the test mode in ::aci_cmd_params_test_t
  26. *
  27. * @return None
  28. */
  29. void acil_encode_cmd_set_test_mode(uint8_t *buffer, aci_cmd_params_test_t *p_aci_cmd_params_test);
  30. /** @brief Encode the ACI message for sleep command
  31. *
  32. * @param[in,out] buffer Pointer to ACI message buffer
  33. *
  34. * @return None
  35. */
  36. void acil_encode_cmd_sleep(uint8_t *buffer);
  37. /** @brief Encode the ACI message for get device version
  38. *
  39. * @param[in,out] buffer Pointer to ACI message buffer
  40. *
  41. * @return None
  42. */
  43. void acil_encode_cmd_get_device_version(uint8_t *buffer);
  44. /** @brief Encode the ACI message for set local data
  45. *
  46. * @param[in,out] buffer Pointer to ACI message buffer
  47. * @param[in] p_aci_cmd_params_set_local_data Pointer to the local data parameters in ::aci_cmd_params_set_local_data_t
  48. * @param[in] data_size Size of data message
  49. *
  50. * @return None
  51. */
  52. void acil_encode_cmd_set_local_data(uint8_t *buffer, aci_cmd_params_set_local_data_t *p_aci_cmd_params_set_local_data, uint8_t data_size);
  53. /** @brief Encode the ACI message to connect
  54. *
  55. * @param[in,out] buffer Pointer to ACI message buffer
  56. * @param[in] p_aci_cmd_params_connect Pointer to the run parameters in ::aci_cmd_params_connect_t
  57. *
  58. * @return None
  59. */
  60. void acil_encode_cmd_connect(uint8_t *buffer, aci_cmd_params_connect_t *p_aci_cmd_params_connect);
  61. /** @brief Encode the ACI message to bond
  62. *
  63. * @param[in,out] buffer Pointer to ACI message buffer
  64. * @param[in] p_aci_cmd_params_bond Pointer to the run parameters in ::aci_cmd_params_bond_t
  65. *
  66. * @return None
  67. */
  68. void acil_encode_cmd_bond(uint8_t *buffer, aci_cmd_params_bond_t *p_aci_cmd_params_bond);
  69. /** @brief Encode the ACI message to disconnect
  70. *
  71. * @param[in,out] buffer Pointer to ACI message buffer
  72. * @param[in] p_aci_cmd_params_disconnect Pointer to the run parameters in ::aci_cmd_params_disconnect_t
  73. *
  74. * @return None
  75. */
  76. void acil_encode_cmd_disconnect(uint8_t *buffer, aci_cmd_params_disconnect_t *p_aci_cmd_params_disconnect);
  77. /** @brief Encode the ACI message to baseband reset
  78. *
  79. * @param[in,out] buffer Pointer to ACI message buffer
  80. *
  81. * @return None
  82. */
  83. void acil_encode_baseband_reset(uint8_t *buffer);
  84. /** @brief Encode the ACI message for Directed Advertising
  85. *
  86. * @param[in,out] buffer Pointer to ACI message buffer
  87. *
  88. * @return None
  89. */
  90. void acil_encode_direct_connect(uint8_t *buffer);
  91. /** @brief Encode the ACI message to wakeup
  92. *
  93. * @param[in,out] buffer Pointer to ACI message buffer
  94. *
  95. * @return None
  96. */
  97. void acil_encode_cmd_wakeup(uint8_t *buffer);
  98. /** @brief Encode the ACI message for set radio Tx power
  99. *
  100. * @param[in,out] buffer Pointer to ACI message buffer
  101. * @param[in] p_aci_cmd_params_set_tx_power Pointer to the set Tx power parameters in ::aci_cmd_params_set_tx_power_t
  102. *
  103. * @return None
  104. */
  105. void acil_encode_cmd_set_radio_tx_power(uint8_t *buffer, aci_cmd_params_set_tx_power_t *p_aci_cmd_params_set_tx_power);
  106. /** @brief Encode the ACI message for get device address
  107. *
  108. * @param[in,out] buffer Pointer to ACI message buffer
  109. *
  110. * @return None
  111. */
  112. void acil_encode_cmd_get_address(uint8_t *buffer);
  113. /** @brief Encode the ACI message for send data
  114. *
  115. * @param[in,out] buffer Pointer to ACI message buffer
  116. * @param[in] p_aci_cmd_params_send_data_t Pointer to the data parameters in ::aci_cmd_params_send_data_t
  117. * @param[in] data_size Size of data message
  118. *
  119. * @return None
  120. */
  121. void acil_encode_cmd_send_data(uint8_t *buffer, aci_cmd_params_send_data_t *p_aci_cmd_params_send_data_t, uint8_t data_size);
  122. /** @brief Encode the ACI message for request data
  123. *
  124. * @param[in,out] buffer Pointer to ACI message buffer
  125. * @param[in] p_aci_cmd_params_request_data Pointer to the request data parameters in ::aci_cmd_params_request_data_t
  126. *
  127. * @return None
  128. */
  129. void acil_encode_cmd_request_data(uint8_t *buffer, aci_cmd_params_request_data_t *p_aci_cmd_params_request_data);
  130. /** @brief Encode the ACI message for open remote pipe
  131. *
  132. * @param[in,out] buffer Pointer to ACI message buffer
  133. * @param[in] p_aci_cmd_params_open_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_open_remote_pipe_t
  134. *
  135. * @return None
  136. */
  137. void acil_encode_cmd_open_remote_pipe(uint8_t *buffer, aci_cmd_params_open_remote_pipe_t *p_aci_cmd_params_open_remote_pipe);
  138. /** @brief Encode the ACI message for close remote pipe
  139. *
  140. * @param[in,out] buffer Pointer to ACI message buffer
  141. * @param[in] p_aci_cmd_params_close_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_close_remote_pipe_t
  142. *
  143. * @return None
  144. */
  145. void acil_encode_cmd_close_remote_pipe(uint8_t *buffer, aci_cmd_params_close_remote_pipe_t *p_aci_cmd_params_close_remote_pipe);
  146. /** @brief Encode the ACI message for echo message
  147. *
  148. * @param[in,out] buffer Pointer to ACI message buffer
  149. * @param[in] p_cmd_params_echo Pointer to the dynamic data parameters in ::aci_cmd_params_echo_t
  150. * @param[in] msg_size Size of the message
  151. *
  152. * @return None
  153. */
  154. void acil_encode_cmd_echo_msg(uint8_t *buffer, aci_cmd_params_echo_t *p_cmd_params_echo, uint8_t msg_size);
  155. /** @brief Encode the ACI message to battery level
  156. *
  157. * @param[in,out] buffer Pointer to ACI message buffer
  158. *
  159. * @return None
  160. */
  161. void acil_encode_cmd_battery_level(uint8_t *buffer);
  162. /** @brief Encode the ACI message to temparature
  163. *
  164. * @param[in,out] buffer Pointer to ACI message buffer
  165. *
  166. * @return None
  167. */
  168. void acil_encode_cmd_temparature(uint8_t *buffer);
  169. /** @brief Encode the ACI message to read dynamic data
  170. *
  171. * @param[in,out] buffer Pointer to ACI message buffer
  172. *
  173. * @return None
  174. */
  175. void acil_encode_cmd_read_dynamic_data(uint8_t *buffer);
  176. /** @brief Encode the ACI message to change timing request
  177. *
  178. * @param[in,out] buffer Pointer to ACI message buffer
  179. * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t
  180. *
  181. * @return None
  182. */
  183. void acil_encode_cmd_change_timing_req(uint8_t *buffer, aci_cmd_params_change_timing_t *p_aci_cmd_params_change_timing);
  184. /** @brief Encode the ACI message to change timing request using the timing parameters from GAP PPCP
  185. *
  186. * @param[in,out] buffer Pointer to ACI message buffer
  187. * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t
  188. *
  189. * @return None
  190. */
  191. void acil_encode_cmd_change_timing_req_GAP_PPCP(uint8_t *buffer);
  192. /** @brief Encode the ACI message for write dynamic data
  193. *
  194. * @param[in,out] buffer Pointer to ACI message buffer
  195. * @param[in] seq_no Sequence number of the dynamic data (as received in the response to @c Read Dynamic Data)
  196. * @param[in] dynamic_data Pointer to the dynamic data
  197. * @param[in] dynamic_data_size Size of dynamic data
  198. *
  199. * @return None
  200. */
  201. void acil_encode_cmd_write_dynamic_data(uint8_t *buffer, uint8_t seq_no, uint8_t* dynamic_data, uint8_t dynamic_data_size);
  202. /** @brief Encode the ACI message to send data acknowledgement
  203. *
  204. * @param[in,out] buffer Pointer to ACI message buffer
  205. * @param[in] pipe_number Pipe number for which the ack is to be sent
  206. *
  207. * @return None
  208. */
  209. void acil_encode_cmd_send_data_ack(uint8_t *buffer, const uint8_t pipe_number);
  210. /** @brief Encode the ACI message to send negative acknowledgement
  211. *
  212. * @param[in,out] buffer Pointer to ACI message buffer
  213. * @param[in] pipe_number Pipe number for which the nack is to be sent
  214. * @param[in] error_code Error code that has to be sent in the NACK
  215. *
  216. * @return None
  217. */
  218. void acil_encode_cmd_send_data_nack(uint8_t *buffer, const uint8_t pipe_number,const uint8_t error_code);
  219. /** @brief Encode the ACI message to set the application latency
  220. *
  221. * @param[in,out] buffer Pointer to ACI message buffer
  222. * @param[in] p_aci_cmd_params_set_app_latency Pointer to the set_application_latency command parameters in ::aci_cmd_params_dtm_cmd_t
  223. *
  224. * @return None
  225. */
  226. void acil_encode_cmd_set_app_latency(uint8_t *buffer, aci_cmd_params_set_app_latency_t *p_aci_cmd_params_set_app_latency);
  227. /** @brief Encode the ACI message for setup
  228. *
  229. * @param[in,out] buffer Pointer to ACI message buffer
  230. * @param[in] p_cmd_params_set_run_behaviour Pointer to the setup data in ::aci_cmd_params_setup_t
  231. * @param[in] setup_data_size Size of setup message
  232. *
  233. * @return None
  234. */
  235. void acil_encode_cmd_setup(uint8_t *buffer, aci_cmd_params_setup_t *p_aci_cmd_params_setup, uint8_t setup_data_size);
  236. /** @brief Encode the ACI message for DTM command
  237. *
  238. * @param[in,out] buffer Pointer to ACI message buffer
  239. * @param[in] p_cmd_params_set_run_behaviour Pointer to the DTM command parameters in ::aci_cmd_params_dtm_cmd_t
  240. *
  241. * @return None
  242. */
  243. void acil_encode_cmd_dtm_cmd(uint8_t *buffer, aci_cmd_params_dtm_cmd_t *p_aci_cmd_params_dtm_cmd);
  244. /** @brief Encode the ACI message for Set Key Request command
  245. *
  246. * @param[in,out] buffer Pointer to ACI message buffer
  247. *
  248. * @return None
  249. */
  250. void acil_encode_cmd_set_key(uint8_t *buffer, aci_cmd_params_set_key_t *p_aci_cmd_params_set_key);
  251. /** @brief Encode the ACI message for Bond Security Request command
  252. *
  253. * @param[in,out] buffer Pointer to ACI message buffer
  254. *
  255. * @return None
  256. */
  257. void acil_encode_cmd_bond_security_request(uint8_t *buffer);
  258. /** @brief Encode the ACI message
  259. *
  260. * @param[in,out] buffer Pointer to ACI message buffer
  261. * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_t
  262. * @param[in] bool
  263. *
  264. * @return bool true, if succesful, else returns false
  265. */
  266. bool acil_encode_cmd(uint8_t *buffer, aci_cmd_t *p_aci_cmd);
  267. /** @brief Encode the ACI message for Broadcast command
  268. *
  269. * @param[in,out] buffer Pointer to ACI message buffer
  270. * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_broadcast_t
  271. *
  272. * @return None
  273. */
  274. void acil_encode_cmd_broadcast(uint8_t *buffer, aci_cmd_params_broadcast_t * p_aci_cmd_params_broadcast);
  275. /** @brief Encode the ACI message for Open Adv Pipes
  276. *
  277. * @param[in,out] buffer Pointer to ACI message buffer
  278. * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_open_adv_pipe_t
  279. *
  280. * @return None
  281. */
  282. void acil_encode_cmd_open_adv_pipes(uint8_t *buffer, aci_cmd_params_open_adv_pipe_t * p_aci_cmd_params_set_adv_svc_data);
  283. /** @brief Decode the ACI event command response
  284. *
  285. * @param[in] buffer_in Pointer to message received
  286. * @param[in,out] buffer Pointer to the decoded message in ::aci_evt_params_cmd_rsp_t
  287. *
  288. * @return None
  289. */
  290. void acil_decode_evt_command_response(uint8_t *buffer_in, aci_evt_params_cmd_rsp_t *p_evt_params_cmd_rsp);
  291. /** @brief Decode the ACI event device started
  292. *
  293. * @param[in] buffer_in Pointer to message received
  294. * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_device_started_t
  295. *
  296. * @return None
  297. */
  298. void acil_decode_evt_device_started(uint8_t *buffer_in, aci_evt_params_device_started_t *p_evt_params_device_started);
  299. /** @brief Decode the ACI event pipe status
  300. *
  301. * @param[in] buffer_in Pointer to message received
  302. * @param[in,out] p_aci_evt_params_pipe_status Pointer to the decoded message in ::aci_evt_params_pipe_status_t
  303. *
  304. * @return None
  305. */
  306. void acil_decode_evt_pipe_status(uint8_t *buffer_in, aci_evt_params_pipe_status_t *p_aci_evt_params_pipe_status);
  307. /** @brief Decode the ACI event for disconnected
  308. *
  309. * @param[in] buffer_in Pointer to message received
  310. * @param[in,out] p_aci_evt_params_disconnected Pointer to the decoded message in ::aci_evt_params_disconnected_t
  311. *
  312. * @return None
  313. */
  314. void acil_decode_evt_disconnected(uint8_t *buffer_in, aci_evt_params_disconnected_t *p_aci_evt_params_disconnected);
  315. /** @brief Decode the ACI event for bond status
  316. *
  317. * @param[in] buffer_in Pointer to message received
  318. * @param[in,out] p_aci_evt_params_bond_status Pointer to the decoded message in ::aci_evt_params_bond_status_t
  319. *
  320. * @return None
  321. */
  322. void acil_decode_evt_bond_status(uint8_t *buffer_in, aci_evt_params_bond_status_t *p_aci_evt_params_bond_status);
  323. /** @brief Decode the ACI event for data received
  324. *
  325. * @param[in] buffer_in Pointer to message received
  326. * @param[in,out] p_evt_params_data_received Pointer to the decoded message in ::aci_evt_params_data_received_t
  327. *
  328. * @return size Received data size
  329. */
  330. uint8_t acil_decode_evt_data_received(uint8_t *buffer_in, aci_evt_params_data_received_t *p_evt_params_data_received);
  331. /** @brief Decode the ACI event data acknowledgement
  332. *
  333. * @param[in] buffer_in Pointer to message received
  334. * @param[in,out] p_evt_params_data_ack Pointer to the decoded message in ::aci_evt_params_data_ack_t
  335. *
  336. * @return None
  337. */
  338. void acil_decode_evt_data_ack(uint8_t *buffer_in, aci_evt_params_data_ack_t *p_evt_params_data_ack);
  339. /** @brief Decode the ACI event for hardware error
  340. *
  341. * @param[in] buffer_in Pointer to message received
  342. * @param[in,out] p_aci_evt_params_hw_error Pointer to the decoded message in ::aci_evt_params_hw_error_t
  343. *
  344. * @return size Size of debug information
  345. */
  346. uint8_t acil_decode_evt_hw_error(uint8_t *buffer_in, aci_evt_params_hw_error_t *p_aci_evt_params_hw_error);
  347. /** @brief Decode the ACI event data credit
  348. *
  349. * @param[in] buffer_in Pointer to message received
  350. * @param[in,out] p_evt_params_data_credit Pointer to the decoded message in ::aci_evt_params_data_credit_t
  351. *
  352. * @return None
  353. */
  354. void acil_decode_evt_credit(uint8_t *buffer_in, aci_evt_params_data_credit_t *p_evt_params_data_credit);
  355. /** @brief Decode the ACI event for connected
  356. *
  357. * @param[in] buffer_in Pointer to message received
  358. * @param[in,out] p_aci_evt_params_connected Pointer to the decoded message in ::aci_evt_params_connected_t
  359. *
  360. * @return None
  361. */
  362. void acil_decode_evt_connected(uint8_t *buffer_in, aci_evt_params_connected_t *p_aci_evt_params_connected);
  363. /** @brief Decode the ACI event for timing
  364. *
  365. * @param[in] buffer_in Pointer to message received
  366. * @param[in,out] p_evt_params_timing Pointer to the decoded message in ::aci_evt_params_timing_t
  367. *
  368. * @return None
  369. */
  370. void acil_decode_evt_timing(uint8_t *buffer_in, aci_evt_params_timing_t *p_evt_params_timing);
  371. /** @brief Decode the ACI event for pipe error
  372. *
  373. * @param[in] buffer_in Pointer to message received
  374. * @param[in,out] p_evt_params_pipe_error Pointer to the decoded message in ::aci_evt_params_pipe_error_t
  375. *
  376. */
  377. void acil_decode_evt_pipe_error(uint8_t *buffer_in, aci_evt_params_pipe_error_t *p_evt_params_pipe_error);
  378. /** @brief Decode the ACI event for key request
  379. *
  380. * @param[in] buffer_in Pointer to message received
  381. * @param[in,out] p_evt_params_key_type Pointer to the decoded message in ::aci_evt_params_key_type_t
  382. *
  383. * @return None
  384. */
  385. void acil_decode_evt_key_request(uint8_t *buffer_in, aci_evt_params_key_request_t *p_evt_params_key_request);
  386. /** @brief Decode the ACI event for echo
  387. *
  388. * @param[in] buffer_in Pointer to message received
  389. * @param[in,out] buffer_out Pointer to the echo message (max size of buffer ::ACI_ECHO_DATA_MAX_LEN)
  390. *
  391. * @return size Received echo message size
  392. */
  393. uint8_t acil_decode_evt_echo(uint8_t *buffer_in, aci_evt_params_echo_t *buffer_out);
  394. /** @brief Decode the ACI event
  395. *
  396. * @param[in] buffer_in Pointer to message received
  397. * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_t
  398. *
  399. * @return bool true, if succesful, else returns false
  400. */
  401. bool acil_decode_evt(uint8_t *buffer_in, aci_evt_t *p_aci_evt);
  402. /** @brief Decode the Display Key Event
  403. *
  404. * @param[in] buffer_in Pointer to message received
  405. * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_display_passkey_t
  406. *
  407. * @return None
  408. */
  409. void acil_decode_evt_display_passkey(uint8_t *buffer_in, aci_evt_params_display_passkey_t *p_aci_evt_params_display_passkey);
  410. #endif /* _acilib_IF_H_ */