summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-02-24 15:40:48 +0700
committerhathach <[email protected]>2025-02-24 16:05:31 +0700
commitd132044b7587f7e846bbec6e7b897d0842a21d13 (patch)
treef2f133795049f0f52a20127a0a147c64f0d03b18 /examples
parent56e84bd1a605e3835f29e2e7fd17f65e0f3b5431 (diff)
add tuh_midi_mount_cb_t struct for tuh_midi_mount_cb()
change tuh_midi_rx/tx_cb() to have xferred_bytes rename tuh_midi_get_num_rx/tx_cables() to tuh_midi_get_rx/tx_cable_count() use default empty callback instead of weak null to be compatible with keil compiler
Diffstat (limited to 'examples')
-rw-r--r--examples/host/cdc_msc_hid/src/main.c4
-rw-r--r--examples/host/midi_rx/src/main.c13
2 files changed, 9 insertions, 8 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c
index 71257c0fe..2d5df23f9 100644
--- a/examples/host/cdc_msc_hid/src/main.c
+++ b/examples/host/cdc_msc_hid/src/main.c
@@ -82,12 +82,12 @@ int main(void) {
void tuh_mount_cb(uint8_t dev_addr) {
// application set-up
- printf("A device with address %d is mounted\r\n", dev_addr);
+ printf("A device with address %u is mounted\r\n", dev_addr);
}
void tuh_umount_cb(uint8_t dev_addr) {
// application tear-down
- printf("A device with address %d is unmounted \r\n", dev_addr);
+ printf("A device with address %u is unmounted \r\n", dev_addr);
}
diff --git a/examples/host/midi_rx/src/main.c b/examples/host/midi_rx/src/main.c
index 6db329ab5..d26321e5d 100644
--- a/examples/host/midi_rx/src/main.c
+++ b/examples/host/midi_rx/src/main.c
@@ -91,9 +91,9 @@ void midi_host_rx_task(void) {
//--------------------------------------------------------------------+
// Invoked when device with MIDI interface is mounted.
-void tuh_midi_mount_cb(uint8_t idx, uint8_t num_cables_rx, uint16_t num_cables_tx) {
- printf("MIDI Interface Index = %u, Number of RX cables = %u, Number of TX cables = %u\r\n",
- idx, num_cables_rx, num_cables_tx);
+void tuh_midi_mount_cb(uint8_t idx, const tuh_midi_mount_cb_t* mount_cb_data) {
+ printf("MIDI Interface Index = %u, Address = %u, Number of RX cables = %u, Number of TX cables = %u\r\n",
+ idx, mount_cb_data->daddr, mount_cb_data->rx_cable_count, mount_cb_data->tx_cable_count);
}
// Invoked when device with hid interface is un-mounted
@@ -101,8 +101,8 @@ void tuh_midi_umount_cb(uint8_t idx) {
printf("MIDI Interface Index = %u is unmounted\r\n", idx);
}
-void tuh_midi_rx_cb(uint8_t idx, uint32_t num_packets) {
- if (num_packets == 0) {
+void tuh_midi_rx_cb(uint8_t idx, uint32_t xferred_bytes) {
+ if (xferred_bytes == 0) {
return;
}
@@ -117,6 +117,7 @@ void tuh_midi_rx_cb(uint8_t idx, uint32_t num_packets) {
printf("\r\n");
}
-void tuh_midi_tx_cb(uint8_t idx) {
+void tuh_midi_tx_cb(uint8_t idx, uint32_t xferred_bytes) {
(void) idx;
+ (void) xferred_bytes;
}