summaryrefslogtreecommitdiff
path: root/examples/device/hid_multiple_interface
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-06-27 11:50:17 +0700
committerhathach <[email protected]>2022-06-27 11:50:17 +0700
commitb9dc9dbd78ee1890342429502d585f323c480fc2 (patch)
tree922509c3012736c3b7b564c99d8c27ef77d60013 /examples/device/hid_multiple_interface
parent0042eccb3b2ff0f980f3a927a271364a2089ada5 (diff)
fix most warnings with rp2040 -wconversion
Diffstat (limited to 'examples/device/hid_multiple_interface')
-rw-r--r--examples/device/hid_multiple_interface/CMakeLists.txt3
-rw-r--r--examples/device/hid_multiple_interface/src/usb_descriptors.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt
index abc4d91da..438635958 100644
--- a/examples/device/hid_multiple_interface/CMakeLists.txt
+++ b/examples/device/hid_multiple_interface/CMakeLists.txt
@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
# Configure compilation flags and libraries for the example... see the corresponding function
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_device_example(${PROJECT}) \ No newline at end of file
diff --git a/examples/device/hid_multiple_interface/src/usb_descriptors.c b/examples/device/hid_multiple_interface/src/usb_descriptors.c
index 9eef21504..42471a961 100644
--- a/examples/device/hid_multiple_interface/src/usb_descriptors.c
+++ b/examples/device/hid_multiple_interface/src/usb_descriptors.c
@@ -171,7 +171,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
const char* str = string_desc_arr[index];
// Cap at max char
- chr_count = strlen(str);
+ chr_count = (uint8_t) strlen(str);
if ( chr_count > 31 ) chr_count = 31;
// Convert ASCII string into UTF-16
@@ -182,7 +182,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
}
// first byte is length (including header), second byte is string type
- _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+ _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
return _desc_str;
}