API for the Bit-Field manipulation library.
More...
|
|
#define | QBITFIELD_SIZE(NBITS) |
| | Use to determine the uint8_t array-size for a BitField.
|
| |
|
| int | qBitField_Setup (qBitField_t *const b, void *const area, const size_t area_size) |
| | Setup a initialize a BitField instance.
|
| |
| int | qBitField_ClearAll (qBitField_t *const b) |
| | Clear all the bits in the BitField.
|
| |
| int | qBitField_SetAll (qBitField_t *const b) |
| | Set all the bits in the BitField.
|
| |
| int | qBitField_SetBit (qBitField_t *const b, const size_t index) |
| | Sets one bit in a BitField.
|
| |
| int | qBitField_ClearBit (qBitField_t *const b, const size_t index) |
| | Clears one bit in a BitField.
|
| |
| int | qBitField_ToggleBit (qBitField_t *const b, const size_t index) |
| | Toggles (i.e. reverses the state of) a bit in a BitField.
|
| |
| uint8_t | qBitField_ReadBit (const qBitField_t *const b, const size_t index) |
| | Retrieve the state of a bit in a bitfield.
|
| |
| int | qBitField_WriteBit (qBitField_t *const b, const size_t index, uint8_t value) |
| | Writes one bit in a bitfield.
|
| |
| uint32_t | qBitField_ReadUINTn (const qBitField_t *const b, const size_t index, size_t xBits) |
| | Reads an unsigned 32-bit value from the BitField.
|
| |
| int | qBitField_WriteUINTn (qBitField_t *const b, const size_t index, uint32_t value, size_t xBits) |
| | Writes an unsigned n-bit value from the BitField.
|
| |
| float | qBitField_ReadFloat (const qBitField_t *const b, const size_t index) |
| | Reads a 32-bit floating point value from the BitField.
|
| |
| int | qBitField_WriteFloat (qBitField_t *const b, const size_t index, float value) |
| | Writes a 32-bit floating point value to the BitField.
|
| |
| void * | qBitField_Dump (const qBitField_t *const b, void *const dst, size_t n) |
| | Copies n bytes from the bit-field instance to a designed memory area.
|
| |
API for the Bit-Field manipulation library.
For a brief description of this module, please read Bit-Field manipulation library
◆ qBitField_ClearAll()
Clear all the bits in the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_ClearBit()
| int qBitField_ClearBit |
( |
qBitField_t *const | b, |
|
|
const size_t | index ) |
Clears one bit in a BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_Dump()
| void * qBitField_Dump |
( |
const qBitField_t *const | b, |
|
|
void *const | dst, |
|
|
size_t | n ) |
Copies n bytes from the bit-field instance to a designed memory area.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | dst | Pointer to the destination array where the content is to be copied. |
| [in] | n | Number of bytes to copy. |
- Returns
- Destination is returned on success, otherwise
NULL.
◆ qBitField_ReadBit()
| uint8_t qBitField_ReadBit |
( |
const qBitField_t *const | b, |
|
|
const size_t | index ) |
Retrieve the state of a bit in a bitfield.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index. |
- Returns
- The value of the bit at index.
◆ qBitField_ReadFloat()
| float qBitField_ReadFloat |
( |
const qBitField_t *const | b, |
|
|
const size_t | index ) |
Reads a 32-bit floating point value from the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index taken as offset. |
- Returns
- The floating point value from the BitField at the desired index
◆ qBitField_ReadUINTn()
| uint32_t qBitField_ReadUINTn |
( |
const qBitField_t *const | b, |
|
|
const size_t | index, |
|
|
size_t | xBits ) |
Reads an unsigned 32-bit value from the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index taken as offset. |
| [in] | xBits | The number of bits to read. ( max allowed : 32 bits ) |
- Returns
- The value from the bitfield from the desired index
◆ qBitField_SetAll()
Set all the bits in the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_SetBit()
| int qBitField_SetBit |
( |
qBitField_t *const | b, |
|
|
const size_t | index ) |
Sets one bit in a BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_Setup()
| int qBitField_Setup |
( |
qBitField_t *const | b, |
|
|
void *const | area, |
|
|
const size_t | area_size ) |
Setup a initialize a BitField instance.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | area | A pointer to the memory block to hold the BitField. Should be an uint8_t array of size QBITFIELD_SIZE(n), where n, is the number of bits inside the BitField. |
| [in] | area_size | The number of bytes in area. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_ToggleBit()
| int qBitField_ToggleBit |
( |
qBitField_t *const | b, |
|
|
const size_t | index ) |
Toggles (i.e. reverses the state of) a bit in a BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_WriteBit()
| int qBitField_WriteBit |
( |
qBitField_t *const | b, |
|
|
const size_t | index, |
|
|
uint8_t | value ) |
Writes one bit in a bitfield.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index. |
| [in] | value | The boolean value to write. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_WriteFloat()
| int qBitField_WriteFloat |
( |
qBitField_t *const | b, |
|
|
const size_t | index, |
|
|
float | value ) |
Writes a 32-bit floating point value to the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [in] | index | The bit-index taken as offset. |
| [in] | value | The floating point value to write. |
- Returns
- 1 on success, otherwise return 0.
◆ qBitField_WriteUINTn()
| int qBitField_WriteUINTn |
( |
qBitField_t *const | b, |
|
|
const size_t | index, |
|
|
uint32_t | value, |
|
|
size_t | xBits ) |
Writes an unsigned n-bit value from the BitField.
- Parameters
-
| [in] | b | A pointer to the BitField instance |
| [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 ) |
- Returns
- 1 on success, otherwise return 0.