summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-03-05 23:24:14 +0700
committerhathach <[email protected]>2026-03-05 23:24:14 +0700
commit61e4b9ce3fba2fea731396c56eee1c7b5a2f5338 (patch)
tree8a9e326a544a34f7a0999a8c5b11bee4307314e2 /examples
parent97476872aa841fcd9cd622e4082d6c57b183c67f (diff)
add IAR warning flags to cmake build and fix them
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc/src/msc_disk.c2
-rw-r--r--examples/device/cdc_msc_freertos/src/msc_disk.c15
-rw-r--r--examples/device/cdc_uac2/src/main.c2
-rw-r--r--examples/device/dynamic_configuration/src/msc_disk.c15
-rw-r--r--examples/device/hid_boot_interface/src/main.c2
-rw-r--r--examples/device/msc_dual_lun/src/main.c2
-rw-r--r--examples/device/net_lwip_webserver/src/main.c2
-rw-r--r--examples/device/uac2_speaker_fb/src/main.c6
-rw-r--r--examples/dual/host_hid_to_device_cdc/src/main.c2
-rw-r--r--examples/host/bare_api/src/main.c2
-rw-r--r--examples/host/device_info/src/main.c1
-rw-r--r--examples/host/midi_rx/src/main.c2
-rw-r--r--examples/host/msc_file_explorer/src/main.c2
-rw-r--r--examples/host/msc_file_explorer/src/msc_app.c2
14 files changed, 17 insertions, 40 deletions
diff --git a/examples/device/cdc_msc/src/msc_disk.c b/examples/device/cdc_msc/src/msc_disk.c
index e091c2985..017acd039 100644
--- a/examples/device/cdc_msc/src/msc_disk.c
+++ b/examples/device/cdc_msc/src/msc_disk.c
@@ -238,7 +238,7 @@ int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void *buffer, u
(void) buffer;
(void) bufsize;
- // currently no other commands is supported
+ // currently no other commands are supported
// Set Sense = Invalid Command Operation
(void) tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
diff --git a/examples/device/cdc_msc_freertos/src/msc_disk.c b/examples/device/cdc_msc_freertos/src/msc_disk.c
index 29ff86281..ff918205e 100644
--- a/examples/device/cdc_msc_freertos/src/msc_disk.c
+++ b/examples/device/cdc_msc_freertos/src/msc_disk.c
@@ -324,20 +324,17 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE
// - READ10 and WRITE10 has their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) {
- // read10 & write10 has their own callback and MUST not be handled here
+ (void) lun;
+ (void) scsi_cmd;
(void) buffer;
(void) bufsize;
- switch (scsi_cmd[0]) {
- default:
- // Set Sense = Invalid Command Operation
- tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
+ // currently no other commands are supported
- // negative means error -> tinyusb could stall and/or response with failed status
- return -1;
- }
+ // Set Sense = Invalid Command Operation
+ (void) tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
- return -1;
+ return -1; // stall/failed command request;
}
#endif
diff --git a/examples/device/cdc_uac2/src/main.c b/examples/device/cdc_uac2/src/main.c
index 22c462be7..cb7b3a142 100644
--- a/examples/device/cdc_uac2/src/main.c
+++ b/examples/device/cdc_uac2/src/main.c
@@ -65,8 +65,6 @@ int main(void)
// printf("Hello, world!\r\n");
#endif
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/dynamic_configuration/src/msc_disk.c b/examples/device/dynamic_configuration/src/msc_disk.c
index e95b2e197..b545e4652 100644
--- a/examples/device/dynamic_configuration/src/msc_disk.c
+++ b/examples/device/dynamic_configuration/src/msc_disk.c
@@ -215,20 +215,17 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE
// - READ10 and WRITE10 has their own callbacks
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize) {
- // read10 & write10 has their own callback and MUST not be handled here
+ (void) lun;
+ (void) scsi_cmd;
(void) buffer;
(void) bufsize;
- switch (scsi_cmd[0]) {
- default:
- // Set Sense = Invalid Command Operation
- tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
+ // currently no other commands are supported
- // negative means error -> tinyusb could stall and/or response with failed status
- return -1;
- }
+ // Set Sense = Invalid Command Operation
+ (void) tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00);
- return -1;
+ return -1; // stall/failed command request;
}
#endif
diff --git a/examples/device/hid_boot_interface/src/main.c b/examples/device/hid_boot_interface/src/main.c
index 4de319f52..7f2153ae9 100644
--- a/examples/device/hid_boot_interface/src/main.c
+++ b/examples/device/hid_boot_interface/src/main.c
@@ -67,8 +67,6 @@ int main(void) {
hid_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/device/msc_dual_lun/src/main.c b/examples/device/msc_dual_lun/src/main.c
index 74a60aa6b..a4ade6f9b 100644
--- a/examples/device/msc_dual_lun/src/main.c
+++ b/examples/device/msc_dual_lun/src/main.c
@@ -103,8 +103,6 @@ int main(void) {
led_blinking_task(NULL);
}
#endif
-
- return 0;
}
#ifdef ESP_PLATFORM
diff --git a/examples/device/net_lwip_webserver/src/main.c b/examples/device/net_lwip_webserver/src/main.c
index 9f26da2ba..8bd8a8c21 100644
--- a/examples/device/net_lwip_webserver/src/main.c
+++ b/examples/device/net_lwip_webserver/src/main.c
@@ -276,8 +276,6 @@ int main(void) {
sys_check_timeouts(); // service lwip
handle_link_state_switch();
}
-
- return 0;
}
/* lwip has provision for using a mutex, when applicable */
diff --git a/examples/device/uac2_speaker_fb/src/main.c b/examples/device/uac2_speaker_fb/src/main.c
index 8323d82e8..c3e97bb28 100644
--- a/examples/device/uac2_speaker_fb/src/main.c
+++ b/examples/device/uac2_speaker_fb/src/main.c
@@ -534,8 +534,9 @@ bool tud_audio_set_itf_close_ep_cb(uint8_t rhport, tusb_control_request_t const
uint8_t const itf = tu_u16_low(tu_le16toh(p_request->wIndex));
uint8_t const alt = tu_u16_low(tu_le16toh(p_request->wValue));
- if (ITF_NUM_AUDIO_STREAMING == itf && alt == 0)
+ if (ITF_NUM_AUDIO_STREAMING == itf && alt == 0) {
blink_interval_ms = BLINK_MOUNTED;
+ }
return true;
}
@@ -569,7 +570,8 @@ bool tud_audio_rx_done_isr(uint8_t rhport, uint16_t n_bytes_received, uint8_t fu
fifo_count = tud_audio_available();
// Same averaging method used in UAC2 class
- fifo_count_avg = (uint32_t) (((uint64_t) fifo_count_avg * 63 + ((uint32_t) fifo_count << 16)) >> 6);
+ const uint32_t ff_count32 = (uint32_t) fifo_count << 16;
+ fifo_count_avg = (uint32_t) (((uint64_t) fifo_count_avg * 63 + ff_count32) >> 6);
return true;
}
diff --git a/examples/dual/host_hid_to_device_cdc/src/main.c b/examples/dual/host_hid_to_device_cdc/src/main.c
index ba8ba019a..c8fca48f8 100644
--- a/examples/dual/host_hid_to_device_cdc/src/main.c
+++ b/examples/dual/host_hid_to_device_cdc/src/main.c
@@ -98,8 +98,6 @@ int main(void) {
tuh_task(); // tinyusb host task
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/host/bare_api/src/main.c b/examples/host/bare_api/src/main.c
index ced2eaa32..81d4d8731 100644
--- a/examples/host/bare_api/src/main.c
+++ b/examples/host/bare_api/src/main.c
@@ -74,8 +74,6 @@ int main(void) {
tuh_task();
led_blinking_task();
}
-
- return 0;
}
/*------------- TinyUSB Callbacks -------------*/
diff --git a/examples/host/device_info/src/main.c b/examples/host/device_info/src/main.c
index fd4e9c3ed..b0e38dd6b 100644
--- a/examples/host/device_info/src/main.c
+++ b/examples/host/device_info/src/main.c
@@ -105,7 +105,6 @@ int main(void) {
tuh_task(); // tinyusb host task
led_blinking_task(NULL);
}
- return 0;
#endif
}
diff --git a/examples/host/midi_rx/src/main.c b/examples/host/midi_rx/src/main.c
index f189e0864..fb36906c6 100644
--- a/examples/host/midi_rx/src/main.c
+++ b/examples/host/midi_rx/src/main.c
@@ -58,8 +58,6 @@ int main(void) {
led_blinking_task();
midi_host_rx_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/host/msc_file_explorer/src/main.c b/examples/host/msc_file_explorer/src/main.c
index 0a8967380..f6bf9a60a 100644
--- a/examples/host/msc_file_explorer/src/main.c
+++ b/examples/host/msc_file_explorer/src/main.c
@@ -92,8 +92,6 @@ int main(void) {
msc_app_task();
led_blinking_task();
}
-
- return 0;
}
//--------------------------------------------------------------------+
diff --git a/examples/host/msc_file_explorer/src/msc_app.c b/examples/host/msc_file_explorer/src/msc_app.c
index 40a9ef57e..7e019818a 100644
--- a/examples/host/msc_file_explorer/src/msc_app.c
+++ b/examples/host/msc_file_explorer/src/msc_app.c
@@ -282,8 +282,6 @@ DRESULT disk_ioctl (
default:
return RES_PARERR;
}
-
- return RES_OK;
}
//--------------------------------------------------------------------+