aboutsummaryrefslogtreecommitdiff
path: root/board/simple_board.h
blob: f0997c75c41f03d130a02df260a4bbae8638905d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "board.h"

static struct board_data board_data;

#define WAV_LEN(W) PREPROC_CONCAT(W,_len)
#define PREPROC_CONCAT(A, B) A ## B

void board_on_down(void)
{
#ifdef BOARD_DOWN_WAV
	board_data.sound_play(BOARD_DOWN_WAV, WAV_LEN(BOARD_DOWN_WAV));
#endif
}

void board_on_up(void)
{
#ifdef BOARD_UP_WAV
	board_data.sound_play(BOARD_UP_WAV, WAV_LEN(BOARD_UP_WAV));
#endif
}

static struct board board = {
	.on_down = &board_on_down,
	.on_up = &board_on_up,
#ifdef BOARD_NAME
	.name = BOARD_NAME,
#else
	.name = "Generic Board",
#endif
};

struct board *board_init(struct board_data data)
{
	board_data = data;
	return &board;
}