I'm working on integrating an OLED display and joystick with a TinyUSB example (cdc_msc) on the RP2040 (Raspberry Pi Pico). The original TinyUSB example compiled fine, but after adding the OLED code, I keep running into an error with this line:
#define I2C_INSTANCE i2c0
if i define it, I get
/home/santii/pico/tinyusb/examples/device/cdc_msc/src/hello_oled.c:7: error: "I2C_INSTANCE" redefined [-Werror]
7 | #define I2C_INSTANCE i2c0
|
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/cdc_msc.dir/build.make:118: CMakeFiles/cdc_msc.dir/src/hello_oled.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2
CMakeFiles/cdc_msc.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Then I tried to put it as
#ifndef I2C_INSTANCE
#define I2C_INSTANCE i2c0
#endif
error: 'I2C_INSTANCE' undeclared (first use in this function) 22 | i2c_init(I2C_INSTANCE, 400000); | ^~~~~~~~~~~~
Am i just not understanding the error?
#define I2C_INSTANCE i2c0
if i define it, I get
/home/santii/pico/tinyusb/examples/device/cdc_msc/src/hello_oled.c:7: error: "I2C_INSTANCE" redefined [-Werror]
7 | #define I2C_INSTANCE i2c0
|
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/cdc_msc.dir/build.make:118: CMakeFiles/cdc_msc.dir/src/hello_oled.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2
make: *** [Makefile:91: all] Error 2
Then I tried to put it as
#ifndef I2C_INSTANCE
#define I2C_INSTANCE i2c0
#endif
error: 'I2C_INSTANCE' undeclared (first use in this function) 22 | i2c_init(I2C_INSTANCE, 400000); | ^~~~~~~~~~~~
Am i just not understanding the error?
Statistics: Posted by Frambuesa6274 — Fri Feb 28, 2025 9:36 pm — Replies 0 — Views 10