Skip to content

Commit

Permalink
cdc grid support (#96)
Browse files Browse the repository at this point in the history
* cdc setup and detection

* libavr32

* libavr32

* zeroflood

* it works

* works

* restore

* lights

* working

* remove test

* libavr32 to main
  • Loading branch information
tehn authored Jun 3, 2021
1 parent 1c42f2c commit 47eca77
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ CSRCS = \
../libavr32/src/usb/midi/uhi_midi.c \
../libavr32/src/usb/midi/midi.c \
../libavr32/src/usb/msc/msc.c \
../libavr32/src/usb/cdc/cdc.c \
../libavr32/src/usb/cdc/uhi_cdc.c \
../libavr32/asf/common/services/storage/ctrl_access/ctrl_access.c \
avr32/drivers/adc/adc.c \
avr32/drivers/flashc/flashc.c \
Expand Down Expand Up @@ -137,6 +139,7 @@ INC_PATH = \
../../src \
../src \
../src/usb \
../src/usb/cdc \
../src/usb/ftdi \
../src/usb/hid \
../src/usb/midi \
Expand Down
16 changes: 12 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ usb flash
#include "ftdi.h"
#include "ii.h"
#include "dac.h"
#include "cdc.h"


#include "conf_board.h"
Expand Down Expand Up @@ -153,7 +154,7 @@ static void cvTimer_callback(void* o) {
}

static void monome_poll_timer_callback(void* obj) {
ftdi_read();
serial_read();
}

static void monome_refresh_timer_callback(void* obj) {
Expand Down Expand Up @@ -221,6 +222,10 @@ static void handler_FtdiConnect(s32 data) {
ftdi_setup();
}

static void handler_SerialConnect(s32 data) {
monome_setup_mext();
}

static void handler_FtdiDisconnect(s32 data) {
timers_unset_monome();
app_event_handlers[ kEventFrontShort ] = &handler_FrontShort;
Expand Down Expand Up @@ -414,6 +419,8 @@ static inline void assign_main_event_handlers(void) {
app_event_handlers[ kEventMidiConnect ] = &handler_MidiConnect ;
app_event_handlers[ kEventMidiDisconnect ] = &handler_MidiDisconnect ;
app_event_handlers[ kEventMidiPacket ] = &handler_None;
app_event_handlers[ kEventSerialConnect ] = &handler_SerialConnect ;
app_event_handlers[ kEventSerialDisconnect ] = &handler_FtdiDisconnect ;
}

// app event loop
Expand Down Expand Up @@ -795,6 +802,7 @@ int main(void)
print_dbg("\r\n== FLASH struct size: ");
print_dbg_ulong(sizeof(f));


if(flash_is_fresh()) {
// store flash defaults
print_dbg("\r\nfirst run.");
Expand Down Expand Up @@ -851,7 +859,7 @@ int main(void)
init_usb_host();
init_monome();

while (true) {
check_events();
}
while (true) {
check_events();
}
}

0 comments on commit 47eca77

Please sign in to comment.