You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
955 B

#include "model/RotaryButton.h"
RotaryButton::RotaryButton(char functionCode)
{
_functionCode = functionCode;
}
/*************************************************************************************************/
RotaryButton::RotaryButton(char functionCode, char ledFunctionCode) :
_led(ledFunctionCode)
{
_functionCode = functionCode;
}
/*************************************************************************************************/
Led* RotaryButton::getLed()
{
return &_led;
}
/*************************************************************************************************/
QByteArray RotaryButton::rotate(int value)
{
QByteArray arr;
arr.resize(ProtocolLength);
arr[0] = ConsoleDirection;
arr[1] = RotaryDataLength;
arr[2] = RotaryType;
arr[3] = _functionCode;
arr[4] = static_cast<char>(value >> ProtocolLength);
arr[5] = static_cast<char>(value);
arr[6] = TimeTag;
arr[7] = TimeTag;
return arr;
}