Safe Sprinkler
Master/slave irrigation system (ESP-NOW + LoRaWAN)
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
switch.h File Reference
#include "driver/gpio.h"
#include "esp_attr.h"
#include "esp_err.h"
Include dependency graph for switch.h:

Go to the source code of this file.

Data Structures

struct  on_off_switch_t
 

Enumerations

enum  switch_state_t { SWITCH_OFF = 0 , SWITCH_ON = 1 }
 

Functions

void IRAM_ATTR switch_isr_handler (void *arg)
 GPIO interrupt handler for an on/off switch.
 

Enumeration Type Documentation

◆ switch_state_t

Enumerator
SWITCH_OFF 
SWITCH_ON 

Function Documentation

◆ switch_isr_handler()

void IRAM_ATTR switch_isr_handler ( void *  arg)

GPIO interrupt handler for an on/off switch.

Call from GPIO ISR; debounces and toggles switch state (SWITCH_ON <-> SWITCH_OFF). arg must be a pointer to the on_off_switch_t for this switch.

Parameters
argUser argument: pointer to on_off_switch_t (passed to gpio_isr_handler_add)