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 typedef enum {
Zaitsev 10:41552d038a69 31 // LPC Pin Names
Zaitsev 10:41552d038a69 32 P0_0 = 0,
Zaitsev 10:41552d038a69 33 P0_1, P0_2, P0_3, P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, P0_10, P0_11, P0_12, P0_13, P0_14, P0_15, P0_16, P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, P0_31,
Zaitsev 10:41552d038a69 34 P1_0, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11, P1_12, P1_13, P1_14, P1_15, P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31,
Zaitsev 10:41552d038a69 35 P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12,
Zaitsev 10:41552d038a69 36
Zaitsev 10:41552d038a69 37 LED_RED = P0_25,
Zaitsev 10:41552d038a69 38 LED_GREEN = P0_3,
Zaitsev 10:41552d038a69 39 LED_BLUE = P1_1,
Zaitsev 10:41552d038a69 40
Zaitsev 10:41552d038a69 41 // mbed original LED naming
Zaitsev 10:41552d038a69 42 LED1 = LED_RED,
Zaitsev 10:41552d038a69 43 LED2 = LED_GREEN,
Zaitsev 10:41552d038a69 44 LED3 = LED_BLUE,
Zaitsev 10:41552d038a69 45 LED4 = LED_BLUE,
Zaitsev 10:41552d038a69 46
Zaitsev 10:41552d038a69 47 // Serial to USB pins
Zaitsev 10:41552d038a69 48 USBTX = P0_18,
Zaitsev 10:41552d038a69 49 USBRX = P0_13,
Zaitsev 10:41552d038a69 50
Zaitsev 10:41552d038a69 51 // Arduino Shield Receptacles Names
Zaitsev 10:41552d038a69 52 D0 = P0_13,
Zaitsev 10:41552d038a69 53 D1 = P0_18,
Zaitsev 10:41552d038a69 54 D2 = P0_29,
Zaitsev 10:41552d038a69 55 D3 = P0_9,
Zaitsev 10:41552d038a69 56 D4 = P0_10,
Zaitsev 10:41552d038a69 57 D5 = P0_16, // same port as D13
Zaitsev 10:41552d038a69 58 D6 = P1_3,
Zaitsev 10:41552d038a69 59 D7 = P0_0,
Zaitsev 10:41552d038a69 60 D8 = P0_24,
Zaitsev 10:41552d038a69 61 D9 = P1_0,
Zaitsev 10:41552d038a69 62 D10= P0_27,
Zaitsev 10:41552d038a69 63 D11= P0_28,
Zaitsev 10:41552d038a69 64 D12= P0_12,
Zaitsev 10:41552d038a69 65 D13= P0_16, // same port as D5
Zaitsev 10:41552d038a69 66 D14= P0_23,
Zaitsev 10:41552d038a69 67 D15= P0_22,
Zaitsev 10:41552d038a69 68
Zaitsev 10:41552d038a69 69 A0 = P0_8,
Zaitsev 10:41552d038a69 70 A1 = P0_7,
Zaitsev 10:41552d038a69 71 A2 = P0_6,
Zaitsev 10:41552d038a69 72 A3 = P0_5,
Zaitsev 10:41552d038a69 73 A4 = P0_23, // same port as SDA
Zaitsev 10:41552d038a69 74 A5 = P0_22, // same port as SCL
Zaitsev 10:41552d038a69 75 SDA= P0_23, // same port as A4
Zaitsev 10:41552d038a69 76 SCL= P0_22, // same port as A5
Zaitsev 10:41552d038a69 77
Zaitsev 10:41552d038a69 78 // Not connected
Zaitsev 10:41552d038a69 79 NC = (int)0xFFFFFFFF,
Zaitsev 10:41552d038a69 80 } PinName;
Zaitsev 10:41552d038a69 81
Zaitsev 10:41552d038a69 82 typedef enum {
Zaitsev 10:41552d038a69 83 PullUp = 2,
Zaitsev 10:41552d038a69 84 PullDown = 1,
Zaitsev 10:41552d038a69 85 PullNone = 0,
Zaitsev 10:41552d038a69 86 Repeater = 3,
Zaitsev 10:41552d038a69 87 OpenDrain = 4,
Zaitsev 10:41552d038a69 88 PullDefault = PullDown
Zaitsev 10:41552d038a69 89 } PinMode;
Zaitsev 10:41552d038a69 90
Zaitsev 10:41552d038a69 91 #define STDIO_UART_TX USBTX
Zaitsev 10:41552d038a69 92 #define STDIO_UART_RX USBRX
Zaitsev 10:41552d038a69 93
Zaitsev 10:41552d038a69 94 typedef struct {
Zaitsev 10:41552d038a69 95 unsigned char n;
Zaitsev 10:41552d038a69 96 unsigned char offset;
Zaitsev 10:41552d038a69 97 } SWM_Map;
Zaitsev 10:41552d038a69 98
Zaitsev 10:41552d038a69 99 #ifdef __cplusplus
Zaitsev 10:41552d038a69 100 }
Zaitsev 10:41552d038a69 101 #endif
Zaitsev 10:41552d038a69 102
Zaitsev 10:41552d038a69 103 #endif