union my_api_uint16_union_t
{
uint8_t v[2];
uint16_t Val;
};
struct my_mac_param_t
{
union
{
uint8_t Val;
struct
{
uint8_t 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
uint8_t broadcast : 1; // 1: broadcast, 0: unicast
uint8_t secEn : 1; // 1: secure the MAC payload, 0: send plain text
uint8_t repeat : 1; // 1: allow repeaters to forward the message, 0: send message directly
uint8_t ackReq : 1; // 1: acknowledgement required, 0: no acknowldgement
uint8_t destPrsnt : 1; // 1: destination address in the packet, 0: destination address not in the packet
uint8_t sourcePrsnt : 1; // 1: source address in the packet, 0: source address not in the packet
} bits;
} flags;
uint8_t *DestAddress; // destination address
bool altDestAddr; // use the alternative network address as destination in the packet
bool altSrcAddr; // use the alternative network address as source in the packet
union my_api_uint16_union_t DestPANID; // PAN identifier of the destination
};
typedef union my_api_uint16_union_t api_uint16_union_t;
typedef struct my_mac_param_t mac_param_t;
int main(void)
{
mac_param_t hola;
hola.flags.Val = 250;
if(hola.flags.Val == 200);
while(1);
}