转Github_Wiki_Using CalEPD in a C project

via D1sconnected(https://github.com/D1sconnected), he asked this in a CalEPD issue(https://github.com/martinberlin/CalEPD/issues/9) and found a nice way to do it.
Since the Issue is closed, in order to make the solution available to everyone, I decided to add it here in the WiKi.
Background info: You are working in a C project but you want to use a C++ component like CalEPD. What is the right step? Should I update all my code to C++?
In D1sconnected own words here is his explanation on how to do it.
Steps 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.
main.c
eink_interface.h
eink_interface.cpp
CMakeLists.txt
欢迎各位尝试移植,CALE-IDF中COMPONENT里的CALEPD现在已经由我提供样品支持,目前GOOD DISPLAY系列很多SPI屏幕都可以成功使用!!!