Any way to integrate CalEPD to standard ESP32 project written on C lang?
Closed this issue · 6 comments
Hey there, thanks for all the work you've done, it's great library and Wiki is amazing!
I managed to build your component in C++ enviroment, ran demos and tryied different API calls with no problems.
However, I had no success in integration with my project, which was designed in C language from the start (as most ESP32 code base actually is).
I tried to switch my project to cpp but it throwing a lot of problems related to esp-idf, it's obvious that I miss something.
And I know, that's it's kinda dumb to post such issue, but maybe you had experience in integration of this lib to native c project and we could figure it out to clear out for somebody and make a new wiki page.
My ESP-IDF version is 4.4.2. I probably could not share the whole sources, but maybe I could replicate this problem with another project, of cource if it's worth trying and you interested.
Here some links, that I refered to:
- https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/cplusplus.html#cplusplus-exceptions
- https://isocpp.org/wiki/faq/mixing-c-and-cpp
- https://esp32.com/viewtopic.php?t=13186
And log seems to be something like this:
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:124:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator~(timer_intr_t)'
FORCE_INLINE_ATTR constexpr TYPE operator~ (TYPE a) { return (TYPE)~(INT_TYPE)a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:124:34: note: previous declaration 'constexpr spi_event_t operator~(spi_event_t)'
FORCE_INLINE_ATTR constexpr TYPE operator~ (TYPE a) { return (TYPE)~(INT_TYPE)a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:125:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator|(timer_intr_t, timer_intr_t)'
FORCE_INLINE_ATTR constexpr TYPE operator| (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a | (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:125:34: note: previous declaration 'constexpr spi_event_t operator|(spi_event_t, spi_event_t)'
FORCE_INLINE_ATTR constexpr TYPE operator| (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a | (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:126:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator&(timer_intr_t, timer_intr_t)'
FORCE_INLINE_ATTR constexpr TYPE operator& (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a & (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:126:34: note: previous declaration 'constexpr spi_event_t operator&(spi_event_t, spi_event_t)'
FORCE_INLINE_ATTR constexpr TYPE operator& (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a & (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:127:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator^(timer_intr_t, timer_intr_t)'
FORCE_INLINE_ATTR constexpr TYPE operator^ (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a ^ (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:127:34: note: previous declaration 'constexpr spi_event_t operator^(spi_event_t, spi_event_t)'
FORCE_INLINE_ATTR constexpr TYPE operator^ (TYPE a, TYPE b) { return (TYPE)((INT_TYPE)a ^ (INT_TYPE)b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:128:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator>>(timer_intr_t, int)'
FORCE_INLINE_ATTR constexpr TYPE operator>> (TYPE a, int b) { return (TYPE)((INT_TYPE)a >> b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:128:34: note: previous declaration 'constexpr spi_event_t operator>>(spi_event_t, int)'
FORCE_INLINE_ATTR constexpr TYPE operator>> (TYPE a, int b) { return (TYPE)((INT_TYPE)a >> b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:129:34: error: conflicting declaration of C function 'constexpr timer_intr_t operator<<(timer_intr_t, int)'
FORCE_INLINE_ATTR constexpr TYPE operator<< (TYPE a, int b) { return (TYPE)((INT_TYPE)a << b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:129:34: note: previous declaration 'constexpr spi_event_t operator<<(spi_event_t, int)'
FORCE_INLINE_ATTR constexpr TYPE operator<< (TYPE a, int b) { return (TYPE)((INT_TYPE)a << b); } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:130:25: error: conflicting declaration of C function 'timer_intr_t& operator|=(timer_intr_t&, timer_intr_t)'
FORCE_INLINE_ATTR TYPE& operator|=(TYPE& a, TYPE b) { a = a | b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:130:25: note: previous declaration 'spi_event_t& operator|=(spi_event_t&, spi_event_t)'
FORCE_INLINE_ATTR TYPE& operator|=(TYPE& a, TYPE b) { a = a | b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:131:25: error: conflicting declaration of C function 'timer_intr_t& operator&=(timer_intr_t&, timer_intr_t)'
FORCE_INLINE_ATTR TYPE& operator&=(TYPE& a, TYPE b) { a = a & b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:131:25: note: previous declaration 'spi_event_t& operator&=(spi_event_t&, spi_event_t)'
FORCE_INLINE_ATTR TYPE& operator&=(TYPE& a, TYPE b) { a = a & b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:132:25: error: conflicting declaration of C function 'timer_intr_t& operator^=(timer_intr_t&, timer_intr_t)'
FORCE_INLINE_ATTR TYPE& operator^=(TYPE& a, TYPE b) { a = a ^ b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:132:25: note: previous declaration 'spi_event_t& operator^=(spi_event_t&, spi_event_t)'
FORCE_INLINE_ATTR TYPE& operator^=(TYPE& a, TYPE b) { a = a ^ b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:133:25: error: conflicting declaration of C function 'timer_intr_t& operator>>=(timer_intr_t&, int)'
FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:133:25: note: previous declaration 'spi_event_t& operator>>=(spi_event_t&, int)'
FORCE_INLINE_ATTR TYPE& operator>>=(TYPE& a, int b) { a >>= b; return a; } \
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:134:25: error: conflicting declaration of C function 'timer_intr_t& operator<<=(timer_intr_t&, int)'
FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; }
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/timer_types.h:80:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(timer_intr_t)
^~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:134:25: note: previous declaration 'spi_event_t& operator<<=(spi_event_t&, int)'
FORCE_INLINE_ATTR TYPE& operator<<=(TYPE& a, int b) { a <<= b; return a; }
^~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:136:29: note: in expansion of macro 'FLAG_ATTR_IMPL'
#define FLAG_ATTR_U32(TYPE) FLAG_ATTR_IMPL(TYPE, uint32_t)
^~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/esp_common/include/esp_attr.h:137:19: note: in expansion of macro 'FLAG_ATTR_U32'
#define FLAG_ATTR FLAG_ATTR_U32
^~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v4.4.2/components/hal/include/hal/spi_types.h:47:1: note: in expansion of macro 'FLAG_ATTR'
FLAG_ATTR(spi_event_t)
^~~~~~~~~
C:/Projects/InventoryTrackingSystem/FW/InterfaceBoard/main/main.cpp: In function 'void app_main()':
C:/Projects/InventoryTrackingSystem/FW/InterfaceBoard/main/main.cpp:116:29: error: invalid conversion from 'esp_err_t (*)(void*)' {aka 'int (*)(void*)'} to 'TaskFunction_t' {aka 'void (*)(void*)'} [-fpermissive]
xTaskCreatePinnedToCore(&Buzzer_MainTask, "Buzzer_MainTask", 2048, (void*)(&xBuzzerCmdQueue), 1, NULL, 1);
^~~~~~~~~~~~~~~~
In file included from C:/Projects/InventoryTrackingSystem/FW/InterfaceBoard/main/main.cpp:6:
C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/include/freertos/task.h:344:56: note: initializing argument 1 of 'BaseType_t xTaskCreatePinnedToCore(TaskFunction_t, const char*, uint32_t, void*, UBaseType_t, void**, BaseType_t)'
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pvTaskCode,
~~~~~~~~~~~~~~~^~~~~~~~~~
C:/Projects/InventoryTrackingSystem/FW/InterfaceBoard/main/main.cpp:117:29: error: invalid conversion from 'esp_err_t (*)(void*)' {aka 'int (*)(void*)'} to 'TaskFunction_t' {aka 'void (*)(void*)'} [-fpermissive]
xTaskCreatePinnedToCore(&RgbHandler_MainTask, "RgbHandler_MainTask", 2048, (void*)(&xRgbCmdQueue), 5, NULL, 1);
^~~~~~~~~~~~~~~~~~~~
In file included from C:/Projects/InventoryTrackingSystem/FW/InterfaceBoard/main/main.cpp:6:
C:/Espressif/frameworks/esp-idf-v4.4.2/components/freertos/include/freertos/task.h:344:56: note: initializing argument 1 of 'BaseType_t xTaskCreatePinnedToCore(TaskFunction_t, const char*, uint32_t, void*, UBaseType_t, void**, BaseType_t)'
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pvTaskCode,
~~~~~~~~~~~~~~~^~~~~~~~~~
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Hi D1sconnected,
I really have no plans to port this to C. This is open-source so feel free to do that if you really need to.
But it will be quite a task because you will need to pass all class structure to C and also Adafruit GFX that is the graphical lib also uses CPP so you will have to replace that by a C friendly library.
This component is proven to work with ESP-IDF version 4.4 so I'm sure you are missing something. And I'm sorry but you need to tinker some time more with it until you get it to work.
I've left a lot of examples in Cale-idf that is where I develop this and they compile without much of a hassle.
I think there are also many examples on how to do it in C around and you can also just extract the commands just from the display class you use and convert only that to C. And maybe just try to use a pure C GFX. That's the only advice I can give you.
I use C for another stuff but this kind of things I prefer C++ and I don't really care what the base code of ESP-IDF is as long as it also supports what I want to use on top.
Good luck!
Hey, thanks for your time and reply!
As it's frequently turns out in programming - when something didn't work, it's better to have a fresh look on the problem after some rest, haha.
I did manage to integrate it:
- I left my entire code-base in C language with no changes
- Create additional cpp wrapper component, where placed CalEPD functions and left all cpp-related includes in cpp file
- Include wrapper header in
main.c
, function declaration hasextern C
directive
This works just fine. ESP32 Cmake pretty "smart" and there is no need to add any additional build steps.
And I suppose that the main issue was that I forget to remove cpp includes from header, which I tried to include in main.c
.
main.c
#include <eink_interface.h>
eink_interface.h
#ifdef __cplusplus
extern "C"
#endif
void EinkInterface_Demo(void);
eink_interface.cpp
#include "eink_interface.h"
#include "goodisplay/gdey0154d67.h"
#include <Fonts/ubuntu/Ubuntu_M8pt8b.h>
EpdSpi io;
Gdey0154d67 display(io);
void EinkInterface_Demo(void)
{
display.init(false);
display.setCursor(10, 40);
display.setFont(&Ubuntu_M8pt8b);
display.println("CalEPD display test\n");
display.update();
}
CMakeLists.txt
set(component_srcs "eink_interface.cpp")
idf_component_register(SRCS "${component_srcs}"
REQUIRES freertos driver CalEPD
INCLUDE_DIRS ".")
And here is stackoverflow topic, which perfectly describes what's going on.
https://stackoverflow.com/a/20325642
Great work D1sco,
Might I grab this to make a WiKi article?
Will reference your work of course!
@D1sconnected here is the Wiki Article:
https://github.com/martinberlin/cale-idf/wiki/Using-CalEPD-in-a-C-project
Quick question @D1sconnected
Do you think we can share your eink_interface.cpp / header file in a demo folder?
So we add a real demo on how to do it in case someone faces the same problem?
Just if you have some time and desire to help otherwise no need. Thanks for your feedback
@martinberlin yeah, of course!
It's kinda a draft, but do its job. Feel free to use or change anyhing!
Here is esp-idf component
folder with eink_interface
.
Then I call these functions in C lang FreeRTOS thread with no problems.
Great @D1sconnected I will add a C demo in next release. If you find any way to improve speed or add new display variations you are invited to fork this and collaborate