PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

109 rindas
3.4KB

  1. /* Copyright (c) 2009 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. /** @file
  14. * @brief Interface for hal_aci_tl.
  15. */
  16. /** @defgroup hal_aci_tl hal_aci_tl
  17. @{
  18. @ingroup hal
  19. @brief Module for the ACI Transport Layer interface
  20. @details This module is responsible for sending and receiving messages over the ACI interface of the nRF8001 chip.
  21. The hal_aci_tl_send_cmd() can be called directly to send ACI commands.
  22. The RDYN line is hooked to an interrupt on the MCU when the level is low.
  23. The SPI master clocks in the interrupt context.
  24. The ACI Command is taken from the head of the command queue is sent over the SPI
  25. and the received ACI event is placed in the tail of the event queue.
  26. */
  27. #ifndef HAL_ACI_TL_H__
  28. #define HAL_ACI_TL_H__
  29. #include "hal_platform.h"
  30. #ifndef HAL_ACI_MAX_LENGTH
  31. #define HAL_ACI_MAX_LENGTH 31
  32. #endif //HAL_ACI_MAX_LENGTH
  33. #define ACI_QUEUE_SIZE 8
  34. /** Data type for ACI commands and events */
  35. typedef struct hal_aci_data_t{
  36. uint8_t status_byte;
  37. uint8_t buffer[HAL_ACI_MAX_LENGTH+1];
  38. } hal_aci_data_t;
  39. /** @brief Message received hook function.
  40. * @details A hook function that must be implemented by the client of this module.
  41. * The function will be called by this module when a new message has been received from the nRF8001.
  42. * @param received_msg Pointer to a structure containing a pointer to the received data.
  43. */
  44. extern void hal_aci_tl_msg_rcv_hook(hal_aci_data_t *received_msg);
  45. /** ACI Transport Layer configures inputs/outputs.
  46. */
  47. void hal_aci_tl_io_config(void);
  48. /** ACI Transport Layer initialization.
  49. */
  50. void hal_aci_tl_init(void);
  51. /**@brief Sends an ACI command to the radio.
  52. * @details
  53. * This function sends an ACI command to the radio. This will memorize the pointer of the message to send and
  54. * lower the request line. When the device lowers the ready line, @ref hal_aci_tl_poll_rdy_line() will send the data.
  55. * @param aci_buffer Pointer to the message to send.
  56. * @return True if the send is started successfully, false if a transaction is already running.
  57. */
  58. bool hal_aci_tl_send(hal_aci_data_t *aci_buffer);
  59. /** @brief Check for pending transaction.
  60. * @details
  61. * Call this function from the main context at regular intervals to check if the nRF8001 RDYN line indicates a pending transaction.
  62. * If a transaction is pending, this function will treat it and call the receive hook.
  63. */
  64. void hal_aci_tl_poll_rdy_line(void);
  65. hal_aci_data_t * hal_aci_tl_poll_get(void);
  66. bool hal_aci_tl_event_get(hal_aci_data_t *p_aci_data);
  67. /** @brief Flush the ACI command Queue and the ACI Event Queue
  68. * @details
  69. * Call this function in the main thread
  70. */
  71. void m_aci_q_flush(void);
  72. /** @brief Enable debug printing of all ACI commands sent and ACI events received
  73. * @details
  74. * when the enable parameter is true. The debug printing is enabled on the Serial.
  75. * When the enable parameter is false. The debug printing is disabled on the Serial.
  76. * By default the debug printing is disabled.
  77. */
  78. void hal_aci_debug_print(bool enable);
  79. #endif // HAL_ACI_TL_H__
  80. /** @} */