MiLightRadio.h 893 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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[10];
  34. uint8_t _out_packet[10];
  35. bool _waiting;
  36. int _dupes_received;
  37. };
  38. #endif /* MILIGHTRADIO_H_ */