MiLightRadio.h 871 B

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