Download the file
  1. #ifndef RELAY_CONTROLLER_MASTER_H
  2. #define RELAY_CONTROLLER_MASTER_H
  3.  
  4. #include <HardwareSerial.h>
  5.  
  6. extern HardwareSerial Serial;
  7.  
  8. #define BUFFER_LEN 12
  9.  
  10. #define SLAVE_ID 1
  11. #define MASTER_ID 2
  12. #define HEATER_GROUP 43
  13.  
  14. #define SEND_RETRY_COUNT 3
  15. #define SEND_RETRY_TIMEOUT 3000
  16.  
  17. #define REPLY_TIMEOUT 30000
  18.  
  19. #define NACK_ERROR 1
  20. #define BAD_COMMAND_ERROR 2
  21. #define BAD_MESSAGE_ERROR 3
  22. #define NO_REPLY_ERROR 4
  23.  
  24. #define SHOW_BUFFER(tag, hdr, buf, len) \
  25. Serial.print(tag); \
  26. if (hdr & RF12_HDR_CTL) Serial.print("CTL "); \
  27. if (hdr & RF12_HDR_DST) Serial.print("DST "); \
  28. if (hdr & RF12_HDR_ACK) Serial.print("ACK "); \
  29. Serial.print(hdr & RF12_HDR_MASK, DEC); \
  30. Serial.print(" [ "); \
  31.  for (int i=0; i<len; i++) { \
  32.   Serial.print(buf[i], HEX); Serial.print(" "); \
  33. } \
  34. Serial.println("]")
  35.  
  36. #define NB_ELEMENTS(a) sizeof(a) / sizeof(a[0])
  37.  
  38. #endif
  39. // vim:ft=arduino
  40.