uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
usb.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright 2015 Simon Gansen
8  *
9  * This file is part of the uMIDI firmware.
10  *
11  * the uMIDI firmware is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * the uMIDI firmware is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with the uMIDI firmware. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef _USB_H
26 #define _USB_H
27 
28 
29 //---------------- includes -----------------//
30 
31 #include <stdarg.h>
32 #include <avr/io.h>
33 #include <avr/interrupt.h>
34 #include <avr/pgmspace.h>
35 
36 #include "lufa/LUFA/Drivers/USB/USB.h"
37 
38 
39 
40 //---------------- constants ----------------//
41 
43 #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
44 
46 #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
47 
49 #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
50 
52 #define USB_NEWLINE "\r\n"
53 
56 #define USB_STRING_MAX_LENGTH 100
57 
58 
59 //---------------- data types ---------------//
60 
61 
62 //---------------- functions and procedures ----------------//
63 
66 void init_usb_module(void);
67 
70 uint16_t usb_bytes_received(void);
71 
74 int16_t usb_getc(void);
75 
81 void usb_main_task(void);
82 
91 void usb_printf(PGM_P format, ...);
92 
103 void usb_printf_S(const char* format, ...);
104 
107 void usb_putc(char c);
108 
115 void usb_puts(PGM_P string);
116 
124 void usb_puts_S(const char* string);
125 
133 void usb_set_echo(bool echo);
134 
135 
136 //---------------- EOF ----------------//
137 #endif // _USB_H
void usb_printf(PGM_P format,...)
Does exactly what you would expect. ;-)
static bool echo
Status variable for expression value console echo.
Definition: expression.c:45
int16_t usb_getc(void)
Reads one byte or character from the USB receive buffer.
Definition: usb.c:165
void usb_puts(PGM_P string)
Sends the given program space string and a newline sequence over USB.
void usb_main_task(void)
Main background task for USB CDC operation.
Definition: usb.c:181
void usb_putc(char c)
Sends the given character over USB.
Definition: usb.c:219
uint16_t usb_bytes_received(void)
Returns the number of unread bytes currently residing in the USB receive buffer.
Definition: usb.c:157
void init_usb_module(void)
Initializes the USB CDC module.
Definition: usb.c:148
void usb_printf_S(const char *format,...)
Does exactly what you would expect. ;-)
Definition: usb.c:203
void usb_set_echo(bool echo)
Enables / disables terminal echo.
void usb_puts_S(const char *string)
Sends the given string and a newline sequence over USB.
Definition: usb.c:242