A library to send and receive MIDI messages over USB using the default USB-MIDI drivers on Win/Mac
Fork of USBMIDI by
usbcore.h@1:ff74eabe02cd, 2011-02-20 (annotated)
- Committer:
- simon
- Date:
- Sun Feb 20 13:10:05 2011 +0000
- Revision:
- 1:ff74eabe02cd
- Child:
- 2:10d694d6ccdc
First version, supporting most USB MIDI functionality
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 1:ff74eabe02cd | 1 | /** @license The MIT License |
simon | 1:ff74eabe02cd | 2 | * Copyright (c) 2011 mux, simon |
simon | 1:ff74eabe02cd | 3 | * |
simon | 1:ff74eabe02cd | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
simon | 1:ff74eabe02cd | 5 | * of this software and associated documentation files (the "Software"), to deal |
simon | 1:ff74eabe02cd | 6 | * in the Software without restriction, including without limitation the rights |
simon | 1:ff74eabe02cd | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
simon | 1:ff74eabe02cd | 8 | * copies of the Software, and to permit persons to whom the Software is |
simon | 1:ff74eabe02cd | 9 | * furnished to do so, subject to the following conditions: |
simon | 1:ff74eabe02cd | 10 | * |
simon | 1:ff74eabe02cd | 11 | * The above copyright notice and this permission notice shall be included in |
simon | 1:ff74eabe02cd | 12 | * all copies or substantial portions of the Software. |
simon | 1:ff74eabe02cd | 13 | * |
simon | 1:ff74eabe02cd | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
simon | 1:ff74eabe02cd | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
simon | 1:ff74eabe02cd | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
simon | 1:ff74eabe02cd | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
simon | 1:ff74eabe02cd | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
simon | 1:ff74eabe02cd | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
simon | 1:ff74eabe02cd | 20 | * THE SOFTWARE. |
simon | 1:ff74eabe02cd | 21 | */ |
simon | 1:ff74eabe02cd | 22 | |
simon | 1:ff74eabe02cd | 23 | #ifndef USB_CORE_H |
simon | 1:ff74eabe02cd | 24 | #define USB_CORE_H |
simon | 1:ff74eabe02cd | 25 | |
simon | 1:ff74eabe02cd | 26 | #include "mbed.h" |
simon | 1:ff74eabe02cd | 27 | |
simon | 1:ff74eabe02cd | 28 | #define MAX_EP0_PSIZE (8) |
simon | 1:ff74eabe02cd | 29 | #define MAX_EPn_PSIZE (64) |
simon | 1:ff74eabe02cd | 30 | |
simon | 1:ff74eabe02cd | 31 | // physical endpoint numbers |
simon | 1:ff74eabe02cd | 32 | #define EP0 (0) |
simon | 1:ff74eabe02cd | 33 | #define EP1 (1) |
simon | 1:ff74eabe02cd | 34 | #define EP2 (2) |
simon | 1:ff74eabe02cd | 35 | #define EP3 (3) |
simon | 1:ff74eabe02cd | 36 | #define EP4 (4) |
simon | 1:ff74eabe02cd | 37 | #define EP5 (5) |
simon | 1:ff74eabe02cd | 38 | |
simon | 1:ff74eabe02cd | 39 | void usb_init(); |
simon | 1:ff74eabe02cd | 40 | void usb_reset(); |
simon | 1:ff74eabe02cd | 41 | void usb_connect(); |
simon | 1:ff74eabe02cd | 42 | void usb_set_address(uint8_t); |
simon | 1:ff74eabe02cd | 43 | void usb_configure(uint8_t); |
simon | 1:ff74eabe02cd | 44 | int usb_configured(); |
simon | 1:ff74eabe02cd | 45 | void ep_realize(uint8_t ep, uint32_t psize); |
simon | 1:ff74eabe02cd | 46 | int ep_read(uint8_t ep, uint8_t *buf); |
simon | 1:ff74eabe02cd | 47 | void ep_write(uint8_t ep, uint8_t *buf, uint32_t len); |
simon | 1:ff74eabe02cd | 48 | int ep_readable(uint8_t ep); |
simon | 1:ff74eabe02cd | 49 | int ep_writable(uint8_t ep); |
simon | 1:ff74eabe02cd | 50 | void ep0_setup(); |
simon | 1:ff74eabe02cd | 51 | void ep0_in(); |
simon | 1:ff74eabe02cd | 52 | void ep0_out(); |
simon | 1:ff74eabe02cd | 53 | void ep2_in(); |
simon | 1:ff74eabe02cd | 54 | void ep2_out(); |
simon | 1:ff74eabe02cd | 55 | |
simon | 1:ff74eabe02cd | 56 | #endif |