RadioEvents.RxDone
is a variable of function-pointer type. It can refer to any function with a specific parameter and return type signature defined by its type definition. In this case the structure member RxDone
is defined thus:
void ( *RxDone )( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
Indicating that it refers to a function returning void
and taking four arguments of the types uint8_t*
, uint16_t
, int16_t
, and int8_t
respectively. The parameter names in this declaration are optional and it could equelly be:
void (*RxDone)( uint8_t*, uint16_t, int16_t, int8_t );
or even
tRxDone RxDone ;
where tRxDone
is defines thus:
typedef (*tRxDone)( uint8_t*, uint16_t, int16_t, int8_t );
The function assigned to RadioEvents.RxDone
may be invoked subsequently (not shown in your code fragment) thus:
RadioEvents.RxDone( data, data_length, rssi, snr ) ;
The purpose of using a pointer to a function is that it provided support for late binding where the function to be invoked is determined at run-time rather than hard coded by the linker and build-time. It is often used for callbacks where some library code will call a user supplied function in order to adapt and customise the behaviour. In turn callbacks are often used for event handlers which appears to be what is going n in your example.
What the assignment of RadioEvents.RxDone
does is essentially tell the library *"when event Rx Complete happens call my function OnRxDone
"*.