diff options
| author | Ha Thach <[email protected]> | 2022-06-29 11:39:05 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-29 11:39:05 +0700 |
| commit | 3681ad2941c0da0cd03d0c36860622dc441457d3 (patch) | |
| tree | b16f4c7791aa17fa116b9f0a59ae0c1f43d494b6 /examples | |
| parent | c7fce32dffd0d6e6c94f030b037d476e16744153 (diff) | |
| parent | 898b52be45f476d7062d50fed722d92f0dccf4ae (diff) | |
Merge pull request #1521 from kilograham/rp2040_warning
Re-add some warning suppression for rp2040
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/cdc_dual_ports/src/main.c | 6 | ||||
| -rw-r--r-- | examples/device/hid_composite/src/main.c | 2 | ||||
| -rw-r--r-- | examples/example.cmake | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c index 6053a3b81..0264f0566 100644 --- a/examples/device/cdc_dual_ports/src/main.c +++ b/examples/device/cdc_dual_ports/src/main.c @@ -55,17 +55,19 @@ int main(void) // with Serial0 as all lower case, Serial1 as all upper case static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count) { + uint8_t const case_diff = 'a' - 'A'; + for(uint32_t i=0; i<count; i++) { if (itf == 0) { // echo back 1st port as lower case - if (isupper(buf[i])) buf[i] += 'a' - 'A'; + if (isupper(buf[i])) buf[i] += case_diff; } else { // echo back 2nd port as upper case - if (islower(buf[i])) buf[i] -= 'a' - 'A'; + if (islower(buf[i])) buf[i] -= case_diff; } tud_cdc_n_write_char(itf, buf[i]); diff --git a/examples/device/hid_composite/src/main.c b/examples/device/hid_composite/src/main.c index 3c088b7c2..05315f266 100644 --- a/examples/device/hid_composite/src/main.c +++ b/examples/device/hid_composite/src/main.c @@ -230,7 +230,7 @@ void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_ (void) instance; (void) len; - uint8_t next_report_id = report[0] + 1; + uint8_t next_report_id = report[0] + 1u; if (next_report_id < REPORT_ID_COUNT) { diff --git a/examples/example.cmake b/examples/example.cmake index 6bb82a56d..3e395d53f 100644 --- a/examples/example.cmake +++ b/examples/example.cmake @@ -21,5 +21,11 @@ target_compile_options(${PROJECT} PUBLIC -Wuninitialized -Wunused -Wredundant-decls + ) + +# GCC version 9 or prior has a bug with incorrect Wconversion warnings +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0) + target_compile_options(${PROJECT} PUBLIC -Wconversion ) +endif() |
