C 语言一些问题
typedef struct sLoRaMacPrimitives
{
/*!
* \brief MCPS-Confirm primitive
*
* \param [OUT] MCPS-Confirm parameters
*/
void ( *MacMcpsConfirm )( McpsConfirm_t *McpsConfirm );
/*!
* \brief MCPS-Indication primitive
*
* \param [OUT] MCPS-Indication parameters
*/
void ( *MacMcpsIndication )( McpsIndication_t *McpsIndication );
/*!
* \brief MLME-Confirm primitive
*
* \param [OUT] MLME-Confirm parameters
*/
void ( *MacMlmeConfirm )( MlmeConfirm_t *MlmeConfirm );
}LoRaMacPrimitives_t;
static McpsConfirm_t McpsConfirm;
typedef struct sMcpsConfirm
{
/*!
* Holds the previously performed MCPS-Request
*/
Mcps_t McpsRequest;
/*!
* Status of the operation
*/
LoRaMacEventInfoStatus_t Status;
/*!
* Uplink datarate
*/
uint8_t Datarate;
/*!
* Transmission power
*/
int8_t TxPower;
/*!
* Set if an acknowledgement was received
*/
bool AckReceived;
/*!
* Provides the number of retransmissions
*/
uint8_t NbRetries;
/*!
* The transmission time on air of the frame
*/
TimerTime_t TxTimeOnAir;
/*!
* The uplink counter value related to the frame
*/
uint32_t UpLinkCounter;
/*!
* The uplink frequency related to the frame
*/
uint32_t UpLinkFrequency;
}McpsConfirm_t;
int main( void )
{
LoRaMacPrimitives_t LoRaMacPrimitives;
LoRaMacCallback_t LoRaMacCallbacks;
MibRequestConfirm_t mibReq;
BoardInitMcu( );
BoardInitPeriph( );
DeviceState = DEVICE_STATE_INIT;
while( 1 )
{
switch( DeviceState )
{
case DEVICE_STATE_INIT:
{
LoRaMacPrimitives.MacMcpsConfirm = McpsConfirm;
LoRaMacPrimitives.MacMcpsIndication = McpsIndication;
LoRaMacPrimitives.MacMlmeConfirm = MlmeConfirm;
此处省略了 太长了就复制关键部分;
这个赋值没有看懂,LoRaMacPrimitives 我觉得一个函数指针的结构体 MacMcpsConfirm 这个函数指针的参数是 McpsConfirm_t *McpsConfirm,但是赋值的时候怎么就把 参数结构体 赋值过去了
这个做法没有看懂