Fixes to usb stack so that it works
[barbilliards.git] / src / usb_cdcacm.h
1 /* This program is free software: you can redistribute it and/or modify
2  * it under the terms of the GNU General Public License as published by
3  * the Free Software Foundation, either version 3 of the License, or
4  * (at your option) any later version.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
13  *
14  */
15 /** library for USB CDC ACM communication (API)
16  *  @file usb_cdcacm.h
17  *  @author King Kévin <kingkevin@cuvoodoo.info>
18  *  @date 2016
19  */
20 #pragma once
21
22 /** transmit and receive buffer sizes */
23 #define CDCACM_BUFFER 64
24 /** how many bytes available in the received buffer since last read */
25 extern volatile uint8_t cdcacm_received;
26
27 /** setup USB CDC ACM peripheral */
28 void cdcacm_setup(void);
29 /** get character received over USB (blocking)
30  *  @return character received over USB
31  *  @note blocks until character is received over USB when received buffer is empty
32  */
33 char cdcacm_getchar(void);
34 /** send character over USB (non-blocking)
35  *  @param[in] c character to send
36  *  @note blocks if transmit buffer is full, else puts in buffer and returns
37  */ 
38 void cdcacm_putchar(char c);