MiLightRadio.h 719 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * MiLightRadio.h
  3. *
  4. * Created on: 29 May 2015
  5. * Author: henryk
  6. */
  7. #ifdef ARDUINO
  8. #include "Arduino.h"
  9. #else
  10. #include <stdint.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #endif
  14. #include "AbstractPL1167.h"
  15. #ifndef MILIGHTRADIO_H_
  16. #define MILIGHTRADIO_H_
  17. class MiLightRadio {
  18. public:
  19. MiLightRadio(AbstractPL1167 &pl1167);
  20. int begin();
  21. bool available();
  22. int read(uint8_t frame[], size_t &frame_length);
  23. int dupesReceived();
  24. int write(uint8_t frame[], size_t frame_length);
  25. int resend();
  26. private:
  27. AbstractPL1167 &_pl1167;
  28. uint32_t _prev_packet_id;
  29. uint8_t _packet[8], _out_packet[8];
  30. bool _waiting;
  31. int _dupes_received;
  32. };
  33. #endif /* MILIGHTRADIO_H_ */