modm API documentation
|
#include <modm/architecture/interface/register.hpp>
Public Typedefs | |
typedef T | UnderlyingType |
The integer type internally used to represent the register. | |
Public Member Functions | |
constexpr | Register () |
Default constructor initializes value to zero. | |
constexpr | operator bool () const |
constexpr bool | operator! () const |
Returns true if value is zero. | |
Public Attributes | |
UnderlyingType | value |
The underlying integer value. | |
Protected Member Functions | |
constexpr | Register (UnderlyingType initialValue) |
This class is meant to be subclassed. | |
Friends | |
IOStream & | operator<< (IOStream &s, const Register< T > &m) |
Printing a register will output its numeric value. | |
Class for holding a register value.
You can cast any Flags, Configuration or Value type into the approprate Register type.
Apart from the boolean operators, this base class deletes all other implicit operator overloadings. Since any type information is lost during casting, you should not be able to use any operations involving specific flags, configurations or values.
Instead you have to explicitly use the integral value
to perform your potentially unsafe operations.
This class makes heavy use of constexpr
, so that as many values and operation can take place at compile time for efficiency.
T | the (unsigned) underlying integer type: uint8_t, uint16_t, uint32_t |
|
inlineexplicitconstexpr |
Returns true
if value
is non-zero
The compiler will allow implicit conversions to bool in the following contexts: