mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Generalize pinmode for most digitalwrites
This commit is contained in:
parent
90a14ee518
commit
84314cf921
@ -1327,14 +1327,9 @@ void SetPin(uint32_t lpin, uint32_t gpio) {
|
||||
}
|
||||
|
||||
void DigitalWrite(uint32_t gpio_pin, uint32_t index, uint32_t state) {
|
||||
static uint64_t pinmode_init = 0; // Pins 0 to 63 !!!
|
||||
|
||||
if (PinUsed(gpio_pin, index)) {
|
||||
uint32_t pin = Pin(gpio_pin, index);
|
||||
if (!bitRead(pinmode_init, pin)) {
|
||||
pinMode(pin, OUTPUT);
|
||||
bitSet(pinmode_init, pin);
|
||||
}
|
||||
pinMode(pin, OUTPUT);
|
||||
digitalWrite(pin, state &1);
|
||||
}
|
||||
}
|
||||
|
@ -2048,11 +2048,7 @@ void GpioInit(void)
|
||||
#endif // ESP8266
|
||||
}
|
||||
|
||||
if (PinUsed(GPIO_HEARTBEAT)) {
|
||||
// pinMode(Pin(GPIO_HEARTBEAT), OUTPUT);
|
||||
// digitalWrite(Pin(GPIO_HEARTBEAT), TasmotaGlobal.heartbeat_inverted);
|
||||
DigitalWrite(GPIO_HEARTBEAT, 0, TasmotaGlobal.heartbeat_inverted);
|
||||
}
|
||||
DigitalWrite(GPIO_HEARTBEAT, 0, TasmotaGlobal.heartbeat_inverted);
|
||||
|
||||
// Digital input
|
||||
for (uint32_t i = 0; i < MAX_SWITCHES; i++) {
|
||||
@ -2123,19 +2119,13 @@ void GpioInit(void)
|
||||
} else {
|
||||
#endif
|
||||
TasmotaGlobal.leds_present++;
|
||||
// pinMode(Pin(GPIO_LED1, i), OUTPUT);
|
||||
// digitalWrite(Pin(GPIO_LED1, i), bitRead(TasmotaGlobal.led_inverted, i));
|
||||
DigitalWrite(GPIO_LED1, i, bitRead(TasmotaGlobal.led_inverted, i));
|
||||
#ifdef USE_ARILUX_RF
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (PinUsed(GPIO_LEDLNK)) {
|
||||
// pinMode(Pin(GPIO_LEDLNK), OUTPUT);
|
||||
// digitalWrite(Pin(GPIO_LEDLNK), TasmotaGlobal.ledlnk_inverted);
|
||||
DigitalWrite(GPIO_LEDLNK, 0, TasmotaGlobal.ledlnk_inverted);
|
||||
}
|
||||
DigitalWrite(GPIO_LEDLNK, 0, TasmotaGlobal.ledlnk_inverted);
|
||||
|
||||
#ifdef USE_PWM_DIMMER
|
||||
if (PWM_DIMMER == TasmotaGlobal.module_type && PinUsed(GPIO_REL1)) { TasmotaGlobal.devices_present--; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user