aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-05-08 01:35:55 +1000
committerNicholas Tay <nick@windblume.net>2022-05-08 01:35:55 +1000
commit5270088f730a7e30155a642dcd5c4e9a80055d7a (patch)
tree021a97b39cfe8cb68ae6a21c353a90cb731380eb /board
parent047544a5af9100ec269e9222213385bc7794f619 (diff)
downloadclak-5270088f730a7e30155a642dcd5c4e9a80055d7a.tar.gz
clak-5270088f730a7e30155a642dcd5c4e9a80055d7a.tar.bz2
clak-5270088f730a7e30155a642dcd5c4e9a80055d7a.zip
More messing around with plugin system
Just more attempts, but I think I'm gonna switch over to dynamic .so/.dll loading. That would be pretty fun to check out.
Diffstat (limited to 'board')
-rw-r--r--board/generate.sh8
-rw-r--r--board/mxblue/board.h3
-rw-r--r--board/quack/board.h3
-rw-r--r--board/simple.h9
4 files changed, 23 insertions, 0 deletions
diff --git a/board/generate.sh b/board/generate.sh
new file mode 100644
index 0000000..6d8d593
--- /dev/null
+++ b/board/generate.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+BOARDS='mxblue quack'
+
+cd "$(dirname "$0")"
+for board in $BOARDS; do
+ xxd -i $board/board_down.wav $board/sound.h
+done \ No newline at end of file
diff --git a/board/mxblue/board.h b/board/mxblue/board.h
new file mode 100644
index 0000000..7d17f3f
--- /dev/null
+++ b/board/mxblue/board.h
@@ -0,0 +1,3 @@
+#include "./sound.h"
+#include "../simple.h"
+SIMPLE_BOARD(mxblue) \ No newline at end of file
diff --git a/board/quack/board.h b/board/quack/board.h
new file mode 100644
index 0000000..64ba4cb
--- /dev/null
+++ b/board/quack/board.h
@@ -0,0 +1,3 @@
+#include "./sound.h"
+#include "../simple.h"
+SIMPLE_BOARD(quack) \ No newline at end of file
diff --git a/board/simple.h b/board/simple.h
new file mode 100644
index 0000000..c2b211b
--- /dev/null
+++ b/board/simple.h
@@ -0,0 +1,9 @@
+#ifndef CLAK_SIMPLE_H_
+#define CLAK_SIMPLE_H_
+
+extern void sound_play(unsigned char *buffer);
+#define SIMPLE_BOARD(name) \
+ void name ## _on_down(void) { sound_play( name ## _board_down_wav ); } \
+ void name ## _on_up(void) { sound_play( name ## _board_down_wav ); }
+
+#endif /* CLAK_SIMPLE_H_ */ \ No newline at end of file