#include "RelativeEncoder.h" namespace RoboidControl { RelativeEncoder::RelativeEncoder(Thing* parent) : Thing(Type::IncrementalEncoder, parent) {} float RelativeEncoder::GetRotationSpeed() { return rotationSpeed; } int RelativeEncoder::GenerateBinary(char* data, unsigned char* ix) { data[(*ix)++] = (unsigned char)(this->rotationSpeed * 127); return 1; } void RelativeEncoder::ProcessBinary(char* data) { this->rotationSpeed = (float)data[0] / 127; } } // namespace RoboidControl