STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
usbd_cdc_if_template.c
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 #include "usbd_cdc_if_template.h"
30 
70 static int8_t TEMPLATE_Init (void);
71 static int8_t TEMPLATE_DeInit (void);
72 static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length);
73 static int8_t TEMPLATE_Receive (uint8_t* pbuf, uint32_t *Len);
74 
76 {
77  TEMPLATE_Init,
78  TEMPLATE_DeInit,
79  TEMPLATE_Control,
80  TEMPLATE_Receive
81 };
82 
84  {
85  115200, /* baud rate*/
86  0x00, /* stop bits-1*/
87  0x00, /* parity - none*/
88  0x08 /* nb. of bits 8*/
89  };
90 
91 /* Private functions ---------------------------------------------------------*/
92 
99 static int8_t TEMPLATE_Init(void)
100 {
101  /*
102  Add your initialization code here
103  */
104  return (0);
105 }
106 
113 static int8_t TEMPLATE_DeInit(void)
114 {
115  /*
116  Add your deinitialization code here
117  */
118  return (0);
119 }
120 
121 
130 static int8_t TEMPLATE_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length)
131 {
132  switch (cmd)
133  {
135  /* Add your code here */
136  break;
137 
139  /* Add your code here */
140  break;
141 
143  /* Add your code here */
144  break;
145 
147  /* Add your code here */
148  break;
149 
151  /* Add your code here */
152  break;
153 
154  case CDC_SET_LINE_CODING:
155  linecoding.bitrate = (uint32_t)(pbuf[0] | (pbuf[1] << 8) |\
156  (pbuf[2] << 16) | (pbuf[3] << 24));
157  linecoding.format = pbuf[4];
158  linecoding.paritytype = pbuf[5];
159  linecoding.datatype = pbuf[6];
160 
161  /* Add your code here */
162  break;
163 
164  case CDC_GET_LINE_CODING:
165  pbuf[0] = (uint8_t)(linecoding.bitrate);
166  pbuf[1] = (uint8_t)(linecoding.bitrate >> 8);
167  pbuf[2] = (uint8_t)(linecoding.bitrate >> 16);
168  pbuf[3] = (uint8_t)(linecoding.bitrate >> 24);
169  pbuf[4] = linecoding.format;
170  pbuf[5] = linecoding.paritytype;
171  pbuf[6] = linecoding.datatype;
172 
173  /* Add your code here */
174  break;
175 
177  /* Add your code here */
178  break;
179 
180  case CDC_SEND_BREAK:
181  /* Add your code here */
182  break;
183 
184  default:
185  break;
186  }
187 
188  return (0);
189 }
190 
207 static int8_t TEMPLATE_Receive (uint8_t* Buf, uint32_t *Len)
208 {
209 
210  return (0);
211 }
212 
225 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
226 
USBD_CDC_LineCodingTypeDef linecoding
Header for usbd_cdc_if_template.c file.
#define CDC_GET_ENCAPSULATED_RESPONSE
Definition: usbd_cdc.h:72
#define CDC_SET_COMM_FEATURE
Definition: usbd_cdc.h:73
#define CDC_SEND_ENCAPSULATED_COMMAND
Definition: usbd_cdc.h:71
#define CDC_SET_CONTROL_LINE_STATE
Definition: usbd_cdc.h:78
#define CDC_CLEAR_COMM_FEATURE
Definition: usbd_cdc.h:75
#define CDC_GET_COMM_FEATURE
Definition: usbd_cdc.h:74
Definition: pbuf.h:108
USBD_CDC_ItfTypeDef USBD_CDC_Template_fops
#define CDC_SEND_BREAK
Definition: usbd_cdc.h:79
#define CDC_GET_LINE_CODING
Definition: usbd_cdc.h:77
#define CDC_SET_LINE_CODING
Definition: usbd_cdc.h:76