MiLightRadio.h 950 B

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