You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
1.0 KiB

  1. #ifndef __RFM12_H__
  2. #define __RFM12_H__
  3. /* ************************************************************************ */
  4. #define RFM12_PKT_SYNC_SIZE 2
  5. #define RFM12_PKT_HEADER_SIZE 4
  6. #define RFM12_PKT_MAX_DATA_SIZE 42
  7. struct rfm12_packet
  8. {
  9. /* tx-only sync bytes */
  10. uint8_t sync[RFM12_PKT_SYNC_SIZE];
  11. /* Header */
  12. uint8_t dest_address;
  13. uint8_t source_address;
  14. uint8_t data_length;
  15. uint8_t header_checksum;
  16. /* Data */
  17. uint8_t data[RFM12_PKT_MAX_DATA_SIZE];
  18. uint16_t data_crc;
  19. };
  20. /* ************************************************************************ */
  21. void rfm12_init (uint8_t own_address);
  22. void rfm12_tick (uint8_t channel_free_time);
  23. struct rfm12_packet * rfm12_get_txpkt (void);
  24. uint8_t rfm12_start_tx (void);
  25. struct rfm12_packet * rfm12_get_rxpkt (void);
  26. void rfm12_clear_rx (void);
  27. /* ************************************************************************ */
  28. #endif /* __RFM12_H__ */