diff options
author | Erich Eckner <git@eckner.net> | 2018-10-22 14:51:43 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-10-23 05:46:54 +0200 |
commit | d2f0f303822bb6200b6a17d6b9364909f059ad9c (patch) | |
tree | e6a218638dd8d3e776f6522cd06c4fdde45fa480 /multiplexer.c | |
parent | ae75b15e6241232c2adb3ae3b53819d3a4dd638d (diff) | |
download | anzeige-d2f0f303822bb6200b6a17d6b9364909f059ad9c.tar.xz |
multiplexer: cleanup
Diffstat (limited to 'multiplexer.c')
-rw-r--r-- | multiplexer.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/multiplexer.c b/multiplexer.c index 5f82ee5..474f7e6 100644 --- a/multiplexer.c +++ b/multiplexer.c @@ -1,9 +1,10 @@ -#include <stdio.h> +#ifndef SKIP_GPIO #include <stdlib.h> #include <fcntl.h> #include <sys/mman.h> +#endif +#include <stdio.h> #include <unistd.h> -#include <errno.h> #include <string.h> #include <pthread.h> @@ -22,13 +23,13 @@ void printButton(int g) // // Set up a memory regions to access GPIO // -void multiplexer_setup_root() +int multiplexer_setup_root() { #ifndef SKIP_GPIO /* open /dev/mem */ if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) < 0) { perror("can't open /dev/mem"); - exit(-1); + return EXIT_FAILURE; } /* mmap GPIO */ @@ -45,7 +46,7 @@ void multiplexer_setup_root() if (gpio_map == MAP_FAILED) { perror("mmap error"); - exit(-1); + return EXIT_FAILURE; } // Always use volatile pointer! |