2 ******************************************************************************
3 * @file usbd_cdc_if_template.c
4 * @author MCD Application Team
6 * @date 11-December-2015
7 * @brief Generic media access Layer.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2>
13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 * You may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at:
17 * http://www.st.com/software_license_agreement_liberty_v2
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
25 ******************************************************************************
28 /* Includes ------------------------------------------------------------------*/
29 #include "usbd_audio_if_template.h"
31 /** @addtogroup STM32_USB_DEVICE_LIBRARY
36 /** @defgroup USBD_AUDIO
37 * @brief usbd core module
41 /** @defgroup USBD_AUDIO_Private_TypesDefinitions
49 /** @defgroup USBD_AUDIO_Private_Defines
57 /** @defgroup USBD_AUDIO_Private_Macros
66 /** @defgroup USBD_AUDIO_Private_FunctionPrototypes
70 static int8_t TEMPLATE_Init (uint32_t AudioFreq
, uint32_t Volume
, uint32_t options
);
71 static int8_t TEMPLATE_DeInit (uint32_t options
);
72 static int8_t TEMPLATE_AudioCmd (uint8_t* pbuf
, uint32_t size
, uint8_t cmd
);
73 static int8_t TEMPLATE_VolumeCtl (uint8_t vol
);
74 static int8_t TEMPLATE_MuteCtl (uint8_t cmd
);
75 static int8_t TEMPLATE_PeriodicTC (uint8_t cmd
);
76 static int8_t TEMPLATE_GetState (void);
78 USBD_AUDIO_ItfTypeDef USBD_AUDIO_Template_fops
=
89 /* Private functions ---------------------------------------------------------*/
92 * @brief TEMPLATE_Init
93 * Initializes the AUDIO media low layer
95 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
97 static int8_t TEMPLATE_Init(uint32_t AudioFreq
, uint32_t Volume
, uint32_t options
)
100 Add your initialization code here
106 * @brief TEMPLATE_DeInit
107 * DeInitializes the AUDIO media low layer
109 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
111 static int8_t TEMPLATE_DeInit(uint32_t options
)
114 Add your deinitialization code here
121 * @brief TEMPLATE_AudioCmd
122 * AUDIO command handler
123 * @param Buf: Buffer of data to be sent
124 * @param size: Number of data to be sent (in bytes)
125 * @param cmd: command opcode
126 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
128 static int8_t TEMPLATE_AudioCmd (uint8_t* pbuf
, uint32_t size
, uint8_t cmd
)
135 * @brief TEMPLATE_VolumeCtl
136 * @param vol: volume level (0..100)
137 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
139 static int8_t TEMPLATE_VolumeCtl (uint8_t vol
)
146 * @brief TEMPLATE_MuteCtl
147 * @param cmd: vmute command
148 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
150 static int8_t TEMPLATE_MuteCtl (uint8_t cmd
)
157 * @brief TEMPLATE_PeriodicTC
159 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
161 static int8_t TEMPLATE_PeriodicTC (uint8_t cmd
)
168 * @brief TEMPLATE_GetState
170 * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
172 static int8_t TEMPLATE_GetState (void)
189 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/