Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

  1. /*
  2. LED MODULE
  3. */
  4. #pragma once
  5. constexpr const unsigned char _ledPin(unsigned char index) {
  6. return (
  7. (index == 0) ? LED1_PIN :
  8. (index == 1) ? LED2_PIN :
  9. (index == 2) ? LED3_PIN :
  10. (index == 3) ? LED4_PIN :
  11. (index == 4) ? LED5_PIN :
  12. (index == 5) ? LED6_PIN :
  13. (index == 6) ? LED7_PIN :
  14. (index == 7) ? LED8_PIN : GPIO_NONE
  15. );
  16. }
  17. constexpr const unsigned char _ledMode(unsigned char index) {
  18. return (
  19. (index == 0) ? LED1_MODE :
  20. (index == 1) ? LED2_MODE :
  21. (index == 2) ? LED3_MODE :
  22. (index == 3) ? LED4_MODE :
  23. (index == 4) ? LED5_MODE :
  24. (index == 5) ? LED6_MODE :
  25. (index == 6) ? LED7_MODE :
  26. (index == 7) ? LED8_MODE : LED_MODE_WIFI
  27. );
  28. }
  29. constexpr const unsigned char _ledRelay(unsigned char index) {
  30. return (
  31. (index == 0) ? (LED1_RELAY - 1) :
  32. (index == 1) ? (LED2_RELAY - 1) :
  33. (index == 2) ? (LED3_RELAY - 1) :
  34. (index == 3) ? (LED4_RELAY - 1) :
  35. (index == 4) ? (LED5_RELAY - 1) :
  36. (index == 5) ? (LED6_RELAY - 1) :
  37. (index == 6) ? (LED7_RELAY - 1) :
  38. (index == 7) ? (LED8_RELAY - 1) : RELAY_NONE
  39. );
  40. }
  41. constexpr const bool _ledInverse(unsigned char index) {
  42. return (
  43. (index == 0) ? (1 == LED1_PIN_INVERSE) :
  44. (index == 1) ? (1 == LED2_PIN_INVERSE) :
  45. (index == 2) ? (1 == LED3_PIN_INVERSE) :
  46. (index == 3) ? (1 == LED4_PIN_INVERSE) :
  47. (index == 4) ? (1 == LED5_PIN_INVERSE) :
  48. (index == 5) ? (1 == LED6_PIN_INVERSE) :
  49. (index == 6) ? (1 == LED7_PIN_INVERSE) :
  50. (index == 7) ? (1 == LED8_PIN_INVERSE) : false
  51. );
  52. }