summaryrefslogtreecommitdiff
path: root/freeonebook.c
diff options
context:
space:
mode:
authorJakob Kaivo <jakob@kaivo.net>2018-11-10 21:30:21 -0500
committerJakob Kaivo <jakob@kaivo.net>2018-11-10 21:30:21 -0500
commite49e48d5f3acc73ae6fc1137683ec3c488e7964d (patch)
tree41a532c3e1269503d3a6e6883dbc20168b64f30f /freeonebook.c
parent5a5ef973c695dca3281bcbaf84fab81ad6b7b887 (diff)
work on initializing the screens
Diffstat (limited to 'freeonebook.c')
-rw-r--r--freeonebook.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/freeonebook.c b/freeonebook.c
index ada4c3a..8d93954 100644
--- a/freeonebook.c
+++ b/freeonebook.c
@@ -1,26 +1,20 @@
-#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/mman.h>
#include <unistd.h>
#include "gpio.h"
+#include "fb.h"
#define FBSIZE (1186848 * 2)
#define SDPATH "/run/media/mmcblk0p1"
-void enable_displays(void)
-{
- printf("enabling displays\n");
- gpio_set(ENABLE_LEFT_DISPLAY);
- gpio_set(ENABLE_RIGHT_DISPLAY);
-}
-
void halt(void)
{
char *halt[] = { "shutdown", "-h", "now", NULL };
+ fflush(NULL);
+ sync();
execvp(halt[0], halt);
}
@@ -75,10 +69,15 @@ void buttonpress(int button)
int main(int argc, char *argv[])
{
+ printf("starting freeonebook\n");
(void)argc; (void)argv;
+ printf("registering atexit() handler\n");
atexit(halt);
+ printf("initializing gpio\n");
gpio_init();
+
+ printf("adding watchers\n");
gpio_watch(GPIO_LOWBATTERY, poweroff);
gpio_watch(GPIO_SHUTDOWN, poweroff);
gpio_watch(BUTTON_SPECIAL, buttonpress);
@@ -88,7 +87,8 @@ int main(int argc, char *argv[])
gpio_watch(BUTTON_NEXTCHAPTER, buttonpress);
gpio_watch(BUTTON_NEXTBOOK, buttonpress);
- enable_displays();
+ printf("initializing framebuffer\n");
+ fb_init();
for (;;) {
sleep(INT_MAX);