RoboidControl-cpp/Things/TouchSensor.cpp

16 lines
382 B
C++

#include "TouchSensor.h"
namespace RoboidControl {
TouchSensor::TouchSensor(Thing& parent) : Thing(Type::TouchSensor, parent) {}
int TouchSensor::GenerateBinary(char* bytes, unsigned char* ix) {
bytes[(*ix)++] = touchedSomething ? 1 : 0;
return 1;
}
void TouchSensor::ProcessBinary(char* bytes) {
this->touchedSomething |= (bytes[0] == 1);
}
} // namespace RoboidControl