Hi,
I'm always strugling with bitfields (because I don't use it very often).
My bitfield is defined in main.h, like:
typedef struct
{
unsigned int unused: 4;
unsigned int DTIME: 2;
unsigned int ISGAIN: 2;
unsigned int EXSTALL: 1;
unsigned int MODE: 4;
unsigned int RSTEP: 1;
unsigned int RDIR: 1;
unsigned int ENBL: 1;
} structDRV8711CTRL;
extern structDRV8711CTRL DRV8711CTRL;
And in main.c as:structDRV8711CTRL DRV8711CTRL;
From within another file windingProcess.c the I use the code:
DRV8711MODE=4;
DRV8711CTRL.DTIME=3;
DRV8711CTRL.ISGAIN=0;
DRV8711CTRL.EXSTALL=0;
DRV8711CTRL.MODE=4;
DRV8711CTRL.RSTEP=0;
DRV8711CTRL.RDIR=0;
DRV8711CTRL.ENBL=1;
data=SPIserial(1,1,DRV8711CTRL);
Which results in error: windingProcess.c:120:5: error: incompatible type for argument 3 of 'SPIserial'
I guess because an unsigned int is expected as declared in the file procEE.h: extern unsigned int SPIserial(unsigned int SPIn, unsigned int target, unsigned int data);
But I can't get a grip on where it's going wrong. I've searched online for several solutions, but none worked so far.
Can anyone help in this?
Thanx!