![]() |
Documentation
Tools for embedded systems
|
A BitField object. More...
#include <bitfield.hpp>
Public Member Functions | |
| bitfield ()=default | |
| virtual | ~bitfield ()=default |
| bool | setup (void *const area, const size_t area_size) noexcept |
| Setup a initialize a BitField instance. | |
| template<size_t area_size> | |
| bool | setup (uint8_t(&area)[area_size]) |
| Setup a initialize a BitField instance. | |
| bool | clearAll (void) noexcept |
| Clear all the bits in the BitField. | |
| bool | setAll (void) noexcept |
| Set all the bits in the BitField. | |
| bool | setBit (const size_t index) noexcept |
| Sets one bit in a BitField. | |
| bool | clearBit (const size_t index) noexcept |
| Clears one bit in a BitField. | |
| bool | toggleBit (const size_t index) noexcept |
| Toggles (i.e. reverses the state of) a bit in a BitField. | |
| bool | readBit (const size_t index) const noexcept |
| Retrieve the state of a bit in a bitfield. | |
| bool | writeBit (const size_t index, const bool value) noexcept |
| Writes one bit in a bitfield. | |
| uint32_t | readUINTn (const size_t index, const size_t xBits) const noexcept |
| Reads an unsigned 32-bit value from the BitField. | |
| bool | writeUINTn (const size_t index, const size_t xBits, uint32_t value) noexcept |
| Writes an unsigned n-bit value from the BitField. | |
| float | readFloat (const size_t index) const noexcept |
| Reads a 32-bit floating point value from the BitField. | |
| bool | writeFloat (const size_t index, const float value) noexcept |
| Writes a 32-bit floating point value to the BitField. | |
| void * | dump (void *const dst, const size_t n) noexcept |
| Copies n bytes from the bit-field instance to a designed memory area. | |
| bool | isInitialized (void) const |
| Check if the bit-field instance has been initialized. | |
| operator bool () const noexcept | |
| Check if the bit-field instance has been initialized. | |
A BitField object.
|
default |
|
virtualdefault |
|
noexcept |
Clear all the bits in the BitField.
true on success, otherwise return false.
|
noexcept |
Clears one bit in a BitField.
| [in] | index | The bit-index. |
true on success, otherwise return false.
|
noexcept |
Copies n bytes from the bit-field instance to a designed memory area.
| [in] | dst | Pointer to the destination array where the content is to be copied. |
| [in] | n | Number of bytes to copy. |
nullptr.
|
inline |
Check if the bit-field instance has been initialized.
true if instance has been initialized
|
inlineexplicitnoexcept |
Check if the bit-field instance has been initialized.
true if instance has been initialized
|
noexcept |
Retrieve the state of a bit in a bitfield.
| [in] | index | The bit-index. |
|
noexcept |
Reads a 32-bit floating point value from the BitField.
| [in] | index | The bit-index taken as offset. |
|
noexcept |
Reads an unsigned 32-bit value from the BitField.
| [in] | index | The bit-index taken as offset. |
| [in] | xBits | The number of bits to read. ( max allowed : 32 bits ) |
|
noexcept |
Set all the bits in the BitField.
true on success, otherwise return false.
|
noexcept |
Sets one bit in a BitField.
| [in] | index | The bit-index. |
true on success, otherwise return false.
|
inline |
Setup a initialize a BitField instance.
| [in] | area | The memory block to hold the BitField. Should be an uint8_t array created with the bitArea<n> alias, where n, is the number of bits for the BitField. |
true on success, otherwise return false.
|
noexcept |
Setup a initialize a BitField instance.
| [in] | area | The memory block to hold the BitField. Should be an uint8_t array created with the bitArea<n> alias, where n, is the number of bits for the BitField. |
| [in] | area_size | The number of bytes in area. |
true on success, otherwise return false.
|
noexcept |
Toggles (i.e. reverses the state of) a bit in a BitField.
| [in] | index | The bit-index. |
true on success, otherwise return false.
|
noexcept |
Writes one bit in a bitfield.
| [in] | index | The bit-index. |
| [in] | value | The boolean value to write. |
true on success, otherwise return false.
|
noexcept |
Writes a 32-bit floating point value to the BitField.
| [in] | index | The bit-index taken as offset. |
| [in] | value | The floating point value to write. |
true on success, otherwise return false.
|
noexcept |
Writes an unsigned n-bit value from the BitField.
| [in] | index | The bit-index taken as offset. |
| [in] | value | The value to write. |
| [in] | xBits | The number of bits to read. ( max allowed : 32 bits ) |
true on success, otherwise return false.