Porting LVGL to Particle


I am porting LVGL (Little Versatile Graphics Library) to Particle.

Here is my code on Github.

The first error I have is

/inc/application.h:33:10: fatal error: chrono: No such file or directory
   33 | #include <chrono>

Is it correct that I must change all .c files to .cpp, as described in this post?


@volker, I believe the short answer is yes, you need to rename .c to .cpp. Are you developing using Particle Workbench? I assume you are targeting DeviceOS 5.01 for the new P2, correct?

I’m not sure where you include “Particle.h” in the code. Also, make sure to follow the correct library folder/file structure.

I’m developing with the particle CLI in a linux dev box.

Its not Workbench.

Yes, I’m targeting the P2 with OS 5.01.

I will rename all the files now and see what happens.

Yes, for cloud compiles all files must be .cpp.

For local compilation you can use .c files, but beware of functions exported by C files and used from C++ files as you probably will need some extern "C" to get around name mangling issues.

It’s usually easier to just use .cpp files everywhere.

ok, thanks.

I changed all .c to .cpp.

Now I got new errors.

Do you recommend I add #include “Particle.h” to all header (.h) files?

Any .cpp file that uses Arduino/Particle functions will need

#include "Particle.h"

If you use any structures or classes from the .h file it would need to be there, so it’s usually easiest to just include it from the .h files always. Internally it guards against multiple inclusion so it’s fine to include it from all of the .h files if you’re not sure the order they will be included.



I added

#include "Particle.h"

to all .h files.

So far so good, now I am getting this error

error: invalid conversion from 'void*' to 'lv_img_decoder_t*' {aka '_lv_img_decoder_t*'} [-fpermissive]
  156 | #define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(list); i != NULL; i = _lv_ll_get_next(list, i))
      |                                      ~~~~~~~~~~~~~~~^~~~~~
      |                                                     |
      |                                                     void*

It seems that it can be solved with const_cast.

But I still can’t get it to compile.

Does somebody have advice on how I can convert this to c++?

(My code can be found on Github)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.