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
963 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(PROTOCOL_LENGTH);
arr[0] = MESSAGE_DIRECTION;
arr[1] = ROTARY_DATA_LENGTH;
arr[2] = ROTARY_TYPE;
arr[3] = _functionCode;
arr[4] = static_cast<char>(value >> PROTOCOL_LENGTH);
arr[5] = static_cast<char>(value);
arr[6] = TIME_TAG;
arr[7] = TIME_TAG;
return arr;
}