I have hit a wall now and would like to get back to speed.
I have a "fileA.c" file and "fileB.c" file that I would like to pass variables between. Furthermore, "fileA.h" and "fileB.h" are the headers respectively.
A variable UINT16 Storage1.CntLog1.PosEdge
in "fileA.c" to "fileB.c".
How do I do this using a pointer?
Below is code snippet of FileA.h header file and I would like to pass to another FileB.c the Variable PosEdge as a reference. There are 2 varibales PosEdge one in Header and the Other in c file. Anyone will do.
typedef struct
{
UINT16 PosEdge;
} S_PosEdge;
typedef struct S_CntLog1
{
S_PosEdge CntLog1;
} S_CntLog1;
This is a snippet of FileA.c
typedef struct
{
UINT16 PosEdge;
} S_CntLog2;
PRIVATE S_CntLog1 Storage1;
PRIVATE S_CntLog2 *Storage2 = NULL;
Storage1.CntLog1.PosEdge = Storage2->PosEdge;
What I tried........ I tried using something like this
UINT16 ShareLog(void)
{
return (Storage1.CntLog1.PosEdge);
}
and similarly declaring it in the header "fileA.h", then "#include fileA.h" in "fileB.c" and furthermore Blink an LED if (Storage1.CntLog1.PosEdge==0x01)
I have no idea how I can send this information using Pointers..... Any help would be appreciated. Thanks. maybe something along the lines of
UINT16* pntr1 =&Storage1.CntLog1.PosEdge;
But the PIC32 compiler doesn't like the "&"