summaryrefslogtreecommitdiff
path: root/examples/device/dynamic_configuration
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-04-03 09:50:08 +0200
committerReinhard Panhuber <[email protected]>2021-04-03 09:50:08 +0200
commita1efd416491fd2deecea46cd466e31b4a02b9734 (patch)
treedfda074b32926050da8460d79b36c34e2e696d42 /examples/device/dynamic_configuration
parent9b2ddd9cc6401b80350179d26e842557f9b60aaf (diff)
parentab4d30fd6bca02c73eb9b4ff82db0b2b0f403344 (diff)
Merge remote-tracking branch 'upstream/master' into edpt_ISO_xfer
Diffstat (limited to 'examples/device/dynamic_configuration')
-rw-r--r--examples/device/dynamic_configuration/CMakeLists.txt3
-rw-r--r--examples/device/dynamic_configuration/src/main.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt
index be6224360..09a8dcc4c 100644
--- a/examples/device/dynamic_configuration/CMakeLists.txt
+++ b/examples/device/dynamic_configuration/CMakeLists.txt
@@ -9,10 +9,11 @@ get_filename_component(TOP "${TOP}" REALPATH)
# Check for -DFAMILY=
if(FAMILY STREQUAL "rp2040")
cmake_minimum_required(VERSION 3.12)
+
set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+
project(${PROJECT})
- pico_sdk_init()
add_executable(${PROJECT})
include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
diff --git a/examples/device/dynamic_configuration/src/main.c b/examples/device/dynamic_configuration/src/main.c
index acee295f6..4c10f55b0 100644
--- a/examples/device/dynamic_configuration/src/main.c
+++ b/examples/device/dynamic_configuration/src/main.c
@@ -172,7 +172,7 @@ void midi_task(void)
// regardless of these being used or not. Therefore incoming traffic should be read
// (possibly just discarded) to avoid the sender blocking in IO
uint8_t packet[4];
- while(tud_midi_available()) tud_midi_receive(packet);
+ while( tud_midi_available() ) tud_midi_packet_read(packet);
// send note every 1000 ms
if (board_millis() - start_ms < 286) return; // not enough time
@@ -186,10 +186,12 @@ void midi_task(void)
if (previous < 0) previous = sizeof(note_sequence) - 1;
// Send Note On for current position at full velocity (127) on channel 1.
- tud_midi_write24(cable_num, 0x90 | channel, note_sequence[note_pos], 127);
+ uint8_t note_on[3] = { 0x90 | channel, note_sequence[note_pos], 127 };
+ tud_midi_stream_write(cable_num, note_on, 3);
// Send Note Off for previous note.
- tud_midi_write24(cable_num, 0x80 | channel, note_sequence[previous], 0);
+ uint8_t note_off[3] = { 0x80 | channel, note_sequence[previous], 0};
+ tud_midi_stream_write(cable_num, note_off, 3);
// Increment position
note_pos++;