organize pin_control

This commit is contained in:
Fabian Montero 2023-09-12 00:20:25 -06:00
parent 25df6dae36
commit 3564d79100
Signed by: fabian
GPG key ID: 1FFAC35E1798174F
2 changed files with 2 additions and 6 deletions

View file

@ -5,10 +5,6 @@ int init_gpio();
void cleanup_gpio();
int set_pin_state(int pin, int state);
int read_button(int pin);
int turn_on_pin(int pin);
int turn_off_pin(int pin);

View file

@ -22,7 +22,7 @@ void cleanup_gpio() {
gpiod_chip_close(chip);
}
int set_pin_state(int pin, int state) {
static int set_pin_state(int pin, int state) {
// https://libgpiod-dlang.dpldocs.info/gpiod.gpiod_chip_get_line.html
struct gpiod_line *line = gpiod_chip_get_line(chip, pin); // this may need an offset
if (!line) {
@ -73,7 +73,7 @@ int turn_off_all_pins() {
return 0;
}
int button_presssed(int event, unsigned int pin, const struct timespec * timestamp, void *data) {
static int button_presssed(int event, unsigned int pin, const struct timespec * timestamp, void *data) {
(void) event;
(void) timestamp;
* (int *) data = (int) pin;