我正在使用一对 MRF24J40 无线电芯片来让一个 PIC32 微控制器板通过射频传输与另一个板进行通信。我的所有代码都可以正常编译,但我不断收到与此代码相关的错误。
typedef struct
{
union
{
BYTE Val;
struct
{
BYTE packetType :2; // type of packet. Possible types are
// * PACKET_TYPE_DATA - Data type
// * PACKET_TYPE_COMMAND - Command type
// * PACKET_TYPE_ACK - Acknowledgement type
// * PACKET_TYPE_RESERVE - Reserved type
BYTE broadcast :1; // 1: broadcast, 0: unicast
BYTE secEn :1; // 1: secure the MAC payload, 0: send plain text
BYTE repeat :1; // 1: allow repeaters to forward the message, 0: send message directly
BYTE ackReq :1; // 1: acknowledgement required, 0: no acknowldgement
BYTE destPrsnt :1; // 1: destination address in the packet, 0: destination address not in the packet
BYTE sourcePrsnt :1; // 1: source address in the packet, 0: source address not in the packet
} bits;
} flags;
BYTE * SourceAddress; // Address of the Sender
BYTE * Payload; // Pointer to the payload
BYTE PayloadLen; // Payload size
BYTE RSSIValue; // RSSI value for the received packet
BYTE LQIValue; // LQI value for the received packet
#if defined(IEEE_802_15_4)
BOOL altSourceAddress; // Source address is the alternative network address
WORD_VAL SourcePANID; // PAN ID of the sender
#endif
} MAC_RECEIVED_PACKET;
基本上我已经尝试了地球上的所有方法来更改变量packetType
,secEn
等ackReq
的值。我尝试在声明后直接更改值,但这似乎是位长度,而不是值。代码(直接来自微芯片的网站)有注释说 1 = this 和 0 = that 但我还没有找到可以更改这些值的任何地方。任何熟悉这些 MRF24J40 芯片的人的帮助将不胜感激。谢谢你。