summaryrefslogtreecommitdiffstats
path: root/include/app.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/app.h')
-rw-r--r--include/app.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/include/app.h b/include/app.h
new file mode 100644
index 0000000..51eef58
--- /dev/null
+++ b/include/app.h
@@ -0,0 +1,84 @@
1//
2// app.h
3//
4
5#ifndef LAUNCHPAD_APP_H
6#define LAUNCHPAD_APP_H
7
8// ____________________________________________________________________________
9//
10#include "app_defs.h"
11
12// ____________________________________________________________________________
13//
14// Interface to the hardware (implemented in launchpad_pro.a library)
15// ____________________________________________________________________________
16
17/**
18 * Set an LED's RGB value. This function is safe to call from any
19 * of the app functions below, at any time.
20 */
21void hal_plot_led(u8 type, u8 index, u8 red, u8 green, u8 blue);
22
23/**
24 * Send a MIDI message to either USB port or to the DIN output.
25 */
26void hal_send_midi(u8 port, u8 status, u8 d1, u8 d2);
27
28/**
29 * Send system exclusive to USB or DIN. Messages must be correctly formatted
30 * (F0 ... F7) and must not exceed 320 bytes.
31 */
32void hal_send_sysex(u8 port, const u8* data, u16 length);
33
34// ____________________________________________________________________________
35//
36// Interface from the hardware (implemented in app.c)
37// ____________________________________________________________________________
38
39/**
40 * Called on startup, this is a good place to do any initialisation.
41 */
42void app_init();
43
44/**
45 * 1kHz (1ms) timer. You can set LEDs and send MIDI out from this function,
46 * but you will get LED tearing as there is (currently) no double buffering.
47 *
48 * You will get jitter.
49 */
50void app_timer_event();
51
52/**
53 * Called when a MIDI message is received from USB or DIN.
54 */
55void app_midi_event(u8 port, u8 status, u8 d1, u8 d2);
56
57/**
58 * As above, but for system exclusive messages. Low level hardware buffering sets
59 * a maximum message size of 320 bytes, messages larger than this will not work.
60 */
61void app_sysex_event(u8 port, u8 * data, u16 count);
62
63/**
64 * Called when a MIDI DIN breakout cable is connected or disconnected. Note that
65 * you can still write MIDI events to the DIN ports even if no cable is connected.
66 */
67void app_cable_event(u8 type, u8 value);
68
69/**
70 * Called when the user presses or releases any button or pad on the control surface.
71 */
72void app_surface_event(u8 type, u8 index, u8 value);
73
74/**
75 * Called when the low level pad scanning reports an aftertouch (pad pressure) event.
76 * A pad press event will always come first. Note that the factory firmware sets a
77 * threshold to prevent excessive aftertouch after the initial hit, at the expense of
78 * dynamic range. This firmware does not - the full range of the pad is transmitted,
79 * with the side effect that aftertouch onset is more rapid.
80 */
81void app_aftertouch_event(u8 index, u8 value);
82
83
84#endif