2 * libmostvolume example
4 * Copyright (C) 2017 Microchip Technology Germany II GmbH & Co. KG
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * You may also obtain this software under a propriety license from Microchip.
20 * Please contact Microchip for further information.
26 CSetup* CSetup::_instance = NULL;
29 CSetup* CSetup::GetInstance() {
30 if (_instance == NULL) {
31 _instance = new CSetup();
38 void CSetup::Release() {
39 if (_instance != NULL) {
46 : _volume_amp_270_m(0x270U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER),
47 _volume_amp_270_l(0x270U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_FRONT_LEFT),
48 _volume_amp_270_r(0x270U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_FRONT_RIGHT),
49 _volume_amp_271_m(0x271U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER),
50 _volume_amp_271_l(0x271U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_REAR_LEFT),
51 _volume_amp_271_r(0x271U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_REAR_RIGHT),
52 _volume_amp_272_m(0x272U, DEVICE_VAL_MASTER, LIB_MOST_VOLUME_MASTER),
53 _volume_amp_272_l(0x272U, DEVICE_VAL_LEFT, LIB_MOST_VOLUME_CH_CENTER),
54 _volume_amp_272_r(0x272U, DEVICE_VAL_RIGHT, LIB_MOST_VOLUME_CH_SUB),
57 static CDeviceValue* value_list[3] = { &_volume_amp_270_m,
65 &_volume_amp_272_r*/};
67 _value_container.RegisterValues(value_list, 3U);
75 void CSetup::Configure(Ucs_Inst_t *unicens_inst, lib_most_volume_service_cb_t service_fptr)
77 ucs_inst = unicens_inst;
78 _value_container.AssignService(service_fptr, unicens_inst);
81 Ucs_Inst_t* CSetup::RetrieveUnicensInst(void)
86 void CSetup::SetVolume(enum lib_most_volume_channel_t channel, uint8_t volume)
88 _value_container.SetValue((uint16_t)channel, volume);
93 _value_container.Update();