Elevator v2.0
Elevator Documenation
Loading...
Searching...
No Matches
button.h
Go to the documentation of this file.
1
11#ifndef _BUTTON_H_
12#define _BUTTON_H_
13
14#include <stdio.h>
15#include "freertos/FreeRTOS.h"
16#include "freertos/task.h"
17#include "driver/gpio.h"
18
19#define ESP_INTR_FLAG_DEFAULT 0 //default interrupt flag
20#define PULL_SEL_EN 1 // enable selected pull selection
21
41typedef struct Button
42{
43 gpio_num_t gpio;
44 union
45 {
46 gpio_pullup_t up;
47 gpio_pulldown_t down;
49 void (*func)(void *arg);
51
59void buttonInit(Button *button);
60
67int buttonRead(Button *button);
68
75void buttonInitIRQ(Button *button);
76
82extern void buttonInterrupt(void *arg);
83
84#endif
void buttonInterrupt(void *arg)
buttonInterrupt will be an general routine for buttons interrupts.
void buttonInitIRQ(Button *button)
buttonInitIRQ will intialize button for interrupt routine
Definition: button.c:60
void buttonInit(Button *button)
Button Initialization for buttons.
Definition: button.c:23
int buttonRead(Button *button)
buttonRead will read the gpio pin
Definition: button.c:49
Custom Button structure to automate button setup.
Definition: button.h:42
gpio_num_t gpio
Definition: button.h:43
gpio_pulldown_t down
Definition: button.h:47
union Button::@0 pull_sel
void(* func)(void *arg)
Definition: button.h:49
gpio_pullup_t up
Definition: button.h:46