mirror of https://github.com/ArduPilot/ardupilot
AP_Common: added setonoff() method for bitmask
This commit is contained in:
parent
19fd2d0b88
commit
9d42f49ac8
|
@ -81,6 +81,15 @@ public:
|
||||||
bits[word] &= ~(1U << ofs);
|
bits[word] &= ~(1U << ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set given bitnumber to on/off
|
||||||
|
void setonoff(uint16_t bit, bool onoff) {
|
||||||
|
if (onoff) {
|
||||||
|
set(bit);
|
||||||
|
} else {
|
||||||
|
clear(bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// clear all bits
|
// clear all bits
|
||||||
void clearall(void) {
|
void clearall(void) {
|
||||||
memset(bits, 0, numwords*sizeof(bits[0]));
|
memset(bits, 0, numwords*sizeof(bits[0]));
|
||||||
|
|
Loading…
Reference in New Issue