summaryrefslogtreecommitdiffstats
path: root/apps/osmocomBB/osmocomBB/include/calypso/buzzer.h
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2015-04-05 23:24:42 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2015-04-21 23:46:16 +0200
commita2ce02f9208a26fbca87a0e05479f9af1800e3c0 (patch)
tree90070037b2172feb0701d22f84a364a783b9af20 /apps/osmocomBB/osmocomBB/include/calypso/buzzer.h
parent55a5cab48f8c7694856296096ed2dec568e12ba7 (diff)
Import layer1 from osmocomBB (WIP: NOT COMPLETE)gnutoo/layer1-2015-wip
The goal is to touch the code as less as possible. The following files still had to be modified: * The Makefiles to integrate it into nuttx * The layer1's main.c was converted to command-line only: No more keyboard and GUI handling. TODO: * Finish importing the layer1 * See how to avoid duplication with misc/tools/osmocon/ headers * Makefile: use $(TOPDIR) if necessary instead of always using ../ ../ could be used some time only * Kconfig for -DCONFIG_* ? * GTA02 support Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Diffstat (limited to 'apps/osmocomBB/osmocomBB/include/calypso/buzzer.h')
-rw-r--r--apps/osmocomBB/osmocomBB/include/calypso/buzzer.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/osmocomBB/osmocomBB/include/calypso/buzzer.h b/apps/osmocomBB/osmocomBB/include/calypso/buzzer.h
new file mode 100644
index 0000000000..dcfd3a3006
--- /dev/null
+++ b/apps/osmocomBB/osmocomBB/include/calypso/buzzer.h
@@ -0,0 +1,34 @@
+#ifndef _CAL_BUZZER_H
+#define _CAL_BUZZER_H
+
+#define NOTE(n,oct) (n<<2 | (oct & 0x03))
+
+#define NOTE_E 0x00
+#define NOTE_DIS 0x01
+#define NOTE_D 0x02
+#define NOTE_CIS 0x03
+#define NOTE_C 0x04
+#define NOTE_H 0x05
+#define NOTE_AIS 0x06
+#define NOTE_A 0x07
+#define NOTE_GIS 0x08
+#define NOTE_G 0x09
+#define NOTE_FIS 0x0A
+#define NOTE_F 0x0B
+
+#define OCTAVE_5 OCTAVE(0x00)
+#define OCTAVE_4 OCTAVE(0x01)
+#define OCTAVE_3 OCTAVE(0x02)
+#define OCTAVE_2 OCTAVE(0x03)
+#define OCTAVE_1 OCTAVE(0x04)
+
+#define OCTAVE(m) (m>NOTE_C?m+1:m)
+
+/* Switch buzzer to PWT mode (or back) */
+void buzzer_mode_pwt(int on);
+/* Set the buzzer level */
+void buzzer_volume(uint8_t level);
+/* Set the buzzer note */
+void buzzer_note(uint8_t note);
+
+#endif /* _CAL_BUZZER_H */