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
Using i2s example fails build #631
Comments
I had the "i2s_mode_t" and "i2s_port_t" with this error too (using VS Code). The reason is the same for both - strict typing. The "i2s_port_t" is caused by the definition in the Espressif reference example: Which is fixed by using the enumerated type (i2s_port_t) for port 0: Mode is defined as an enum within the "i2s_config_t" structure and it will only compile, as is, with the permissive flag. Unless this flag is set one cannot combine the mode flags into a bit-field (hence the "int" which is the result of ORing multiple enums). |
@riataman did you try the extern C thing? |
I did and it failed with the same error. A standard c cast ( What worked at the end was this:
|
That equates to 5 which is not a valid (unscoped) enumeration (can be 1,2,4,8.16 or 64)
That equates to 3 which is also not a valid (unscoped) enumeration (can be 1,2,4,8,16 or 32)
As you have shown, it must be explicitly cast to circumvent the typing system. This should not be required and is a code smell. |
Until the issue is fixed, i use following template:
This way i can use the code from esp32 example as it is:
|
This example code from espidf cannot be plain copied to C++ code. |
This is an ancient, abandoned issue. There is now an example that demonstrates how to cast the field. |
Tnx @lbernstone !! |
The examples in that repository work fine. They will not work with arduino; many are straight up incompatible with C++ without significant modifications. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
U can typecast those to fix the error |
I can't build the i2s example code. If I change in i2s.h:
i2s_mode_t and i2s_comm_format_t to int. Then it builds and works.
Hardware:
Board: ESP32 Dev Module
Core Installation/update date: 12/Sep/2017
IDE name: Arduino IDE 1.8.3
Description:
Describe your problem here
Sketch:
Debug Messages:
The text was updated successfully, but these errors were encountered: