USB Serial application

Fork of USBSerial_HelloWorld by Samuel Mokrani

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Zaitsev 10:41552d038a69 1 /* mbed Microcontroller Library
Zaitsev 10:41552d038a69 2 * Copyright (c) 2006-2014 ARM Limited
Zaitsev 10:41552d038a69 3 *
Zaitsev 10:41552d038a69 4 * Licensed under the Apache License, Version 2.0 (the "License");
Zaitsev 10:41552d038a69 5 * you may not use this file except in compliance with the License.
Zaitsev 10:41552d038a69 6 * You may obtain a copy of the License at
Zaitsev 10:41552d038a69 7 *
Zaitsev 10:41552d038a69 8 * http://www.apache.org/licenses/LICENSE-2.0
Zaitsev 10:41552d038a69 9 *
Zaitsev 10:41552d038a69 10 * Unless required by applicable law or agreed to in writing, software
Zaitsev 10:41552d038a69 11 * distributed under the License is distributed on an "AS IS" BASIS,
Zaitsev 10:41552d038a69 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Zaitsev 10:41552d038a69 13 * See the License for the specific language governing permissions and
Zaitsev 10:41552d038a69 14 * limitations under the License.
Zaitsev 10:41552d038a69 15 */
Zaitsev 10:41552d038a69 16 #ifndef MBED_PINNAMES_H
Zaitsev 10:41552d038a69 17 #define MBED_PINNAMES_H
Zaitsev 10:41552d038a69 18
Zaitsev 10:41552d038a69 19 #include "cmsis.h"
Zaitsev 10:41552d038a69 20
Zaitsev 10:41552d038a69 21 #ifdef __cplusplus
Zaitsev 10:41552d038a69 22 extern "C" {
Zaitsev 10:41552d038a69 23 #endif
Zaitsev 10:41552d038a69 24
Zaitsev 10:41552d038a69 25 typedef enum {
Zaitsev 10:41552d038a69 26 PIN_INPUT,
Zaitsev 10:41552d038a69 27 PIN_OUTPUT
Zaitsev 10:41552d038a69 28 } PinDirection;
Zaitsev 10:41552d038a69 29
Zaitsev 10:41552d038a69 30 #define PORT_SHIFT 16
Zaitsev 10:41552d038a69 31 #define PIN_SHIFT 9
Zaitsev 10:41552d038a69 32
Zaitsev 10:41552d038a69 33 typedef enum {
Zaitsev 10:41552d038a69 34 // LPC11U68 Pin Names (PORT[19:16] + PIN[15:9] + IOCON offset[8:0])
Zaitsev 10:41552d038a69 35
Zaitsev 10:41552d038a69 36 P0_0 = (0 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x000,
Zaitsev 10:41552d038a69 37 P0_1 = (0 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x004,
Zaitsev 10:41552d038a69 38 P0_2 = (0 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x008,
Zaitsev 10:41552d038a69 39 P0_3 = (0 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x00C,
Zaitsev 10:41552d038a69 40 P0_4 = (0 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x010,
Zaitsev 10:41552d038a69 41 P0_5 = (0 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x014,
Zaitsev 10:41552d038a69 42 P0_6 = (0 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x018,
Zaitsev 10:41552d038a69 43 P0_7 = (0 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x01C,
Zaitsev 10:41552d038a69 44 P0_8 = (0 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x020,
Zaitsev 10:41552d038a69 45 P0_9 = (0 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x024,
Zaitsev 10:41552d038a69 46 P0_10= (0 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x028,
Zaitsev 10:41552d038a69 47 P0_11= (0 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x02C,
Zaitsev 10:41552d038a69 48 P0_12= (0 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x030,
Zaitsev 10:41552d038a69 49 P0_13= (0 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x034,
Zaitsev 10:41552d038a69 50 P0_14= (0 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x038,
Zaitsev 10:41552d038a69 51 P0_15= (0 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x03C,
Zaitsev 10:41552d038a69 52 P0_16= (0 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x040,
Zaitsev 10:41552d038a69 53 P0_17= (0 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x044,
Zaitsev 10:41552d038a69 54 P0_18= (0 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x048,
Zaitsev 10:41552d038a69 55 P0_19= (0 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x04C,
Zaitsev 10:41552d038a69 56 P0_20= (0 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x050,
Zaitsev 10:41552d038a69 57 P0_21= (0 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x054,
Zaitsev 10:41552d038a69 58 P0_22= (0 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x058,
Zaitsev 10:41552d038a69 59 P0_23= (0 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x05C,
Zaitsev 10:41552d038a69 60
Zaitsev 10:41552d038a69 61 P1_0 = (1 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x060,
Zaitsev 10:41552d038a69 62 P1_1 = (1 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x064,
Zaitsev 10:41552d038a69 63 P1_2 = (1 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x068,
Zaitsev 10:41552d038a69 64 P1_3 = (1 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x06C,
Zaitsev 10:41552d038a69 65 P1_4 = (1 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x070,
Zaitsev 10:41552d038a69 66 P1_5 = (1 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x074,
Zaitsev 10:41552d038a69 67 P1_6 = (1 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x078,
Zaitsev 10:41552d038a69 68 P1_7 = (1 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x07C,
Zaitsev 10:41552d038a69 69 P1_8 = (1 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x080,
Zaitsev 10:41552d038a69 70 P1_9 = (1 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x084,
Zaitsev 10:41552d038a69 71 P1_10= (1 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x088,
Zaitsev 10:41552d038a69 72 P1_11= (1 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x08C,
Zaitsev 10:41552d038a69 73 P1_12= (1 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x090,
Zaitsev 10:41552d038a69 74 P1_13= (1 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x094,
Zaitsev 10:41552d038a69 75 P1_14= (1 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x098,
Zaitsev 10:41552d038a69 76 P1_15= (1 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x09C,
Zaitsev 10:41552d038a69 77 P1_16= (1 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x0A0,
Zaitsev 10:41552d038a69 78 P1_17= (1 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x0A4,
Zaitsev 10:41552d038a69 79 P1_18= (1 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x0A8,
Zaitsev 10:41552d038a69 80 P1_19= (1 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x0AC,
Zaitsev 10:41552d038a69 81 P1_20= (1 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x0B0,
Zaitsev 10:41552d038a69 82 P1_21= (1 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x0B4,
Zaitsev 10:41552d038a69 83 P1_22= (1 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x0B8,
Zaitsev 10:41552d038a69 84 P1_23= (1 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x0BC,
Zaitsev 10:41552d038a69 85 P1_24= (1 << PORT_SHIFT) | (24<< PIN_SHIFT) | 0x0C0,
Zaitsev 10:41552d038a69 86 P1_25= (1 << PORT_SHIFT) | (25<< PIN_SHIFT) | 0x0C4,
Zaitsev 10:41552d038a69 87 P1_26= (1 << PORT_SHIFT) | (26<< PIN_SHIFT) | 0x0C8,
Zaitsev 10:41552d038a69 88 P1_27= (1 << PORT_SHIFT) | (27<< PIN_SHIFT) | 0x0CC,
Zaitsev 10:41552d038a69 89 P1_28= (1 << PORT_SHIFT) | (28<< PIN_SHIFT) | 0x0D0,
Zaitsev 10:41552d038a69 90 P1_29= (1 << PORT_SHIFT) | (29<< PIN_SHIFT) | 0x0D4,
Zaitsev 10:41552d038a69 91 P1_30= (1 << PORT_SHIFT) | (30<< PIN_SHIFT) | 0x0D8,
Zaitsev 10:41552d038a69 92 P1_31= (1 << PORT_SHIFT) | (31<< PIN_SHIFT) | 0x0DC,
Zaitsev 10:41552d038a69 93
Zaitsev 10:41552d038a69 94 P2_0 = (2 << PORT_SHIFT) | (0 << PIN_SHIFT) | 0x0F0,
Zaitsev 10:41552d038a69 95 P2_1 = (2 << PORT_SHIFT) | (1 << PIN_SHIFT) | 0x0F4,
Zaitsev 10:41552d038a69 96 P2_2 = (2 << PORT_SHIFT) | (2 << PIN_SHIFT) | 0x0FC,
Zaitsev 10:41552d038a69 97 P2_3 = (2 << PORT_SHIFT) | (3 << PIN_SHIFT) | 0x100,
Zaitsev 10:41552d038a69 98 P2_4 = (2 << PORT_SHIFT) | (4 << PIN_SHIFT) | 0x104,
Zaitsev 10:41552d038a69 99 P2_5 = (2 << PORT_SHIFT) | (5 << PIN_SHIFT) | 0x108,
Zaitsev 10:41552d038a69 100 P2_6 = (2 << PORT_SHIFT) | (6 << PIN_SHIFT) | 0x10C,
Zaitsev 10:41552d038a69 101 P2_7 = (2 << PORT_SHIFT) | (7 << PIN_SHIFT) | 0x110,
Zaitsev 10:41552d038a69 102 P2_8 = (2 << PORT_SHIFT) | (8 << PIN_SHIFT) | 0x114,
Zaitsev 10:41552d038a69 103 P2_9 = (2 << PORT_SHIFT) | (9 << PIN_SHIFT) | 0x118,
Zaitsev 10:41552d038a69 104 P2_10= (2 << PORT_SHIFT) | (10<< PIN_SHIFT) | 0x11C,
Zaitsev 10:41552d038a69 105 P2_11= (2 << PORT_SHIFT) | (11<< PIN_SHIFT) | 0x120,
Zaitsev 10:41552d038a69 106 P2_12= (2 << PORT_SHIFT) | (12<< PIN_SHIFT) | 0x124,
Zaitsev 10:41552d038a69 107 P2_13= (2 << PORT_SHIFT) | (13<< PIN_SHIFT) | 0x128,
Zaitsev 10:41552d038a69 108 P2_14= (2 << PORT_SHIFT) | (14<< PIN_SHIFT) | 0x12C,
Zaitsev 10:41552d038a69 109 P2_15= (2 << PORT_SHIFT) | (15<< PIN_SHIFT) | 0x130,
Zaitsev 10:41552d038a69 110 P2_16= (2 << PORT_SHIFT) | (16<< PIN_SHIFT) | 0x134,
Zaitsev 10:41552d038a69 111 P2_17= (2 << PORT_SHIFT) | (17<< PIN_SHIFT) | 0x138,
Zaitsev 10:41552d038a69 112 P2_18= (2 << PORT_SHIFT) | (18<< PIN_SHIFT) | 0x13C,
Zaitsev 10:41552d038a69 113 P2_19= (2 << PORT_SHIFT) | (19<< PIN_SHIFT) | 0x140,
Zaitsev 10:41552d038a69 114 P2_20= (2 << PORT_SHIFT) | (20<< PIN_SHIFT) | 0x144,
Zaitsev 10:41552d038a69 115 P2_21= (2 << PORT_SHIFT) | (21<< PIN_SHIFT) | 0x148,
Zaitsev 10:41552d038a69 116 P2_22= (2 << PORT_SHIFT) | (22<< PIN_SHIFT) | 0x14C,
Zaitsev 10:41552d038a69 117 P2_23= (2 << PORT_SHIFT) | (23<< PIN_SHIFT) | 0x150,
Zaitsev 10:41552d038a69 118
Zaitsev 10:41552d038a69 119 LED_RED = P2_17,
Zaitsev 10:41552d038a69 120 LED_GREEN = P2_16,
Zaitsev 10:41552d038a69 121 LED_BLUE = P2_18,
Zaitsev 10:41552d038a69 122
Zaitsev 10:41552d038a69 123 // mbed original LED naming
Zaitsev 10:41552d038a69 124 LED1 = LED_RED,
Zaitsev 10:41552d038a69 125 LED2 = LED_GREEN,
Zaitsev 10:41552d038a69 126 LED3 = LED_BLUE,
Zaitsev 10:41552d038a69 127 LED4 = LED_BLUE,
Zaitsev 10:41552d038a69 128
Zaitsev 10:41552d038a69 129 // Serial to USB pins
Zaitsev 10:41552d038a69 130 USBTX = P0_19,
Zaitsev 10:41552d038a69 131 USBRX = P0_18,
Zaitsev 10:41552d038a69 132
Zaitsev 10:41552d038a69 133 // Arduino Shield Receptacles Names
Zaitsev 10:41552d038a69 134 D0 = P0_18,
Zaitsev 10:41552d038a69 135 D1 = P0_19,
Zaitsev 10:41552d038a69 136 D2 = P1_18,
Zaitsev 10:41552d038a69 137 D3 = P1_24,
Zaitsev 10:41552d038a69 138 D4 = P1_19,
Zaitsev 10:41552d038a69 139 D5 = P1_26,
Zaitsev 10:41552d038a69 140 D6 = P1_27,
Zaitsev 10:41552d038a69 141 D7 = P1_25,
Zaitsev 10:41552d038a69 142 D8 = P1_28,
Zaitsev 10:41552d038a69 143 D9 = P2_3,
Zaitsev 10:41552d038a69 144 D10= P0_2,
Zaitsev 10:41552d038a69 145 D11= P0_9,
Zaitsev 10:41552d038a69 146 D12= P0_8,
Zaitsev 10:41552d038a69 147 D13= P1_29,
Zaitsev 10:41552d038a69 148 D14= P0_5,
Zaitsev 10:41552d038a69 149 D15= P0_4,
Zaitsev 10:41552d038a69 150
Zaitsev 10:41552d038a69 151 A0 = P1_9,
Zaitsev 10:41552d038a69 152 A1 = P0_14,
Zaitsev 10:41552d038a69 153 A2 = P0_13,
Zaitsev 10:41552d038a69 154 A3 = P0_12,
Zaitsev 10:41552d038a69 155 A4 = P0_5, // same port as SDA
Zaitsev 10:41552d038a69 156 A5 = P0_4, // same port as SCL
Zaitsev 10:41552d038a69 157 SDA= P0_5, // same port as A4
Zaitsev 10:41552d038a69 158 SCL= P0_4, // same port as A5
Zaitsev 10:41552d038a69 159
Zaitsev 10:41552d038a69 160 // Not connected
Zaitsev 10:41552d038a69 161 NC = (int)0xFFFFFFFF,
Zaitsev 10:41552d038a69 162 } PinName;
Zaitsev 10:41552d038a69 163
Zaitsev 10:41552d038a69 164 typedef enum {
Zaitsev 10:41552d038a69 165 PullUp = 2,
Zaitsev 10:41552d038a69 166 PullDown = 1,
Zaitsev 10:41552d038a69 167 PullNone = 0,
Zaitsev 10:41552d038a69 168 Repeater = 3,
Zaitsev 10:41552d038a69 169 OpenDrain = 4,
Zaitsev 10:41552d038a69 170 PullDefault = PullDown
Zaitsev 10:41552d038a69 171 } PinMode;
Zaitsev 10:41552d038a69 172
Zaitsev 10:41552d038a69 173 #define STDIO_UART_TX USBTX
Zaitsev 10:41552d038a69 174 #define STDIO_UART_RX USBRX
Zaitsev 10:41552d038a69 175 #define STDIO_UART UART_0
Zaitsev 10:41552d038a69 176
Zaitsev 10:41552d038a69 177 #ifdef __cplusplus
Zaitsev 10:41552d038a69 178 }
Zaitsev 10:41552d038a69 179 #endif
Zaitsev 10:41552d038a69 180
Zaitsev 10:41552d038a69 181 #endif