I have been pushing common data too and fro, but am told that using common is considered bad form.
(If anyone is curious, you need to declare the shared C common variables with __attribute__((common)) to appease the GCC gods.
edit. Sorted
in the header file something like:
Code: Select all
[size=85]
[color=#BF0000]struct PulseParameters {unsigned int NoFillBlocks,FillBits;
unsigned int NoClearBlocks,ClearBits1,ClearBits2;};//define structure
#ifdef __XC__
int PrepareCounts(unsigned int FillFloatIn,unsigned int ClearFloatIn,struct PulseParameters &);//seen by XC
#else
int PrepareCounts(unsigned int FillFloatIn,unsigned int ClearFloatIn,struct PulseParameters *);//seen by c
#endif[/color]
in the XC code:
[color=#4000FF]struct PulseParameters Param;//create instanc eof structure
............
Dummy=PrepareCounts(FillT,ClearT,Param);//call c routine
...........[/color]
[color=#BF0000][/color]
In the c code:
[color=#FF00FF]
int PrepareCounts(unsigned int FillFloatIn,unsigned int ClearFloatIn,struct PulseParameters *Param)// pass structure as pointer
{
........
Param->FillBits=Param->FillBits | (1 << j);// do stuff with structure elements
........
}[/color]
[/size]