1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

Additional logical operators

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-03-29 14:53:12 +01:00
parent d12ecfc410
commit b365cfe51d
2 changed files with 25 additions and 0 deletions

View file

@ -108,6 +108,26 @@ int logicConditionCompute(
return operandA > 1666;
break;
case LOGIC_CONDITION_AND:
return (operandA && operandB);
break;
case LOGIC_CONDITION_OR:
return (operandA || operandB);
break;
case LOGIC_CONDITION_XOR:
return (operandA != operandB);
break;
case LOGIC_CONDITION_NAND:
return !(operandA && operandB);
break;
case LOGIC_CONDITION_NOR:
return !(operandA || operandB);
break;
default:
return false;
break;

View file

@ -36,6 +36,11 @@ typedef enum {
LOGIC_CONDITION_LOW, // 4
LOGIC_CONDITION_MID, // 5
LOGIC_CONDITION_HIGH, // 6
LOGIC_CONDITION_AND, // 7
LOGIC_CONDITION_OR, // 8
LOGIC_CONDITION_XOR, // 9
LOGIC_CONDITION_NAND, // 10
LOGIC_CONDITION_NOR, // 11
LOGIC_CONDITION_LAST
} logicOperation_e;