Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rp2040 audio corrections / Merge to master #2846

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

pschatzmann
Copy link
Contributor

Follow up of #2845

The following issues are addressed

  • Building all examples with cmake is giving compile errors mainy due to data conversion
  • uac2_spaker_fb is missing in the cmake file, gives compile errors and has missing c file in cmake

Many issues could be resolved by treating conversion not as error, but I did not find the place to change this.

Detailed changes

  • .gitignore to ignore .vscode
  • examples/device/CMakeLists.txt add missing uac_speaker_fb
  • examples/device/uac_speaker_fb/CMakeLists.txt add missing quirk_os_guessing.c
  • uac2_spaker_fb/src.main compile errors due to conversion
  • audio_device.c compile error due to format conversion
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c: In function 'audiod_set_interface':
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2069:64: error: conversion from 'long unsigned int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
 2069 |             audio->feedback.compute.fifo_count.rate_const[0] = (audio->feedback.max_value - nominal) / fifo_lvl_thr;

/home/pschatzmann/Development/tinyusb/examples/device/uac2_speaker_fb/src/main.c:417:21: error: conversion from 'long unsigned int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
  417 |   uint16_t length = current_sample_rate/1000 * CFG_TUD_AUDIO_FUNC_1_N_BYTES_PER_SAMPLE_RX * CFG_TUD_AUDIO_FUNC_1_N_CHANNELS_RX;
      |                      
/home/pschatzmann/Development/tinyusb/examples/device/uac2_speaker_fb/src/main.c: In function 'audio_debug_task':
/home/pschatzmann/Development/tinyusb/examples/device/uac2_speaker_fb/src/main.c:468:31: error: conversion from 'uint32_t' {aka 'long unsigned int'} to 'uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
  468 |   debug_info.fifo_count_avg = fifo_count_avg >> 16;
      |                               ^~~~~~~~~~~~~~

/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c: In function 'audiod_set_interface':
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2070:64: error: conversion from 'long unsigned int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
 2070 |             audio->feedback.compute.fifo_count.rate_const[1] = (nominal - audio->feedback.min_value) / fifo_lvl_thr;
      |          
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c: In function 'audiod_set_interface':
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2070:64: error: conversion from 'long unsigned int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
 2070 |             audio->feedback.compute.fifo_count.rate_const[1] = (nominal - audio->feedback.min_value) / fifo_lvl_thr;
      |      

/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c: In function 'audiod_set_fb_params_freq':
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2379:42: error: conversion from 'int' to 'uint8_t' {aka 'unsigned char'} may change value [-Werror=conversion]
 2379 |     audio->feedback.compute.power_of_2 = 16 - (audio->feedback.frame_shift - 1) - tu_log2(mclk_freq / sample_freq);
      |    

/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c: In function 'audiod_set_fb_params_freq':
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2379:42: error: conversion from 'int' to 'uint8_t' {aka 'unsigned char'} may change value [-Werror=conversion]
 2379 |     audio->feedback.compute.power_of_2 = 16 - (audio->feedback.frame_shift - 1) - tu_log2(mclk_freq / sample_freq);
      |    

/home/pschatzmann/Development/tinyusb/examples/device/uac2_speaker_fb/src/usb_descriptors.c:251: undefined reference to `quirk_os_guessing_desc_string_cb'
/home/pschatzmann/Development/tinyusb/src/class/audio/audio_device.c:2383:62: error: conversion from 'uint32_t' {aka 'long unsigned int'} to 'float' may change value [-Werror=conversion]
 2383 |     audio->feedback.compute.float_const = (float)sample_freq / mclk_freq * (1UL << (16 - (audio->feedback.frame_shift - 1)));
      |                   

@HiFiPhile
Copy link
Collaborator

Thank you !

@HiFiPhile HiFiPhile merged commit 8b1e40c into hathach:master Oct 15, 2024
101 of 102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants