~jkaivo/freeonebook

65f76a7f96b463a129da479b8256310dd538cd3f — Jakob Kaivo 3 years ago 3ad51d2
loading at least one image correctly
1 files changed, 4 insertions(+), 8 deletions(-)

M freeonebook.c
M freeonebook.c => freeonebook.c +4 -8
@@ 7,7 7,6 @@
#include "gpio.h"
#include "fb.h"

#define FBSIZE (1186848 * 2)
#define SDPATH "/run/media/mmcblk0p1"

void halt(void)


@@ 31,8 30,6 @@ void poweroff(int reason)

	if (reason == GPIO_LOWBATTERY) {
		printf("low battery\n");
	} else {
		fb_blank();
	}

	exit(0);


@@ 59,12 56,10 @@ void buttonpress(int button)

	case BUTTON_PREVPAGE:
		printf("previous page\n");
		fb_loadimage(SDPATH "/right-screen.dat");
		break;

	case BUTTON_NEXTPAGE:
		printf("next page\n");
		fb_loadimage(SDPATH "/left-screen.dat");
		break;

	default:


@@ 83,8 78,8 @@ int main(int argc, char *argv[])
	atexit(halt);

	printf("adding watchers\n");
	//gpio_watch(GPIO_LOWBATTERY, poweroff);
	//gpio_watch(GPIO_SHUTDOWN, poweroff);
	gpio_watch(GPIO_LOWBATTERY, poweroff);
	gpio_watch(GPIO_SHUTDOWN, poweroff);
	gpio_watch(BUTTON_SPECIAL, buttonpress);
	gpio_watch(BUTTON_PREVBOOK, buttonpress);
	gpio_watch(BUTTON_PREVPAGE, buttonpress);


@@ 94,7 89,8 @@ int main(int argc, char *argv[])

	printf("initializing framebuffer\n");
	fb_init();
	fb_blank();
	fb_loadimage(RIGHT_SCREEN, SDPATH "/right.gray");
	fb_loadimage(LEFT_SCREEN, SDPATH "/left.gray");
	
	for (;;) {
		sleep(INT_MAX);