USB device stack; Added getter method for terminal_connected;
Fork of USBDevice by
Example of use:
#include "mbed.h" #include "USBSerial.h" USBSerial pc; DigitalOut blue_led(P0_20); int main() { blue_led = 1; while(!pc.getTerminal_connected()); //Wait for serial terminal to connect... while(1) { blue_led = 0; wait(0.2); blue_led = 1; wait(0.2); } }
USBDevice/USBEndpoints_EFM32.h@64:fe3884917848, 2016-10-01 (annotated)
- Committer:
- diego_be
- Date:
- Sat Oct 01 04:43:09 2016 +0000
- Revision:
- 64:fe3884917848
- Parent:
- 59:2af474687369
Added getter method for terminal_connected
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 59:2af474687369 | 1 | |
mbed_official | 59:2af474687369 | 2 | #ifndef TARGET_EFM32HG_STK3400 |
mbed_official | 59:2af474687369 | 3 | # define NUMBER_OF_LOGICAL_ENDPOINTS (6) |
mbed_official | 59:2af474687369 | 4 | #else |
mbed_official | 59:2af474687369 | 5 | # define NUMBER_OF_LOGICAL_ENDPOINTS (3) |
mbed_official | 59:2af474687369 | 6 | #endif |
mbed_official | 59:2af474687369 | 7 | |
mbed_official | 59:2af474687369 | 8 | #define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2) |
mbed_official | 59:2af474687369 | 9 | #define NUMBER_OF_ENDPOINTS (NUMBER_OF_PHYSICAL_ENDPOINTS + 2) /* Includes EP0 */ |
mbed_official | 59:2af474687369 | 10 | |
mbed_official | 59:2af474687369 | 11 | #define EP0OUT (0) |
mbed_official | 59:2af474687369 | 12 | #define EP0IN (1) |
mbed_official | 59:2af474687369 | 13 | #define EP1OUT (2) |
mbed_official | 59:2af474687369 | 14 | #define EP1IN (3) |
mbed_official | 59:2af474687369 | 15 | #define EP2OUT (4) |
mbed_official | 59:2af474687369 | 16 | #define EP2IN (5) |
mbed_official | 59:2af474687369 | 17 | #define EP3OUT (6) |
mbed_official | 59:2af474687369 | 18 | #define EP3IN (7) |
mbed_official | 59:2af474687369 | 19 | #ifndef TARGET_EFM32HG_STK3400 |
mbed_official | 59:2af474687369 | 20 | # define EP4OUT (8) |
mbed_official | 59:2af474687369 | 21 | # define EP4IN (9) |
mbed_official | 59:2af474687369 | 22 | # define EP5OUT (10) |
mbed_official | 59:2af474687369 | 23 | # define EP5IN (11) |
mbed_official | 59:2af474687369 | 24 | # define EP6OUT (12) |
mbed_official | 59:2af474687369 | 25 | # define EP6IN (13) |
mbed_official | 59:2af474687369 | 26 | #endif |
mbed_official | 59:2af474687369 | 27 | |
mbed_official | 59:2af474687369 | 28 | #define USB_EP_TO_INDEX(ep) (ep) |
mbed_official | 59:2af474687369 | 29 | #define USB_EP_TO_ADDR(ep) (((ep)>>1) | (((ep) & 1 ) ? 0x80 : 0x00)) |
mbed_official | 59:2af474687369 | 30 | #define USB_ADDR_TO_EP(ep) (((ep)<<1) | (((ep) & 0x80) ? 0x01 : 0x00)) |
mbed_official | 59:2af474687369 | 31 | |
mbed_official | 59:2af474687369 | 32 | /* Maximum Packet sizes */ |
mbed_official | 59:2af474687369 | 33 | |
mbed_official | 59:2af474687369 | 34 | #define MAX_PACKET_SIZE_EP0 64 |
mbed_official | 59:2af474687369 | 35 | #define MAX_PACKET_SIZE_EP1 64 |
mbed_official | 59:2af474687369 | 36 | #define MAX_PACKET_SIZE_EP2 64 |
mbed_official | 59:2af474687369 | 37 | #define MAX_PACKET_SIZE_EP3 64 |
mbed_official | 59:2af474687369 | 38 | #ifndef TARGET_EFM32HG_STK3400 |
mbed_official | 59:2af474687369 | 39 | # define MAX_PACKET_SIZE_EP4 64 |
mbed_official | 59:2af474687369 | 40 | # define MAX_PACKET_SIZE_EP5 64 |
mbed_official | 59:2af474687369 | 41 | # define MAX_PACKET_SIZE_EP6 64 |
mbed_official | 59:2af474687369 | 42 | #endif |
mbed_official | 59:2af474687369 | 43 | |
mbed_official | 59:2af474687369 | 44 | /* Generic endpoints - intended to be portable accross devices */ |
mbed_official | 59:2af474687369 | 45 | /* and be suitable for simple USB devices. */ |
mbed_official | 59:2af474687369 | 46 | |
mbed_official | 59:2af474687369 | 47 | /* Bulk endpoints */ |
mbed_official | 59:2af474687369 | 48 | #define EPBULK_OUT EP2OUT |
mbed_official | 59:2af474687369 | 49 | #define EPBULK_IN EP2IN |
mbed_official | 59:2af474687369 | 50 | #define EPBULK_OUT_callback EP2_OUT_callback |
mbed_official | 59:2af474687369 | 51 | #define EPBULK_IN_callback EP2_IN_callback |
mbed_official | 59:2af474687369 | 52 | /* Interrupt endpoints */ |
mbed_official | 59:2af474687369 | 53 | #define EPINT_OUT EP1OUT |
mbed_official | 59:2af474687369 | 54 | #define EPINT_IN EP1IN |
mbed_official | 59:2af474687369 | 55 | #define EPINT_OUT_callback EP1_OUT_callback |
mbed_official | 59:2af474687369 | 56 | #define EPINT_IN_callback EP1_IN_callback |
mbed_official | 59:2af474687369 | 57 | /* Isochronous endpoints */ |
mbed_official | 59:2af474687369 | 58 | #define EPISO_OUT EP3OUT |
mbed_official | 59:2af474687369 | 59 | #define EPISO_IN EP3IN |
mbed_official | 59:2af474687369 | 60 | #define EPISO_OUT_callback EP3_OUT_callback |
mbed_official | 59:2af474687369 | 61 | #define EPISO_IN_callback EP3_IN_callback |
mbed_official | 59:2af474687369 | 62 | |
mbed_official | 59:2af474687369 | 63 | #define MAX_PACKET_SIZE_EPBULK 64 |
mbed_official | 59:2af474687369 | 64 | #define MAX_PACKET_SIZE_EPINT 64 |
mbed_official | 59:2af474687369 | 65 | #define MAX_PACKET_SIZE_EPISO 1023 |