mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-22 07:45:24 +03:00
Add a proper type for bit arrays
- Define type bitArrayElement_t as uint32_t. - Add BITARRAY_DECLARE() macro, which declares a bit array given the number of desired bits, taking care of aligment and rounding up its size to a multiple of 32. - Change bit array functions to accept bitarrayElement_t* rather than void*. - Replace bit array declarations with BITARRAY_DECLARE() macro - Add BITARRAY_FIND_FIRST_SET() macro to call bitArrayFindFirstSet() without explicitely specifying its size. - Update comments in bitarray.h to reflect these changes.
This commit is contained in:
parent
daa4c17c3b
commit
9fd3b4286f
6 changed files with 28 additions and 20 deletions
|
@ -66,7 +66,7 @@ bool isUsingNavigationModes(void)
|
|||
|
||||
bool IS_RC_MODE_ACTIVE(boxId_e boxId)
|
||||
{
|
||||
return bitArrayGet(&rcModeActivationMask, boxId);
|
||||
return bitArrayGet(rcModeActivationMask.bits, boxId);
|
||||
}
|
||||
|
||||
void rcModeUpdate(boxBitmask_t *newState)
|
||||
|
@ -124,13 +124,13 @@ void updateActivatedModes(void)
|
|||
if (modeActivationOperatorConfig()->modeActivationOperator == MODE_OPERATOR_AND) {
|
||||
// AND the conditions
|
||||
if (activeConditionCountPerMode[modeIndex] == specifiedConditionCountPerMode[modeIndex]) {
|
||||
bitArraySet(&newMask, modeIndex);
|
||||
bitArraySet(newMask.bits, modeIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// OR the conditions
|
||||
if (activeConditionCountPerMode[modeIndex] > 0) {
|
||||
bitArraySet(&newMask, modeIndex);
|
||||
bitArraySet(newMask.bits, modeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue