Skip to content

PR 204 (PWM with float parameters) confuses the compiler #273

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

Open
facchinm opened this issue Feb 23, 2024 · 1 comment
Open

PR 204 (PWM with float parameters) confuses the compiler #273

facchinm opened this issue Feb 23, 2024 · 1 comment
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@facchinm
Copy link
Member

#204 introduced an error in https://github.com/pschatzmann/arduino-audio-tools/blob/c88d3b9f132555ab7cd932a53744fa6c42aa8e0f/src/AudioPWM/PWMAudioRenesas.h#L90 (due to type confusion between int and float).

Proposed fix: change the signature of begin(uint32_t, uint32_t, ...) to begin(int, int, ...)

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Feb 23, 2024
@KurtE
Copy link
Contributor

KurtE commented Mar 21, 2025

Note this hit the PWMServo library (https://github.com/PaulStoffregen/PWMServo)
That I added support for the UNOR4 two years ago.

There are a couple issues that were opened up on the PWMServo library caused by this.

To reproduce, simpley load one of the two examples, like knob.
Set board to one of the UNOR4 boards.
And try to build.

As reported to me by private message on Arduino forum... Error messages looked like:

:\Users\tspaulding\Documents\Arduino\libraries\PWMServo\PWMServo.cpp: In member function 'uint8_t PWMServo::attach(int, int, int)':
C:\Users\tspaulding\Documents\Arduino\libraries\PWMServo\PWMServo.cpp:241:31: error: call of overloaded 'begin(int, int)' is ambiguous
   if (!pwmOut-> begin(20000, 0)) {
                               ^
In file included from C:\Users\tspaulding\Documents\Arduino\libraries\PWMServo\PWMServo.h:57:0,
                 from C:\Users\tspaulding\Documents\Arduino\libraries\PWMServo\PWMServo.cpp:2:
C:\Users\tspaulding\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.4.1\cores\arduino/pwm.h:24:10: note: candidate: bool PwmOut::begin(uint32_t, uint32_t, bool, timer_source_div_t)
     bool begin(uint32_t period_usec, uint32_t pulse_usec, bool raw = false, timer_source_div_t sd = TIMER_SOURCE_DIV_1);
          ^~~~~
C:\Users\tspaulding\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.4.1\cores\arduino/pwm.h:25:10: note: candidate: bool PwmOut::begin(float, float)
     bool begin(float freq_hz, float duty_perc);
          ^~~~~

exit status 1

@facchinm facchinm assigned maidnl and unassigned aentinger Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants