NRF24MiLightRadio.h 872 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifdef ARDUINO
  2. #include "Arduino.h"
  3. #else
  4. #include <stdint.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #endif
  8. #include <RF24.h>
  9. #include <PL1167_nRF24.h>
  10. #include <MiLightRadioConfig.h>
  11. #include <MiLightRadio.h>
  12. #ifndef _NRF24_MILIGHT_RADIO_H_
  13. #define _NRF24_MILIGHT_RADIO_H_
  14. class NRF24MiLightRadio : public MiLightRadio {
  15. public:
  16. NRF24MiLightRadio(RF24& rf, const MiLightRadioConfig& config);
  17. int begin();
  18. bool available();
  19. int read(uint8_t frame[], size_t &frame_length);
  20. int dupesReceived();
  21. int write(uint8_t frame[], size_t frame_length);
  22. int resend();
  23. int configure();
  24. const MiLightRadioConfig& config();
  25. private:
  26. PL1167_nRF24 _pl1167;
  27. const MiLightRadioConfig& _config;
  28. uint32_t _prev_packet_id;
  29. uint8_t _packet[10];
  30. uint8_t _out_packet[10];
  31. bool _waiting;
  32. int _dupes_received;
  33. };
  34. #endif