Adding a Library for the MLX90640 and a CPP file

AgentSmithers
Posts: 175
Joined: Sat Apr 01, 2017 1:21 am
Contact:

Adding a Library for the MLX90640 and a CPP file

Postby AgentSmithers » Tue Mar 31, 2020 12:41 pm

Hi Everyone!

https://github.com/melexis/mlx90640-lib ... /functions

https://github.com/linkineo/REDar/blob/ ... 0640_API.c

These two links are useful from my google findings. The first one is a library created by the company in CPP but they don't appear to offer it's library in C.
So I decided to search Github for LMX90640 as a keyword filtering on .C and found REDar. However when coping it to my internal project it seems to take issues with mostly the for loops because I'm not running on a C99 compliler.
My question is, Is there a simpler way to complete this task. Maybe a better place to source code for the specific situation or is the path of lease resistance in this case is to convert all the for loops to while loops or can I expect even more then that to be an issue even if I were to rewrite those. I would like to get my CAM up and running on NONOS SDK 3.0.2 if possible, I would like to avoid Lua / Micropython of course and stick with C....

Code: Select all

[osboxes@osboxes mlx90640]$ make MLX90640API
xtensa-lx106-elf-gcc -I. -DICACHE_FLASH -mlongcalls   -c -o MLX90640_API.o MLX90640_API.c
MLX90640_API.c: In function 'MLX90640_CalculateTo':
MLX90640_API.c:329:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for( int i = 0; i < 2; i++)
     ^
MLX90640_API.c:329:5: note: use option -std=c99 or -std=gnu99 to compile your code
MLX90640_API.c:347:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for( int pixelNumber = 0; pixelNumber < 768; pixelNumber++)
     ^
MLX90640_API.c: In function 'MLX90640_GetImage':
MLX90640_API.c:458:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for( int i = 0; i < 2; i++)
     ^
MLX90640_API.c:476:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for( int pixelNumber = 0; pixelNumber < 768; pixelNumber++)
     ^
MLX90640_API.c: In function 'ExtractKsToParameters':
MLX90640_API.c:817:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 4; i++)
     ^
MLX90640_API.c: In function 'ExtractAlphaParameters':
MLX90640_API.c:851:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 6; i++)
     ^
MLX90640_API.c:860:13: error: redefinition of 'i'
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:851:13: note: previous definition of 'i' was here
     for(int i = 0; i < 6; i++)
             ^
MLX90640_API.c:860:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:868:13: error: redefinition of 'i'
     for(int i = 0; i < 8; i++)
             ^
MLX90640_API.c:860:13: note: previous definition of 'i' was here
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:868:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 8; i++)
     ^
MLX90640_API.c:877:13: error: redefinition of 'i'
     for(int i = 0; i < 32; i ++)
             ^
MLX90640_API.c:868:13: note: previous definition of 'i' was here
     for(int i = 0; i < 8; i++)
             ^
MLX90640_API.c:877:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 32; i ++)
     ^
MLX90640_API.c:885:13: error: redefinition of 'i'
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:877:13: note: previous definition of 'i' was here
     for(int i = 0; i < 32; i ++)
             ^
MLX90640_API.c:885:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:887:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < 32; j ++)
         ^
MLX90640_API.c:904:13: error: redefinition of 'i'
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:885:13: note: previous definition of 'i' was here
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:904:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 1; i < 768; i++)
     ^
MLX90640_API.c:919:13: error: redefinition of 'i'
     for(int i = 0; i < 768; i++)
             ^
MLX90640_API.c:904:13: note: previous definition of 'i' was here
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:919:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 768; i++)
     ^
MLX90640_API.c: In function 'ExtractOffsetParameters':
MLX90640_API.c:952:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 6; i++)
     ^
MLX90640_API.c:961:13: error: redefinition of 'i'
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:952:13: note: previous definition of 'i' was here
     for(int i = 0; i < 6; i++)
             ^
MLX90640_API.c:961:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:969:13: error: redefinition of 'i'
     for(int i = 0; i < 8; i++)
             ^
MLX90640_API.c:961:13: note: previous definition of 'i' was here
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:969:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 8; i++)
     ^
MLX90640_API.c:978:13: error: redefinition of 'i'
     for(int i = 0; i < 32; i ++)
             ^
MLX90640_API.c:969:13: note: previous definition of 'i' was here
     for(int i = 0; i < 8; i++)
             ^
MLX90640_API.c:978:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 32; i ++)
     ^
MLX90640_API.c:986:13: error: redefinition of 'i'
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:978:13: note: previous definition of 'i' was here
     for(int i = 0; i < 32; i ++)
             ^
MLX90640_API.c:986:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:988:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < 32; j ++)
         ^
MLX90640_API.c: In function 'ExtractKtaPixelParameters':
MLX90640_API.c:1049:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:1051:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < 32; j ++)
         ^
MLX90640_API.c:1068:13: error: redefinition of 'i'
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:1049:13: note: previous definition of 'i' was here
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:1068:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 1; i < 768; i++)
     ^
MLX90640_API.c:1083:13: error: redefinition of 'i'
     for(int i = 0; i < 768; i++)
             ^
MLX90640_API.c:1068:13: note: previous definition of 'i' was here
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:1083:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 768; i++)
     ^
MLX90640_API.c: In function 'ExtractKvPixelParameters':
MLX90640_API.c:1147:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 24; i++)
     ^
MLX90640_API.c:1149:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < 32; j ++)
         ^
MLX90640_API.c:1160:13: error: redefinition of 'i'
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:1147:13: note: previous definition of 'i' was here
     for(int i = 0; i < 24; i++)
             ^
MLX90640_API.c:1160:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 1; i < 768; i++)
     ^
MLX90640_API.c:1175:13: error: redefinition of 'i'
     for(int i = 0; i < 768; i++)
             ^
MLX90640_API.c:1160:13: note: previous definition of 'i' was here
     for(int i = 1; i < 768; i++)
             ^
MLX90640_API.c:1175:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i = 0; i < 768; i++)
     ^
MLX90640_API.c: In function 'GetMedian':
MLX90640_API.c:1412:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i=0; i<n-1; i++)
     ^
MLX90640_API.c:1414:9: error: 'for' loop initial declarations are only allowed in C99 mode
         for(int j=i+1; j<n; j++)
         ^
MLX90640_API.c: In function 'IsPixelBad':
MLX90640_API.c:1441:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for(int i=0; i<5; i++)
     ^
make: *** [MLX90640_API.o] Error 1
[osboxes@osboxes mlx90640]$

Who is online

Users browsing this forum: No registered users and 19 guests