summaryrefslogtreecommitdiffstats
path: root/ucs2-vol/src/device_value.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-06-27 17:18:55 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-06-27 17:19:56 +0200
commit1fe55667142158af865372a8b9916581662286fe (patch)
tree797b285d187938f2bf1ff60eec555a14b126c259 /ucs2-vol/src/device_value.cpp
parentbbe0fa2bb0479bf7a09eed345fefc3c375773745 (diff)
Change marketing stuff
unicens -> UNICENS MicroChip -> Microchip Change-Id: I7a2f48ac62f44579831ed252b5e24dc918c09645 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ucs2-vol/src/device_value.cpp')
-rw-r--r--ucs2-vol/src/device_value.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/ucs2-vol/src/device_value.cpp b/ucs2-vol/src/device_value.cpp
index 5a1ad5c..95ea256 100644
--- a/ucs2-vol/src/device_value.cpp
+++ b/ucs2-vol/src/device_value.cpp
@@ -35,31 +35,31 @@
#define CONTROL_CH_1 0x08U
#define CONTROL_CH_2 0x09U
-CDeviceValue::CDeviceValue(uint16_t address, DeviceValueType type, uint16_t key)
+CDeviceValue::CDeviceValue(uint16_t address, DeviceValueType type, uint16_t key)
{
this->_is_initial = true;
this->_address = address;
this->_target_value = 0x01u;
this->_actual_value = 0x01u;
-
+
this->_type = type;
this->_key = key;
-
+
_tx_payload[0] = CONTROL_MASTER;// 7: master, 8: channel 1, 9: Channel 2
_tx_payload[1] = MUTE_VALUE_HB; //HB:Volume
_tx_payload[2] = MUTE_VALUE_LB; //LB:Volume
_tx_payload_sz = 3u;
}
-CDeviceValue::~CDeviceValue()
+CDeviceValue::~CDeviceValue()
{
}
void CDeviceValue::ApplyMostValue(uint8_t value, DeviceValueType type, uint8_t tx_payload[])
{
uint16_t tmp = MUTE_VALUE;
-
- switch (type)
+
+ switch (type)
{
case DEVICE_VAL_LEFT:
tmp = 0x80U + 0x37FU - (0x37FU * ((int32_t)value) / (0xFFU));
@@ -80,19 +80,19 @@ void CDeviceValue::ApplyMostValue(uint8_t value, DeviceValueType type, uint8_t t
tx_payload[0] = CONTROL_MASTER;
break;
}
-
+
tx_payload[1] = (uint8_t)((tmp >> 8U) & (uint16_t)0xFFU); //HB:Volume
tx_payload[2] = (uint8_t)(tmp & (uint16_t)0xFFU); //LB:Volume
}
// returns true if target is not actual value
-bool CDeviceValue::RequiresUpdate()
+bool CDeviceValue::RequiresUpdate()
{
- if (this->_target_value != this->_actual_value)
+ if (this->_target_value != this->_actual_value)
{
return true;
}
-
+
return false;
}