aboutsummaryrefslogblamecommitdiff
path: root/board/simple_board.h
blob: f0997c75c41f03d130a02df260a4bbae8638905d (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                                    


                                         


                        
                                                                       





                      
                                                                   
















                                                
 
#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;
}