myRadio.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __MY_RADIO_H
  2. #define __MY_RADIO_H
  3. /* Includes ------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <stdbool.h>
  6. #include <stdint.h>
  7. #include <string.h>
  8. #define MAX_RF_PACKET_LEN 128
  9. //! \brief Structure for the TX Packet
  10. typedef struct
  11. {
  12. uint8_t rmvAddr[8]; //
  13. uint32_t absTime; //
  14. uint8_t len; //
  15. uint8_t payload[MAX_RF_PACKET_LEN]; //
  16. } rfTxPacket_ts;
  17. typedef struct
  18. {
  19. uint8_t rmvAddr[8]; //
  20. int8_t rssi; //
  21. uint32_t absTime; //
  22. uint32_t rxTimeout; //
  23. uint8_t len; //
  24. uint8_t payload[MAX_RF_PACKET_LEN];
  25. } rfRxPacket_ts;
  26. typedef enum
  27. {
  28. RADIO_EXT_CONTROL_TX_UNMODULATED, //데潼꺼묘쪽꿎桿
  29. RADIO_EXT_CONTROL_RX_SENSITIVITY, //쌈澗쥣츌똑꿎桿
  30. }controlMode_te;
  31. typedef enum
  32. {
  33. RX_STA_SECCESS,
  34. RX_STA_TIMEOUT,
  35. RX_STA_PAYLOAD_ERROR,
  36. TX_STA_SECCESS,
  37. TX_STA_ERROR,
  38. }rxStatus_te;
  39. typedef void (*rfRxCallBack)(uint8_t status, rfRxPacket_ts packet);
  40. void myRadio_delay(uint32_t time_ms);
  41. void myRadio_init(int agr0, void *agr1_ptr);
  42. void myRadio_transmit(rfTxPacket_ts *packet);
  43. void myRadio_receiver(void);
  44. void myRadio_receiverSync(rfRxPacket_ts *packet);
  45. void myRadio_abort(void);
  46. void myRadio_setCtrl(controlMode_te mode, uint32_t value);
  47. void myRadio_process(void);
  48. uint32_t myRadio_getFrequency(void);
  49. void myRadio_setFrequency(uint32_t freq);
  50. int8_t myRadio_getRssi(void);
  51. int8_t myRadio_getTxPower(void);
  52. void myRadio_setTxPower(int8_t power);
  53. void myRadio_setChipType(uint8_t type);
  54. uint8_t myRadio_getChipType(void);
  55. #endif