atMETEO
An ATmega based weather station
Namespaces | Functions
utils.h File Reference

Bit manipulation utilities. More...

#include <inttypes.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Sensors
 Namespace containing all symbols of the Sensors library.
 

Functions

template<typename T >
void Sensors::bitSet (T &value, uint8_t bit)
 Sets the bit in the given value to 1. More...
 
template<typename T >
void Sensors::bitClear (T &value, uint8_t bit)
 Sets the bit in the given value to 0. More...
 
template<typename T >
void Sensors::bitFlip (T &value, uint8_t bit)
 Flips the bit in the given value. More...
 
template<typename T >
bool Sensors::bitRead (T &value, uint8_t bit)
 Returns the bit in the given value. More...
 
template<typename T >
void Sensors::bitWrite (T &value, uint8_t bit, bool bitValue)
 Writes the bit in the given value. More...
 
uint8_t Sensors::byteReverse (uint8_t x)
 Returns the byte x in reversed bit order. More...
 
uint8_t Sensors::nibbleReverse (uint8_t x)
 Returns the byte x in reversed bit order (nibble wise). More...
 
uint8_t Sensors::highNibble (uint8_t x)
 Returns the byte's x high nibble. More...
 
uint8_t Sensors::lowNibble (uint8_t x)
 Returns the byte's x low nibble. More...
 
uint16_t Sensors::word (uint8_t highByte, uint8_t lowByte)
 Converts two bytes to a word. More...
 
bool Sensors::parity (int x)
 Returns the even parity for the byte x. More...
 
template<typename T >
Sensors::min (T a, T b)
 Returns the minimum of the two values a and b. More...
 
template<typename T >
Sensors::max (T a, T b)
 Returns the maximum of the two values a and b. More...
 

Detailed Description

Bit manipulation utilities.

Note
All functions are kept as small as possible allowing inlining.