|
|
|
@ -44,26 +44,27 @@ class Device
|
|
|
|
|
#endif
|
|
|
|
|
union Reg_Control
|
|
|
|
|
{
|
|
|
|
|
// bit 7
|
|
|
|
|
// bit 4
|
|
|
|
|
struct POWER_DEV{
|
|
|
|
|
typedef BitField<uint8_t, 7, 1> bits;
|
|
|
|
|
typedef BitField<uint8_t, 4, 1> Bits;
|
|
|
|
|
enum{TURN_OFF = 0, TURN_ON = 1};
|
|
|
|
|
};
|
|
|
|
|
// bits 2-3
|
|
|
|
|
struct SPEED{
|
|
|
|
|
typedef BitField<uint8_t, 2, 2> bits;
|
|
|
|
|
typedef BitField<uint8_t, 2, 2> Bits;
|
|
|
|
|
enum{STAND_STILL = 0,
|
|
|
|
|
SLOW = 1,
|
|
|
|
|
NORMAL = 2,
|
|
|
|
|
FAST = 3};
|
|
|
|
|
};
|
|
|
|
|
union Bits{
|
|
|
|
|
Reg_Control::POWER_DEV::bits POWER_DEV;
|
|
|
|
|
Reg_Control::SPEED::bits SPEED;
|
|
|
|
|
struct Bits{
|
|
|
|
|
Reg_Control::POWER_DEV::Bits POWER_DEV;
|
|
|
|
|
Reg_Control::SPEED::Bits SPEED;
|
|
|
|
|
} bits;
|
|
|
|
|
// raw value. all bitfields will be "unified" here ;)
|
|
|
|
|
uint8_t raw;
|
|
|
|
|
// union Ctor
|
|
|
|
|
Reg_Control(uint8_t v = 0x00) : raw(0x00) {}
|
|
|
|
|
// union Ctor with default value set to 0x00
|
|
|
|
|
Reg_Control(uint8_t v = 0x00) : raw(v) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Reg_Control reg_control;
|
|
|
|
|