|
|
- /*
-
- RELAY MODULE
-
- */
-
- #pragma once
-
- #include "espurna.h"
-
- constexpr const unsigned long _relayDelayOn(unsigned char index) {
- return (
- (index == 0) ? RELAY1_DELAY_ON :
- (index == 1) ? RELAY2_DELAY_ON :
- (index == 2) ? RELAY3_DELAY_ON :
- (index == 3) ? RELAY4_DELAY_ON :
- (index == 4) ? RELAY5_DELAY_ON :
- (index == 5) ? RELAY6_DELAY_ON :
- (index == 6) ? RELAY7_DELAY_ON :
- (index == 7) ? RELAY8_DELAY_ON : 0
- );
- }
-
- constexpr const unsigned long _relayDelayOff(unsigned char index) {
- return (
- (index == 0) ? RELAY1_DELAY_OFF :
- (index == 1) ? RELAY2_DELAY_OFF :
- (index == 2) ? RELAY3_DELAY_OFF :
- (index == 3) ? RELAY4_DELAY_OFF :
- (index == 4) ? RELAY5_DELAY_OFF :
- (index == 5) ? RELAY6_DELAY_OFF :
- (index == 6) ? RELAY7_DELAY_OFF :
- (index == 7) ? RELAY8_DELAY_OFF : 0
- );
- }
-
- constexpr const unsigned char _relayPin(unsigned char index) {
- return (
- (index == 0) ? RELAY1_PIN :
- (index == 1) ? RELAY2_PIN :
- (index == 2) ? RELAY3_PIN :
- (index == 3) ? RELAY4_PIN :
- (index == 4) ? RELAY5_PIN :
- (index == 5) ? RELAY6_PIN :
- (index == 6) ? RELAY7_PIN :
- (index == 7) ? RELAY8_PIN : GPIO_NONE
- );
- }
-
- constexpr const unsigned char _relayType(unsigned char index) {
- return (
- (index == 0) ? RELAY1_TYPE :
- (index == 1) ? RELAY2_TYPE :
- (index == 2) ? RELAY3_TYPE :
- (index == 3) ? RELAY4_TYPE :
- (index == 4) ? RELAY5_TYPE :
- (index == 5) ? RELAY6_TYPE :
- (index == 6) ? RELAY7_TYPE :
- (index == 7) ? RELAY8_TYPE : RELAY_TYPE_NORMAL
- );
- }
-
- constexpr const unsigned char _relayResetPin(unsigned char index) {
- return (
- (index == 0) ? RELAY1_RESET_PIN :
- (index == 1) ? RELAY2_RESET_PIN :
- (index == 2) ? RELAY3_RESET_PIN :
- (index == 3) ? RELAY4_RESET_PIN :
- (index == 4) ? RELAY5_RESET_PIN :
- (index == 5) ? RELAY6_RESET_PIN :
- (index == 6) ? RELAY7_RESET_PIN :
- (index == 7) ? RELAY8_RESET_PIN : GPIO_NONE
- );
- }
-
|