radio.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND
  3. * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER.
  4. * CONSEQUENTLY, SEMTECH SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
  5. * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
  6. * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
  7. * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  8. *
  9. * Copyright (C) SEMTECH S.A.
  10. */
  11. /*!
  12. * \file radio.h
  13. * \brief Generic radio driver ( radio abstraction )
  14. *
  15. * \version 2.0.B2
  16. * \date Nov 21 2012
  17. * \author Miguel Luis
  18. *
  19. * Last modified by Gregory Cristian on Apr 25 2013
  20. */
  21. #ifndef __RADIO_H__
  22. #define __RADIO_H__
  23. /*!
  24. * SX1272 and SX1276 General parameters definition
  25. */
  26. #define LORA 1 // [0: OFF, 1: ON]
  27. /*!
  28. * RF process function return codes
  29. */
  30. typedef enum
  31. {
  32. RF_IDLE,
  33. RF_BUSY,
  34. RF_RX_DONE,
  35. RF_RX_TIMEOUT,
  36. RF_TX_DONE,
  37. RF_TX_TIMEOUT,
  38. RF_LEN_ERROR,
  39. RF_CHANNEL_EMPTY,
  40. RF_CHANNEL_ACTIVITY_DETECTED,
  41. }tRFProcessReturnCodes;
  42. /*!
  43. * Radio driver structure defining the different function pointers
  44. */
  45. typedef struct sRadioDriver
  46. {
  47. void ( *Init )( void );
  48. void ( *Reset )( void );
  49. void ( *StartRx )( void );
  50. void ( *GetRxPacket )( void *buffer, uint16_t *size );
  51. void ( *SetTxPacket )( const void *buffer, uint16_t size );
  52. uint32_t ( *Process )( void );
  53. }tRadioDriver;
  54. /*!
  55. * \brief Initializes the RadioDriver structure with specific radio
  56. * functions.
  57. *
  58. * \retval radioDriver Pointer to the radio driver variable
  59. */
  60. tRadioDriver* RadioDriverInit( void );
  61. #endif // __RADIO_H__