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
41
typedef
struct
Button
42
{
43
gpio_num_t
gpio
;
44
union
45
{
46
gpio_pullup_t
up
;
47
gpio_pulldown_t
down
;
48
}
pull_sel
;
49
void (*
func
)(
void
*arg);
50
}
Button
;
51
59
void
buttonInit
(
Button
*button);
60
67
int
buttonRead
(
Button
*button);
68
75
void
buttonInitIRQ
(
Button
*button);
76
82
extern
void
buttonInterrupt
(
void
*arg);
83
84
#endif
buttonInterrupt
void buttonInterrupt(void *arg)
buttonInterrupt will be an general routine for buttons interrupts.
buttonInitIRQ
void buttonInitIRQ(Button *button)
buttonInitIRQ will intialize button for interrupt routine
Definition:
button.c:60
buttonInit
void buttonInit(Button *button)
Button Initialization for buttons.
Definition:
button.c:23
buttonRead
int buttonRead(Button *button)
buttonRead will read the gpio pin
Definition:
button.c:49
Button
Custom Button structure to automate button setup.
Definition:
button.h:42
Button::gpio
gpio_num_t gpio
Definition:
button.h:43
Button::down
gpio_pulldown_t down
Definition:
button.h:47
Button::pull_sel
union Button::@0 pull_sel
Button::func
void(* func)(void *arg)
Definition:
button.h:49
Button::up
gpio_pullup_t up
Definition:
button.h:46
firmware
main
inc
button.h
v2.0