summaryrefslogtreecommitdiffstats
path: root/ucs2-vol
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
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')
-rw-r--r--ucs2-vol/inc/device_container.h6
-rw-r--r--ucs2-vol/inc/device_value.h14
-rw-r--r--ucs2-vol/inc/libmostvolume.h16
-rw-r--r--ucs2-vol/inc/setup.h20
-rw-r--r--ucs2-vol/src/CMakeLists.txt4
-rw-r--r--ucs2-vol/src/device_value.cpp20
-rw-r--r--ucs2-vol/src/libmostvolume.cpp6
-rw-r--r--ucs2-vol/src/setup.cpp14
8 files changed, 50 insertions, 50 deletions
diff --git a/ucs2-vol/inc/device_container.h b/ucs2-vol/inc/device_container.h
index 16b7f8a..6e98ea6 100644
--- a/ucs2-vol/inc/device_container.h
+++ b/ucs2-vol/inc/device_container.h
@@ -28,13 +28,13 @@
#include "libmostvolume.h"
class CDeviceContainer {
-
+
public:
CDeviceContainer();
virtual ~CDeviceContainer();
-
+
void AssignService(lib_most_volume_service_cb_t service_fptr, Ucs_Inst_t *ucs_ptr) {_service_fptr = service_fptr; _ucs_inst_ptr = ucs_ptr;}
-
+
void RegisterValues(CDeviceValue** list_pptr, uint16_t list_sz);
void SetValue(uint16_t key, uint8_t value);
void ClearValues();
diff --git a/ucs2-vol/inc/device_value.h b/ucs2-vol/inc/device_value.h
index c27bc26..0c83197 100644
--- a/ucs2-vol/inc/device_value.h
+++ b/ucs2-vol/inc/device_value.h
@@ -53,30 +53,30 @@ enum DeviceValueType {
DEVICE_VAL_MASTER = 0,
DEVICE_VAL_LEFT = 1,
DEVICE_VAL_RIGHT = 2
-
+
};
class CDeviceValue {
public:
CDeviceValue(uint16_t address, DeviceValueType type, uint16_t key);
virtual ~CDeviceValue();
-
+
uint16_t GetKey(){return _key;}
DeviceValueType GetType(){return _type;} // returns the assigned type
void SetValue(uint8_t value){_target_value = value;} // sets desired value
-
+
bool RequiresUpdate(); // returns true if target is not actual value
// returns true if success, false if failed
- // -> stop transmission
+ // -> stop transmission
bool FireUpdateMessage(void);// fires message & updates actual value
-
+
private:
void HandleI2cResult(Ucs_I2c_Result_t result);
void ApplyMostValue(uint8_t value, DeviceValueType type, uint8_t tx_payload[]);
-
+
bool _is_initial; // ensure first update
DeviceValueType _type; // determines the remote i2c command
- uint16_t _key; // lookup key
+ uint16_t _key; // lookup key
uint16_t _address; // target node/group address
uint8_t _target_value; // desired value
uint8_t _actual_value; // value set and confirmed via network
diff --git a/ucs2-vol/inc/libmostvolume.h b/ucs2-vol/inc/libmostvolume.h
index bf2ad0b..38928e0 100644
--- a/ucs2-vol/inc/libmostvolume.h
+++ b/ucs2-vol/inc/libmostvolume.h
@@ -29,7 +29,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+
/** Describes the volume control */
enum lib_most_volume_channel_t{
LIB_MOST_VOLUME_CH_FRONT_LEFT = 0,
@@ -45,18 +45,18 @@ enum lib_most_volume_channel_t{
* \param timeout Time in ms after which the application shall call lib_most_volume_service().
* Valid values:
* 0x0000: as soon as possible,
- * 0x0001..0xFFFE: timeout in ms,
+ * 0x0001..0xFFFE: timeout in ms,
* 0xFFFF: never
*/
typedef void (*lib_most_volume_service_cb_t)(uint16_t timeout);
/** Initializes the library
- * \param unicens_inst Reference to the UNICENS instance, created by the application.
- * \param req_service_fptr Callback function which is fired if the application shall call
+ * \param UNICENS_inst Reference to the UNICENS instance, created by the application.
+ * \param req_service_fptr Callback function which is fired if the application shall call
* lib_most_volume_service.
- * \return '0' on success, otherwise value >'0'.
+ * \return '0' on success, otherwise value >'0'.
*/
-extern uint8_t lib_most_volume_init(Ucs_Inst_t *unicens_inst, lib_most_volume_service_cb_t req_service_fptr);
+extern uint8_t lib_most_volume_init(Ucs_Inst_t *UNICENS_inst, lib_most_volume_service_cb_t req_service_fptr);
/** Terminates the library
* \return '0' on success, otherwise value >'0'.
@@ -70,10 +70,10 @@ extern uint8_t lib_most_volume_exit(void);
*/
extern uint8_t lib_most_volume_set(enum lib_most_volume_channel_t channel, uint8_t volume);
-/** Shall be called either cyclically (e.g. 50ms -> polling) or after "timeout"
+/** Shall be called either cyclically (e.g. 50ms -> polling) or after "timeout"
* when "service_fptr" is fired (-> event triggered).
* \return '0' on success, otherwise value >'0'.
- */
+ */
extern uint8_t lib_most_volume_service(void);
#ifdef __cplusplus
diff --git a/ucs2-vol/inc/setup.h b/ucs2-vol/inc/setup.h
index 9295475..3295d3d 100644
--- a/ucs2-vol/inc/setup.h
+++ b/ucs2-vol/inc/setup.h
@@ -33,37 +33,37 @@
#define MAX_MASTERS 3u
class CSetup {
-
+
public:
- void Configure(Ucs_Inst_t *unicens_inst, lib_most_volume_service_cb_t service_fptr);
+ void Configure(Ucs_Inst_t *UNICENS_inst, lib_most_volume_service_cb_t service_fptr);
Ucs_Inst_t *RetrieveUnicensInst(void);
void SetVolume(enum lib_most_volume_channel_t channel, uint8_t volume);
- void Update();
-
-private:
+ void Update();
+
+private:
CDeviceValue _volume_amp_270_m;
CDeviceValue _volume_amp_270_l;
CDeviceValue _volume_amp_270_r;
-
+
CDeviceValue _volume_amp_271_m;
CDeviceValue _volume_amp_271_l;
CDeviceValue _volume_amp_271_r;
-
+
CDeviceValue _volume_amp_272_m;
CDeviceValue _volume_amp_272_l;
CDeviceValue _volume_amp_272_r;
CDeviceContainer _value_container;
Ucs_Inst_t *ucs_inst;
-
+
public:
static CSetup* GetInstance(); // singleton
static void Release(); // singleton
-
+
protected:
CSetup(); // singleton
virtual ~CSetup(); // singleton
-
+
private:
static CSetup* _instance; // singleton
};
diff --git a/ucs2-vol/src/CMakeLists.txt b/ucs2-vol/src/CMakeLists.txt
index 8bb406e..64ef536 100644
--- a/ucs2-vol/src/CMakeLists.txt
+++ b/ucs2-vol/src/CMakeLists.txt
@@ -32,8 +32,8 @@ ADD_LIBRARY(ucs2-vol STATIC callbacks.cpp device_container.cpp device_value.cpp
)
# Define properties to expose when others use this target
- TARGET_INCLUDE_DIRECTORIES(ucs2-vol
- PUBLIC
+ TARGET_INCLUDE_DIRECTORIES(ucs2-vol
+ PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../inc
${CMAKE_CURRENT_SOURCE_DIR}/../cfg
${CMAKE_CURRENT_SOURCE_DIR}/ucs-xml
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;
}
diff --git a/ucs2-vol/src/libmostvolume.cpp b/ucs2-vol/src/libmostvolume.cpp
index 4581be7..a44d4bd 100644
--- a/ucs2-vol/src/libmostvolume.cpp
+++ b/ucs2-vol/src/libmostvolume.cpp
@@ -27,14 +27,14 @@
static bool _running = false;
-extern "C" uint8_t lib_most_volume_init(Ucs_Inst_t *unicens_inst, lib_most_volume_service_cb_t req_service_fptr)
+extern "C" uint8_t lib_most_volume_init(Ucs_Inst_t *UNICENS_inst, lib_most_volume_service_cb_t req_service_fptr)
{
uint8_t success = 1U;
/*std::cerr << "lib_most_volume_init(): called" << std::endl;*/
if (!_running)
{
- CSetup::GetInstance()->Configure(unicens_inst, req_service_fptr);
+ CSetup::GetInstance()->Configure(UNICENS_inst, req_service_fptr);
success = 0U;
_running = true;
}
@@ -83,4 +83,4 @@ extern "C" uint8_t lib_most_volume_service(void)
}
return success;
-} \ No newline at end of file
+}
diff --git a/ucs2-vol/src/setup.cpp b/ucs2-vol/src/setup.cpp
index 5ff3d79..bb54f2f 100644
--- a/ucs2-vol/src/setup.cpp
+++ b/ucs2-vol/src/setup.cpp
@@ -28,9 +28,9 @@ CSetup* CSetup::_instance = NULL;
// singleton
CSetup* CSetup::GetInstance() {
if (_instance == NULL) {
- _instance = new CSetup();
+ _instance = new CSetup();
}
-
+
return _instance;
}
@@ -53,7 +53,7 @@ CSetup::CSetup()
_volume_amp_272_l(0x272U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_CENTER),
_volume_amp_272_r(0x272U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_SUB),
_value_container()
-{
+{
static CDeviceValue* value_list[3] = { &_volume_amp_270_m,
&_volume_amp_270_l,
&_volume_amp_270_r/*,
@@ -72,10 +72,10 @@ CSetup::~CSetup()
}
-void CSetup::Configure(Ucs_Inst_t *unicens_inst, lib_most_volume_service_cb_t service_fptr)
+void CSetup::Configure(Ucs_Inst_t *UNICENS_inst, lib_most_volume_service_cb_t service_fptr)
{
- ucs_inst = unicens_inst;
- _value_container.AssignService(service_fptr, unicens_inst);
+ ucs_inst = UNICENS_inst;
+ _value_container.AssignService(service_fptr, UNICENS_inst);
}
Ucs_Inst_t* CSetup::RetrieveUnicensInst(void)
@@ -91,4 +91,4 @@ void CSetup::SetVolume(enum lib_most_volume_channel_t channel, uint8_t volume)
void CSetup::Update()
{
_value_container.Update();
-} \ No newline at end of file
+}