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.
24 #ifndef LIB_MOST_VOLUME_H
25 #define LIB_MOST_VOLUME_H
33 /** Describes the volume control */
34 enum lib_most_volume_channel_t{
35 LIB_MOST_VOLUME_CH_FRONT_LEFT = 0,
36 LIB_MOST_VOLUME_CH_FRONT_RIGHT = 1,
37 LIB_MOST_VOLUME_CH_REAR_LEFT = 2,
38 LIB_MOST_VOLUME_CH_REAR_RIGHT = 3,
39 LIB_MOST_VOLUME_CH_CENTER = 4,
40 LIB_MOST_VOLUME_CH_SUB = 5,
41 LIB_MOST_VOLUME_MASTER = 6
44 /** Is fired when the application shall call "lib_most_volume_service()" after a certain time
45 * \param timeout Time in ms after which the application shall call lib_most_volume_service().
47 * 0x0000: as soon as possible,
48 * 0x0001..0xFFFE: timeout in ms,
51 typedef void (*lib_most_volume_service_cb_t)(uint16_t timeout);
53 /** Initializes the library
54 * \param UNICENS_inst Reference to the UNICENS instance, created by the application.
55 * \param req_service_fptr Callback function which is fired if the application shall call
56 * lib_most_volume_service.
57 * \return '0' on success, otherwise value >'0'.
59 extern uint8_t lib_most_volume_init(Ucs_Inst_t *UNICENS_inst, lib_most_volume_service_cb_t req_service_fptr);
61 /** Terminates the library
62 * \return '0' on success, otherwise value >'0'.
64 extern uint8_t lib_most_volume_exit(void);
66 /** Sets a single volume value.
67 * \param channel The volume control to be set.
68 * \param volume The volume value to be set. Valid values: 0..255.
69 * \return '0' on success, otherwise value >'0'.
71 extern uint8_t lib_most_volume_set(enum lib_most_volume_channel_t channel, uint8_t volume);
73 /** Shall be called either cyclically (e.g. 50ms -> polling) or after "timeout"
74 * when "service_fptr" is fired (-> event triggered).
75 * \return '0' on success, otherwise value >'0'.
77 extern uint8_t lib_most_volume_service(void);
83 #endif /* LIB_MOST_VOLUME_H */