ready to test GPIO code
This commit is contained in:
parent
2da798238b
commit
a2335a9d74
8
src/Makefile
Normal file
8
src/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
OBJS=main.o log.o gpio.o
|
||||
LIBS=
|
||||
|
||||
upiwin: $(OBJS)
|
||||
gcc -o upiwin $(OBJS) $(LIBS)
|
||||
|
||||
.c.o:
|
||||
gcc -c $(CFLAGS) $<
|
|
@ -3,6 +3,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include "log.h"
|
||||
#include "gpio.h"
|
||||
|
||||
#define GLINE_BUTTON1 17
|
||||
#define GLINE_BUTTON2 22
|
||||
|
|
8
src/gpio.h
Normal file
8
src/gpio.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef __GPIO_H_INCLUDED
|
||||
#define __GPIO_H_INCLUDED
|
||||
|
||||
extern int Gpio_setup(void);
|
||||
extern void Gpio_cleanup(void);
|
||||
extern int Gpio_poll_buttons(void);
|
||||
|
||||
#endif /* __GPIO_H_INCLUDED */
|
16
src/main.c
Normal file
16
src/main.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <stdlib.h>
|
||||
#include "gpio.h"
|
||||
#include "log.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (Gpio_setup() != 0)
|
||||
return EXIT_FAILURE;
|
||||
atexit(Gpio_cleanup);
|
||||
|
||||
log(LINFO, "System ready.");
|
||||
|
||||
for (;;) {
|
||||
Gpio_poll_buttons();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user