radio.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*! @file radio.h
  2. * @brief This file contains the public functions controlling the radio chip.
  3. *
  4. * @b COPYRIGHT
  5. * @n Silicon Laboratories Confidential
  6. * @n Copyright 2012 Silicon Laboratories, Inc.
  7. * @n http://www.silabs.com
  8. */
  9. #ifndef RADIO_H_
  10. #define RADIO_H_
  11. #include "stm32f10x.h"
  12. #include <stdbool.h>
  13. /*****************************************************************************
  14. * Global Macros & Definitions
  15. *****************************************************************************/
  16. extern uint8_t fixRadioPacket[];
  17. extern uint8_t customRadioPacket[];
  18. /*! Maximal packet length definition (FIFO size) */
  19. #define RADIO_MAX_PACKET_LENGTH 64
  20. /*****************************************************************************
  21. * Global Typedefs & Enums
  22. *****************************************************************************/
  23. typedef struct
  24. {
  25. uint8_t *Radio_ConfigurationArray;
  26. uint8_t Radio_ChannelNumber;
  27. uint8_t Radio_PacketLength;
  28. uint8_t Radio_State_After_Power_Up;
  29. uint16_t Radio_Delay_Cnt_After_Reset;
  30. uint8_t Radio_CustomPayload[RADIO_MAX_PACKET_LENGTH];
  31. } tRadioConfiguration;
  32. typedef enum
  33. {
  34. RFLR_STATE_IDLE,
  35. RFLR_STATE_RX_INIT,
  36. RFLR_STATE_RX_RUNNING,
  37. RFLR_STATE_RX_DONE,
  38. RFLR_STATE_RX_ACK_INIT,
  39. RFLR_STATE_RX_ACK_DONE,
  40. RFLR_STATE_RX_TIMEOUT,
  41. RFLR_STATE_TX_INIT,
  42. RFLR_STATE_TX_RUNNING,
  43. RFLR_STATE_TX_DONE,
  44. RFLR_STATE_TX_TIMEOUT,
  45. RFLR_STATE_TX_ACK_INIT,
  46. RFLR_STATE_TX_ACK_DONE,
  47. RFLR_STATE_SLEEP,
  48. }tRFLRStates;
  49. extern tRadioConfiguration* pRadioConfiguration;
  50. extern tRadioConfiguration RadioConfiguration;
  51. extern uint8_t Radio_Configuration_Data_Array[];
  52. extern uint8_t customRadioPacket[];
  53. void vRadio_Init(void);
  54. void vRadio_StartTx(uint8_t, uint8_t *);
  55. uint8_t bRadio_Check_Ezconfig(uint16_t);
  56. bool gRadio_CheckTransmitted(void);
  57. uint8_t bRadio_Check_Tx_RX(void);
  58. void vRadio_StartRX(uint8_t channel, uint8_t packetLenght );
  59. void vRadio_StartTx_Variable_Packet(uint8_t channel, uint8_t *pioRadioPacket, uint8_t length);
  60. void vRadio_StartSleep(void);
  61. uint16_t vRadio_getRxCount(void);
  62. uint8_t vRadio_getRssi(void);
  63. uint8_t vRadio_getPacketRssi(void);
  64. #endif /* RADIO_H_ */