Adafruit_NeoPixel icon indicating copy to clipboard operation
Adafruit_NeoPixel copied to clipboard

esp32: different espShow declarations, use uint16_t

Open PBrunot opened this issue 6 months ago • 0 comments

When compiling with -flto=auto for esp32-s2 platform, the following mistake comes out (2 different declarations for same function with parameter 1 argument type difference)

.pio/libdeps/wokwi/Adafruit NeoPixel/Adafruit_NeoPixel.cpp:390:17: warning: type of 'espShow' does not match original declaration [-Wlto-type-mismatch] 390 | extern "C" void espShow(uint16_t pin, uint8_t *pixels, uint32_t numBytes, | ^ .pio/libdeps/wokwi/Adafruit NeoPixel/esp.c:37:6: note: type mismatch in parameter 1 37 | void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz) { | ^ .pio/libdeps/wokwi/Adafruit NeoPixel/esp.c:37:6: note: type 'uint8_t' should match type 'uint16_t' .pio/libdeps/wokwi/Adafruit NeoPixel/esp.c:37:6: note: 'espShow' was previously declared here

  • Conflicts is between esp.c and Adafruit_NeoPixel.cpp definitions

  • Suggest fix is to change esp.c to accept uint16_t, because it will be anyways promoted to int in rmtInit()/rmtWrite() functions.

void espShow(uint8_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
void espShow(uint16_t pin, uint8_t *pixels, uint32_t numBytes, boolean is800KHz)
  • After this change warning disappear. I can send you a PR if you wish.

PBrunot avatar Aug 12 '24 08:08 PBrunot