DS18B20 in argument

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
coco82
Posts: 9
Joined: 25 Sep 2017 22:25

DS18B20 in argument

Post by coco82 »

Hi,

I try to make a function with the class DS18B20 in argument:

Code: Select all

void lectureTemp(DS18B20Sensor * capteur,  float* temp, int ligne)
When I compile, I get this error:

Code: Select all

C:\Users\Jerome\AppData\Local\Temp\build8533003694867026979.tmp\_Test_ucxx.c:673: error 98: conflict with previous definition of 'lectureTemp' for attribute 'type'
from type 'void function ( struct DS18B20Sensor generic* fixed, float generic* fixed, int fixed) __reentrant fixed'
  to type 'void function ( struct DS18B20Sensor generic* fixed, float generic* fixed, int fixed) __reentrant fixed'
Error. SDCC returned: 1
I don't understand where is the difference...

When I take a look in the file "prog_ucxx.c" , I find my function written like that:

Code: Select all

void lectureTemp(struct DS18B20Sensor * capteur, float * temp, int ligne);
Should it be written in this way ?

Code: Select all

void lectureTemp(struct cxx__class__DS18B20Sensor* capteur, float * temp, int ligne);
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: DS18B20 in argument

Post by petergebruers »

All I can tell you is that the uCxx is a simplified version of C++ and it does not support everything standard C++ does. As you have found out, uCxx translates your code to plain C (that is translated to assembly language and in the end linked into binary code) so that is why you suddenly see a struct... As a workaround, can you define that sensor as a global variable (like in the example on the forum)?
Post Reply