|
|
|
@ -51,8 +51,8 @@ void Device::doSomething()
|
|
|
|
|
|
|
|
|
|
void Device::status()
|
|
|
|
|
{
|
|
|
|
|
// imitating read hardware register
|
|
|
|
|
reg_motorStatus = 0xFF;
|
|
|
|
|
// imitating read hardware register (for example reading from device via SPI or i2c)
|
|
|
|
|
reg_motorStatus = 0xFE;
|
|
|
|
|
|
|
|
|
|
if(reg_motorStatus.bits.POWER == Reg_MotorStatus::POWER::ON) {
|
|
|
|
|
std::cout << "Motor is Powered ON!" << std::endl;
|
|
|
|
@ -61,7 +61,9 @@ void Device::status()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// will throw error because this bitfield is set const!
|
|
|
|
|
//std::cout << "Motor is Powered ON!" << std::endl;
|
|
|
|
|
|
|
|
|
|
//reg_motorStatus.bits.STATUS = Reg_MotorStatus::STATUS::STANDSTILL;
|
|
|
|
|
|
|
|
|
|
std::cout << +reg_motorStatus.bits.POWER << std::endl;
|
|
|
|
|
|
|
|
|
|
std::cout << "Motor Status : " << +reg_motorStatus.bits.STATUS << std::endl;
|
|
|
|
|
}
|