enum LIVELLI_EMERGENZA {
LIV_EME_UNO = 0x0001,
LIV_EME_DUE = 0x0002,
LIV_EME_TRE = 0x0003
};
typedef struct Emergenza {
int Tipo;
short Livello;
} Emergenza;
void TrovaEmergenze()
{
if(INPUT_GET(IN_FUNGO_EMERGENZA)) {
Emergenza.Tipo |= EME_FUNGO_PREMUTO;
Emergenza.Livello |= LIV_EME_UNO;
}
if((INPUT_GET(IN_FC_CARTER_LAMA))){
Emergenza.Tipo |= EME_CARTER_LAMA_APERTO;
Emergenza.Livello |= LIV_EME_DUE;
}
}
char EmeLivello1()
{
if((Emergenza.Livello & LIV_EME_UNO) != 0)
return 1;
return 0;
}
Having evaluated the mask emergenza.livello I'm going to check it with & LIV_EME_UNO. If it is different from 0, this means that the bits in the mask is high; but I get the error "expected expression before '!=' token".
In your code, Emergenza is essentially a datatype, not a variable. You need to have a variable of that type to use the member access operator .
To make Emergenza a variable instead of a datatype do this:
struct Emergenza {
int Tipo;
short Livello;
} Emergenza;
In summary, remove the typedef.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With