From 50778f7bbb9ba2135df5e699521a61a83dcddbc6 Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Mon, 9 Jan 2017 14:22:58 +0000 Subject: minimal example for ADC processing --- src/app.c | 68 ++------------------------------------------------------------- 1 file changed, 2 insertions(+), 66 deletions(-) (limited to 'src/app.c') diff --git a/src/app.c b/src/app.c index d4547dc..3499d58 100644 --- a/src/app.c +++ b/src/app.c @@ -42,58 +42,23 @@ // This is where the fun is! Add your code to the callbacks below to define how // your app behaves. // -// In this example, we store all button states in an array, which we sometimes -// save to flash. +// In this example, we render the raw ADC data as LED rainbows. //______________________________________________________________________________ -#define BUTTON_COUNT 100 #define PAD_COUNT 64 -static u8 g_Buttons[BUTTON_COUNT] = {0}; - static const u16 *g_ADC = 0; //______________________________________________________________________________ void app_surface_event(u8 type, u8 index, u8 value) { - switch (type) - { - case TYPEPAD: - { - return; - - - } - break; - - case TYPESETUP: - { - if (value) - { - // save button states to flash (reload them by power cycling the hardware!) - hal_write_flash(0, g_Buttons, BUTTON_COUNT); - } - } - break; - } } //______________________________________________________________________________ void app_midi_event(u8 port, u8 status, u8 d1, u8 d2) { - // example - MIDI interface functionality for USB "MIDI" port -> DIN port - if (port == USBMIDI) - { - hal_send_midi(DINMIDI, status, d1, d2); - } - - // // example -MIDI interface functionality for DIN -> USB "MIDI" port port - if (port == DINMIDI) - { - hal_send_midi(USBMIDI, status, d1, d2); - } } //______________________________________________________________________________ @@ -107,33 +72,17 @@ void app_sysex_event(u8 port, u8 * data, u16 count) void app_aftertouch_event(u8 index, u8 value) { - return; - - // example - send poly aftertouch to MIDI ports - hal_send_midi(USBMIDI, POLYAFTERTOUCH | 0, index, value); - - // example - set LED to white, brightness in proportion to pressure - hal_plot_led(TYPEPAD, index, value/2, value/2, value/2); } //______________________________________________________________________________ void app_cable_event(u8 type, u8 value) { - // example - light the Setup LED to indicate cable connections - if (type == MIDI_IN_CABLE) - { - hal_plot_led(TYPESETUP, 0, 0, value, 0); // green - } - else if (type == MIDI_OUT_CABLE) - { - hal_plot_led(TYPESETUP, 0, value, 0, 0); // red - } } //______________________________________________________________________________ -static const u8 ADC_MAP[] = +static const u8 ADC_MAP[PAD_COUNT] = { 11, 51, 12, 52, 13, 53, 14, 54, 15, 55, 16, 56, 17 ,57, 18, 58, @@ -148,19 +97,6 @@ static const u8 ADC_MAP[] = void app_timer_event() { - // example - send MIDI clock at 125bpm -#define TICK_MS 20 - - static u8 ms = TICK_MS; - - if (++ms >= TICK_MS) - { - ms = 0; - - // send a clock pulse up the USB - hal_send_midi(USBMIDI, MIDITIMINGCLOCK, 0, 0); - } - // example: render raw ADC data as LEDs for (int i=0; i < PAD_COUNT; ++i) { -- cgit v1.2.1