diff options
Diffstat (limited to '')
-rw-r--r-- | clak.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -2,13 +2,15 @@ #include <unistd.h> #include <string.h> #include <stdlib.h> +#include <assert.h> -#include "clak.h" #include "platform/platform.h" #include "board/board.h" #define VOLUME 0.15 +struct board *board = NULL; + void do_exit(int code) { keyboard_unhook(); @@ -17,17 +19,16 @@ void do_exit(int code) } void on_clean_exit(void) { do_exit(0); } -fn_board_on_down board_on_down; -fn_board_on_up board_on_up; - void keyboard_on_down(void) { - board_on_down(); + assert(board != NULL); + board->on_down(); } void keyboard_on_up(void) { - board_on_up(); + assert(board != NULL); + board->on_up(); } int main(int argc, char **argv) @@ -39,10 +40,11 @@ int main(int argc, char **argv) // TODO: List valid boards. return 1; } - if (!load_board(argv[1], &board_on_down, &board_on_up)) { + if ((board = load_board(argv[1])) == NULL) { + printf("Failed to load board, exiting.\n"); return 1; } - fprintf(stderr, "Loaded board: %s\n", argv[1]); + fprintf(stderr, "Loaded board: %s\n", board->name); if (!sound_init(VOLUME)) { printf("ERROR: Could not initialise sound system.\n"); |