MiLightRadio.h 849 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include <MiLightRadioConfig.h>
  16. #ifndef MILIGHTRADIO_H_
  17. #define MILIGHTRADIO_H_
  18. class MiLightRadio {
  19. public:
  20. MiLightRadio(AbstractPL1167 &pl1167, const MiLightRadioConfig& config);
  21. int begin();
  22. bool available();
  23. int read(uint8_t frame[], size_t &frame_length);
  24. int dupesReceived();
  25. int write(uint8_t frame[], size_t frame_length);
  26. int resend();
  27. int configure();
  28. private:
  29. AbstractPL1167 &_pl1167;
  30. const MiLightRadioConfig& config;
  31. uint32_t _prev_packet_id;
  32. uint8_t _packet[8], _out_packet[8];
  33. bool _waiting;
  34. int _dupes_received;
  35. };
  36. #endif /* MILIGHTRADIO_H_ */