radio.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.c
  13. * \brief Generic radio driver ( radio abstraction )
  14. *
  15. * \version 2.0.0
  16. * \date Nov 21 2012
  17. * \author Miguel Luis
  18. *
  19. * Last modified by Gregory Cristian on Apr 25 2013
  20. */
  21. #include "platform.h"
  22. #include "radio.h"
  23. #if defined( USE_SX1232_RADIO )
  24. #include "sx1232.h"
  25. #elif defined( USE_SX1272_RADIO )
  26. #include "sx1272.h"
  27. #elif defined( USE_SX1276_RADIO )
  28. #include "sx1276.h"
  29. #else
  30. #error "Missing define: USE_XXXXXX_RADIO (ie. USE_SX1272_RADIO)"
  31. #endif
  32. tRadioDriver RadioDriver;
  33. tRadioDriver* RadioDriverInit( void )
  34. {
  35. #if defined( USE_SX1232_RADIO )
  36. RadioDriver.Init = SX1232Init;
  37. RadioDriver.Reset = SX1232Reset;
  38. RadioDriver.StartRx = SX1232StartRx;
  39. RadioDriver.GetRxPacket = SX1232GetRxPacket;
  40. RadioDriver.SetTxPacket = SX1232SetTxPacket;
  41. RadioDriver.Process = SX1232Process;
  42. #elif defined( USE_SX1272_RADIO )
  43. RadioDriver.Init = SX1272Init;
  44. RadioDriver.Reset = SX1272Reset;
  45. RadioDriver.StartRx = SX1272StartRx;
  46. RadioDriver.GetRxPacket = SX1272GetRxPacket;
  47. RadioDriver.SetTxPacket = SX1272SetTxPacket;
  48. RadioDriver.Process = SX1272Process;
  49. #elif defined( USE_SX1276_RADIO )
  50. RadioDriver.Init = SX1276Init;
  51. RadioDriver.Reset = SX1276Reset;
  52. RadioDriver.StartRx = SX1276StartRx;
  53. RadioDriver.GetRxPacket = SX1276GetRxPacket;
  54. RadioDriver.SetTxPacket = SX1276SetTxPacket;
  55. RadioDriver.Process = SX1276Process;
  56. #else
  57. #error "Missing define: USE_XXXXXX_RADIO (ie. USE_SX1272_RADIO)"
  58. #endif
  59. return &RadioDriver;
  60. }