Skip to content

Commit 3ead682

Browse files
authored
Merge pull request hathach#1534 from hathach/add-more-warnings
Add more warnings
2 parents bc0f550 + 25580b4 commit 3ead682

File tree

94 files changed

+401
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+401
-243
lines changed

.github/workflows/build_arm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ jobs:
5757
- 'stm32f1'
5858
- 'stm32f4'
5959
- 'stm32f7'
60+
- 'stm32g4'
6061
- 'stm32h7'
6162
- 'stm32l4'
63+
- 'stm32wb'
6264
- 'tm4c123'
6365
- 'xmc4000'
6466
steps:

examples/device/audio_4_channel_mic/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26+
# Example common such as compiler warnings
27+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28+
2629
# Configure compilation flags and libraries for the example... see the corresponding function
2730
# in hw/bsp/FAMILY/family.cmake for details.
2831
family_configure_device_example(${PROJECT})

examples/device/audio_4_channel_mic/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
221221
// Request uses format layout 2
222222
TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
223223

224-
volume[channelNum] = ((audio_control_cur_2_t*) pBuff)->bCur;
224+
volume[channelNum] = (uint16_t) ((audio_control_cur_2_t*) pBuff)->bCur;
225225

226226
TU_LOG2(" Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
227227
return true;

examples/device/audio_4_channel_mic/src/usb_descriptors.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
149149
const char* str = string_desc_arr[index];
150150

151151
// Cap at max char
152-
chr_count = strlen(str);
152+
chr_count = (uint8_t) strlen(str);
153153
if ( chr_count > 31 ) chr_count = 31;
154154

155155
for(uint8_t i=0; i<chr_count; i++)
@@ -159,7 +159,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
159159
}
160160

161161
// first byte is length (including header), second byte is string type
162-
_desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
162+
_desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
163163

164164
return _desc_str;
165165
}

examples/device/audio_test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26+
# Example common such as compiler warnings
27+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28+
2629
# Configure compilation flags and libraries for the example... see the corresponding function
2730
# in hw/bsp/FAMILY/family.cmake for details.
2831
family_configure_device_example(${PROJECT})

examples/device/audio_test/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
222222
// Request uses format layout 2
223223
TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
224224

225-
volume[channelNum] = ((audio_control_cur_2_t*) pBuff)->bCur;
225+
volume[channelNum] = (uint16_t) ((audio_control_cur_2_t*) pBuff)->bCur;
226226

227227
TU_LOG2(" Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
228228
return true;

examples/device/audio_test/src/usb_descriptors.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
149149
const char* str = string_desc_arr[index];
150150

151151
// Cap at max char
152-
chr_count = strlen(str);
152+
chr_count = (uint8_t) strlen(str);
153153
if ( chr_count > 31 ) chr_count = 31;
154154

155155
for(uint8_t i=0; i<chr_count; i++)
@@ -159,7 +159,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
159159
}
160160

161161
// first byte is length (including header), second byte is string type
162-
_desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
162+
_desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
163163

164164
return _desc_str;
165165
}

examples/device/board_test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ else()
3636
${CMAKE_CURRENT_SOURCE_DIR}/src
3737
)
3838

39+
# Example common such as compiler warnings
40+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
41+
3942
# Configure compilation flags and libraries for the example... see the corresponding function
4043
# in hw/bsp/FAMILY/family.cmake for details.
4144
family_configure_device_example(${PROJECT})

examples/device/cdc_dual_ports/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26+
# Example common such as compiler warnings
27+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28+
2629
# Configure compilation flags and libraries for the example... see the corresponding function
2730
# in hw/bsp/FAMILY/family.cmake for details.
2831
family_configure_device_example(${PROJECT})

examples/device/cdc_dual_ports/src/usb_descriptors.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
236236
const char* str = string_desc_arr[index];
237237

238238
// Cap at max char
239-
chr_count = strlen(str);
239+
chr_count = (uint8_t) strlen(str);
240240
if ( chr_count > 31 ) chr_count = 31;
241241

242242
// Convert ASCII string into UTF-16
@@ -247,7 +247,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
247247
}
248248

249249
// first byte is length (including header), second byte is string type
250-
_desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
250+
_desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
251251

252252
return _desc_str;
253253
}

0 commit comments

Comments
 (0)