Op Divider and bitutility updates
- Added unittests for `PeriodicOperationDivider` and the `bitutil` helpers - Some API changes: Removed redundant bit part, because these functions are already in a namespace - Some bugfixes for `PeriodicOperationDivider`
This commit is contained in:
@@ -5,13 +5,36 @@
|
||||
|
||||
namespace bitutil {
|
||||
|
||||
/* Helper functions for manipulating the individual bits of a byte.
|
||||
Position refers to n-th bit of a byte, going from 0 (most significant bit) to
|
||||
7 (least significant bit) */
|
||||
void bitSet(uint8_t* byte, uint8_t position);
|
||||
void bitToggle(uint8_t* byte, uint8_t position);
|
||||
void bitClear(uint8_t* byte, uint8_t position);
|
||||
bool bitGet(const uint8_t* byte, uint8_t position);
|
||||
// Helper functions for manipulating the individual bits of a byte.
|
||||
// Position refers to n-th bit of a byte, going from 0 (most significant bit) to
|
||||
// 7 (least significant bit)
|
||||
|
||||
/**
|
||||
* @brief Set the bit in a given byte
|
||||
* @param byte
|
||||
* @param position
|
||||
*/
|
||||
void set(uint8_t* byte, uint8_t position);
|
||||
/**
|
||||
* @brief Toggle the bit in a given byte
|
||||
* @param byte
|
||||
* @param position
|
||||
*/
|
||||
void toggle(uint8_t* byte, uint8_t position);
|
||||
/**
|
||||
* @brief Clear the bit in a given byte
|
||||
* @param byte
|
||||
* @param position
|
||||
*/
|
||||
void clear(uint8_t* byte, uint8_t position);
|
||||
/**
|
||||
* @brief Get the bit in a given byte
|
||||
* @param byte
|
||||
* @param position
|
||||
* @param If the input is valid, this will be set to true if the bit is set and false otherwise.
|
||||
* @return False if position is invalid, True otherwise
|
||||
*/
|
||||
bool get(const uint8_t* byte, uint8_t position, bool& bit);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user