diff --git a/README.md b/README.md index 2fed9c2..3b65e76 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ Code for the WVR USB Backpack is here : https://github.com/marchingband/wvr_usb_ # powering wvr * **wvr basic** : plug in usb, or apply 5v and ground, or 3.3v and ground, to the power pins -* **wvr makers board** : plug in usb (will not power amp), use a center-negative 9v PSU (boss style) or apply somewhere between 5v and 9v and ground to the VIN pins -* **wvr dev board** : plug in usb, use a center-negative 9v PSU (boss style) or apply somewhere between 5v and 9v and ground to the VIN pins -* **thames** : use a center-negative 9v PSU (boss style) +* **wvr makers board** : plug in usb (will not power amp), use a center-negative 9v PSU (Boss style) or apply somewhere between 6v and 9v (and ground) to the VIN pins +* **wvr dev board** : plug in usb, use a center-negative 9v PSU (Boss style) or apply somewhere between 6v and 9v and ground to the VIN pins +* **thames** : use a center-negative 9v PSU (Boss style) * **usb host backpack** : The backpack is powered by the WVR, so if WVR is on, the backpack is also on. When updating firmware on the backpack, plug in the usb micro port on the backpack **instead of** powering the WVR. It has its 5v line connected to the WVR 5v pin. WVR takes this 5v line, passes it to the LDO, and passes 3.3v back to power the backpack. The 5v pin on the USB host port is also connected to the WVR 5v pin, so it can power whatever is plugged into it, adding some capacitance to meet the USB spec. # updating firmware diff --git a/src/WVR.cpp b/src/WVR.cpp index 8e55b84..5fee8e7 100644 --- a/src/WVR.cpp +++ b/src/WVR.cpp @@ -59,6 +59,11 @@ void WVR::setGlobalVolume(uint8_t volume) set_global_volume(volume); } +uint8_t WVR::getGlobalVolume(void) +{ + return get_global_volume(); +} + void WVR::mute(void) { set_mute(true); @@ -69,7 +74,7 @@ void WVR::unmute(void) set_mute(false); } -void WVR::setMidiHook(uint8_t*(*fn)(uint8_t *in)) +void WVR::setMidiHook(void(*fn)(uint8_t *in)) { set_midi_hook(fn); } diff --git a/src/WVR.h b/src/WVR.h index 6cc1c27..37f82d6 100644 --- a/src/WVR.h +++ b/src/WVR.h @@ -19,17 +19,15 @@ class WVR { void wifiOn(void); void toggleWifi(void); void setGlobalVolume(uint8_t volume); + uint8_t getGlobalVolume(void); void mute(void); void unmute(void); - void setMidiHook(uint8_t*(*fn)(uint8_t *in)); + void setMidiHook(void(*fn)(uint8_t *in)); void encoderInit(int encA, int encB); void onEncoder(void (*handleEncoder)(bool up)); void resetPin(int pin); uint8_t getVoice(int channel); void setVoice(int channel, int voice); - // int globalVolume; - // bool mute; - // bool autoConfigPins; bool wifiIsOn; bool useFTDI; bool useUsbMidi; diff --git a/src/file_system.c b/src/file_system.c index 58a5a7f..4e1c789 100644 --- a/src/file_system.c +++ b/src/file_system.c @@ -175,6 +175,11 @@ void set_global_volume(uint8_t vol) metadata.global_volume = vol; } +uint8_t get_global_volume(void) +{ + return metadata.global_volume; +} + void write_metadata(struct metadata_t m){ struct metadata_t *buf = (struct metadata_t *)ps_malloc(SECTOR_SIZE * METADATA_SIZE_IN_BLOCKS); buf[0] = m; diff --git a/src/file_system.h b/src/file_system.h index 7b43bf1..09281c4 100644 --- a/src/file_system.h +++ b/src/file_system.h @@ -333,6 +333,7 @@ void current_bank_up(void); void current_bank_down(void); struct metadata_t *get_metadata(void); void set_global_volume(uint8_t vol); +uint8_t get_global_volume(void); void log_pin_config(void); size_t getNumSectorsInEmmc(void); void getSector(size_t i, uint8_t *buf); diff --git a/src/midi.h b/src/midi.h index 697e9cf..4629ab1 100644 --- a/src/midi.h +++ b/src/midi.h @@ -10,7 +10,7 @@ extern "C" { uint8_t* midi_parse(uint8_t in); uint8_t* usb_midi_parse(uint8_t in); - uint8_t* midi_hook_default(uint8_t *in); + void midi_hook_default(uint8_t *in); #ifdef __cplusplus } diff --git a/src/midi_in.c b/src/midi_in.c index b00f73a..3797a67 100644 --- a/src/midi_in.c +++ b/src/midi_in.c @@ -34,7 +34,7 @@ struct wav_player_event_t wav_player_event; uint8_t *msg; uint8_t *usb_msg; -uint8_t*(*midi_hook)(uint8_t *in); +void(*midi_hook)(uint8_t *in); void init_gpio() { @@ -126,7 +126,7 @@ static void read_uart_task() if(msg) { // send it through the midi filter hook - msg = midi_hook(msg); + midi_hook(msg); } if(msg) { @@ -267,7 +267,7 @@ static void read_usb_uart_task() if(usb_msg) { // send it through the midi filter hook - usb_msg = midi_hook(usb_msg); + midi_hook(usb_msg); } if(usb_msg) { @@ -398,12 +398,12 @@ void midi_init(bool useUsbMidi) // xTaskCreatePinnedToCore(read_uart_task, "read_uart_task", 4096, NULL, 3, NULL, 1); } -uint8_t* midi_hook_default(uint8_t* in) +void midi_hook_default(uint8_t* in) { - return in; + return; } -void set_midi_hook(uint8_t*(*fn)(uint8_t *in)) +void set_midi_hook(void(*fn)(uint8_t *in)) { midi_hook = fn; } \ No newline at end of file diff --git a/src/midi_in.h b/src/midi_in.h index b7c5138..866bbef 100644 --- a/src/midi_in.h +++ b/src/midi_in.h @@ -21,8 +21,8 @@ struct midi_event_t { }; uint8_t *get_channel_lut(void); -uint8_t* midi_hook_default(uint8_t* in); -void set_midi_hook(uint8_t*(*fn)(uint8_t *in)); +void midi_hook_default(uint8_t* in); +void set_midi_hook(void(*fn)(uint8_t *in)); #ifdef __cplusplus }