M5Utility 0.3.0 git rev:41a629c
Loading...
Searching...
No Matches
misc.hpp File Reference

Miscellaneous features. More...

#include <cstdint>
#include <type_traits>

Go to the source code of this file.

Classes

class  m5::utility::uint_least_for_bits< N >
 Gets the smallest unsigned integer type that can store N bit. More...
 

Namespaces

namespace  m5
 Top level namespace of M5.
 

Functions

bool m5::utility::isValidI2CAddress (const uint16_t addr)
 Valid I2C address?
 
uint8_t m5::utility::reverseBitOrder (const uint8_t u8)
 Reversing the bit order.
 
uint16_t m5::utility::reverseBitOrder (const uint16_t u16)
 Reversing the bit order.
 
bool m5::utility::parity (const uint8_t u8)
 Is the number of set bits odd?
 
uint8_t m5::utility::oddParityBit (const uint8_t u8)
 Gets the bit that makes the byte odd parity.
 

Detailed Description

Miscellaneous features.

Function Documentation

◆ oddParityBit()

uint8_t m5::utility::oddParityBit ( const uint8_t u8)
inline

Gets the bit that makes the byte odd parity.

Parameters
u8Input byte
Returns
1 if the byte has an even number of set bits, 0 otherwise
Note
The bit to append in protocols that specify odd parity, such as NFC-A

◆ parity()

bool m5::utility::parity ( const uint8_t u8)
inline

Is the number of set bits odd?

Parameters
u8Input byte
Returns
True if the byte has an odd number of set bits