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.

34 lines
775 B

  1. /*
  2. LIGHT MODULE
  3. */
  4. #pragma once
  5. #include "espurna.h"
  6. constexpr const unsigned char _lightEnablePin() {
  7. return LIGHT_ENABLE_PIN;
  8. }
  9. constexpr const unsigned char _lightChannelPin(unsigned char index) {
  10. return (
  11. (index == 0) ? LIGHT_CH1_PIN :
  12. (index == 1) ? LIGHT_CH2_PIN :
  13. (index == 2) ? LIGHT_CH3_PIN :
  14. (index == 3) ? LIGHT_CH4_PIN :
  15. (index == 4) ? LIGHT_CH5_PIN : GPIO_NONE
  16. );
  17. }
  18. constexpr const bool _lightInverse(unsigned char index) {
  19. return (
  20. (index == 0) ? (1 == LIGHT_CH1_INVERSE) :
  21. (index == 1) ? (1 == LIGHT_CH2_INVERSE) :
  22. (index == 2) ? (1 == LIGHT_CH3_INVERSE) :
  23. (index == 3) ? (1 == LIGHT_CH4_INVERSE) :
  24. (index == 4) ? (1 == LIGHT_CH5_INVERSE) : false
  25. );
  26. }