Home > other >  This code in the assignment is a little look not to understand
This code in the assignment is a little look not to understand

Time:09-17


Typedef struct
{
Uint8_t u8Id;
Int8_t i8PosOld;
Int8_t i8Pos;
Uint8_t u8Direction;
Uint8_t u8Collision;//3? I?
Uint8_t u8FSM_State;
Uint32_t u32Step;
Uint32_t u32Tim;
Uint32_t u32Speed;
Int32_t Action (*) (void *);
} tsLedPoint;
TsLedPoint sLedPoint [8].

Typedef struct
{
Uint32_t u32NumOfOBJ;
TsLedPoint * psLedPoint;
Void Action (*) (void *);
} tsArbiter;


Void ArbiterAction (tsArbiter * psArbiter)
{
Uint32_t I;

For (I=0; I & lt; PsArbiter - & gt; U32NumOfOBJ; I++)
{
If (psArbiter - & gt; PsLedPoint [I] u32Step!=0)
{
PsArbiter - & gt; PsLedPoint [I] u32Tim + +;
}

}




TsArbiter sArbiter={
U32NumOfOBJ=2,
PsLedPoint=sLedPoint,
Action=(void) (*) (void *) ArbiterAction
};

The top three is structure variable
Above is for. The Action of assignment card don't know much about



The concept of function Pointers and pointer function I am understand
But this heap together I don't know much about the
Consult everybody small white








CodePudding user response:

The function ArbiterAction () address is assigned to sArbiter. Action

CodePudding user response:

Cast to a function pointer, namely the function of 1/f, said ArbiterAction () address is assigned to sArbiter. Action,
Void (*) () with no parameters of
Void (*) (int, long) containing parameter
Void (*) (void *) containing a pointer parameter
  • Related