OS
v1.7.5
Documentation
|
Namespaces | |
namespace | qOS::bits |
Helper Bit-manipulation interfaces. | |
Functions | |
template<typename T , typename W > | |
void | qOS::bits::multipleSet (T &dst, W xBits) |
Uses the bitwise OR operator to set bits into dst. | |
template<typename T , typename W > | |
void | qOS::bits::multipleClear (T &dst, W xBits) |
Uses the bitwise AND operator to clear bits into dst. | |
template<typename T > | |
void | qOS::bits::singleSet (T &dst, const size_t xBit) |
Uses the bitwise OR operator to set a single bit into dst. | |
template<typename T > | |
void | qOS::bits::singleClear (T &dst, const size_t xBit) |
Uses the bitwise AND operator to clear a single bit into dst. | |
template<typename T > | |
bool | qOS::bits::singleRead (T dst, const size_t xBit) |
Uses the bitwise AND operator to read the value of a single bit from dst. | |
template<typename T > | |
void | qOS::bits::singleToggle (T &dst, const size_t xBit) |
Uses the bitwise XOR operator to toggle the value of a single bit from dst. | |
template<typename T > | |
void | qOS::bits::singleWrite (T &dst, const size_t xBit, const bool value) |
Write the boolean value in a single bit of the dst variable. | |
template<typename T , typename W > | |
bool | qOS::bits::multipleGet (T reg, W xBits) |
Read multiple bits by applying the mask given by xBits to the dst variable. | |
template<typename T , size_t n> | |
constexpr size_t | qOS::arraySize (const T(&arr)[n]) noexcept |
Calculates the size of an array. This function takes a reference to an array and calculates its size. For a one-dimensional array, the size is simply the number of elements. For a multi-dimensional array, the size is the product of the sizes of all dimensions. | |
template<typename T > | |
T | qOS::clip (T x, const T Min, const T Max) |
Ensures that x is between the limits set by Min and Max. | |
template<typename T > | |
T | qOS::clipUpper (T x, const T Max) |
Ensures that x is bellow the limits set by Max. | |
template<typename T > | |
T | qOS::clipLower (T x, const T Min) |
Ensures that x is above the value set by Min. | |
template<typename T > | |
T | qOS::isBetween (T x, const T Low, const T High) |
Check if the value of x is within the limits defined by Low and High. | |
uint8_t | qOS::byteNibbleHigh (uint8_t x) |
Read the high-nibble from x. | |
uint8_t | qOS::byteNibbleLow (uint8_t x) |
Read the low-nibble from x. | |
uint8_t | qOS::byteMergeNibbles (uint8_t h, uint8_t l) |
Merges two nibbles to form one byte. | |
uint16_t | qOS::wordByteHigh (uint16_t x) |
Read the high-byte from x. | |
uint16_t | qOS::wordByteLow (uint16_t x) |
Read the low-byte from x. | |
uint16_t | qOS::wordMergeBytes (uint16_t h, uint16_t l) |
Merges two bytes to form one Word. | |
uint32_t | qOS::dWordWordHigh (uint32_t x) |
Read the high-word from x. | |
uint32_t | qOS::dWordWordLow (uint32_t x) |
Read the low-word from x. | |
uint32_t | qOS::dwordMergeWords (uint32_t h, uint32_t l) |
Merges two words to form one DWord. | |
|
constexprnoexcept |
Calculates the size of an array. This function takes a reference to an array and calculates its size. For a one-dimensional array, the size is simply the number of elements. For a multi-dimensional array, the size is the product of the sizes of all dimensions.
T | The type of the array elements. |
n | The size of the first dimension (for a multi-dimensional array). |
arr | The array whose size to calculate. |
|
inline |
Merges two nibbles to form one byte.
[in] | h | The high nibble |
[in] | l | The low nibble |
|
inline |
Read the high-nibble from x.
[in] | x | The input variable |
|
inline |
Read the low-nibble from x.
[in] | x | The input variable |
|
inline |
Ensures that x is between the limits set by Min and Max.
[in] | x | The value to clamp |
[in] | Min | The minimum value allowed. |
[in] | Max | The maximum value allowed. |
|
inline |
Ensures that x is above the value set by Min.
[in] | x | The value to clamp |
[in] | Min | The minimum value allowed. |
|
inline |
Ensures that x is bellow the limits set by Max.
[in] | x | The value to clamp |
[in] | Max | The maximum value allowed. |
|
inline |
Merges two words to form one DWord.
[in] | h | The high byte |
[in] | l | The low byte |
|
inline |
Read the high-word from x.
[in] | x | The input variable |
|
inline |
Read the low-word from x.
[in] | x | The input variable |
|
inline |
Check if the value of x is within the limits defined by Low and High.
[in] | x | The value to check |
[in] | Low | The minimum value allowed. |
[in] | High | The maximum value allowed. |
true
if the x is between the defined range. Otherwise returns false
.
|
inline |
Uses the bitwise AND operator to clear bits into dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBits | Indicates which bits are to be cleared |
|
inline |
Read multiple bits by applying the mask given by xBits to the dst variable.
[in] | reg | The variable where the operation will be applied |
[in] | xBits | The bit mask |
|
inline |
Uses the bitwise OR operator to set bits into dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBits | Indicates which bits are to be set |
|
inline |
Uses the bitwise AND operator to clear a single bit into dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBit | The bit-index |
|
inline |
Uses the bitwise AND operator to read the value of a single bit from dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBit | The bit-index |
|
inline |
Uses the bitwise OR operator to set a single bit into dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBit | The bit-index |
|
inline |
Uses the bitwise XOR operator to toggle the value of a single bit from dst.
[in] | dst | The variable where the operation will be applied |
[in] | xBit | The bit-index |
|
inline |
Write the boolean value in a single bit of the dst variable.
[in] | dst | The variable where the operation will be applied |
[in] | xBit | The bit-index |
[in] | value | The boolean value to write |
|
inline |
Read the high-byte from x.
[in] | x | The input variable |
|
inline |
Read the low-byte from x.
[in] | x | The input variable |
|
inline |
Merges two bytes to form one Word.
[in] | h | The high byte |
[in] | l | The low byte |