The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /* mbed Microcontroller Library
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2006-2013 ARM Limited
AnnaBridge 171:3a7713b1edbc 3 *
AnnaBridge 171:3a7713b1edbc 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 171:3a7713b1edbc 5 * you may not use this file except in compliance with the License.
AnnaBridge 171:3a7713b1edbc 6 * You may obtain a copy of the License at
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 171:3a7713b1edbc 9 *
AnnaBridge 171:3a7713b1edbc 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 171:3a7713b1edbc 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 171:3a7713b1edbc 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 171:3a7713b1edbc 13 * See the License for the specific language governing permissions and
AnnaBridge 171:3a7713b1edbc 14 * limitations under the License.
AnnaBridge 171:3a7713b1edbc 15 */
AnnaBridge 171:3a7713b1edbc 16 #ifndef MBED_PINNAMES_H
AnnaBridge 171:3a7713b1edbc 17 #define MBED_PINNAMES_H
AnnaBridge 171:3a7713b1edbc 18
AnnaBridge 171:3a7713b1edbc 19 #include "cmsis.h"
AnnaBridge 171:3a7713b1edbc 20
AnnaBridge 171:3a7713b1edbc 21 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 22 extern "C" {
AnnaBridge 171:3a7713b1edbc 23 #endif
AnnaBridge 171:3a7713b1edbc 24
AnnaBridge 171:3a7713b1edbc 25 typedef enum {
AnnaBridge 171:3a7713b1edbc 26 PIN_INPUT,
AnnaBridge 171:3a7713b1edbc 27 PIN_OUTPUT
AnnaBridge 171:3a7713b1edbc 28 } PinDirection;
AnnaBridge 171:3a7713b1edbc 29
AnnaBridge 171:3a7713b1edbc 30 #define GPIO_PORT_SHIFT 12
AnnaBridge 171:3a7713b1edbc 31
AnnaBridge 171:3a7713b1edbc 32 typedef enum {
AnnaBridge 171:3a7713b1edbc 33 PTA0 = (0 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 34 PTA1 = (0 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 35 PTA2 = (0 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 36 PTA3 = (0 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 37 PTA4 = (0 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 38 PTA5 = (0 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 39 PTA12 = (0 << GPIO_PORT_SHIFT | 12),
AnnaBridge 171:3a7713b1edbc 40 PTA13 = (0 << GPIO_PORT_SHIFT | 13),
AnnaBridge 171:3a7713b1edbc 41 PTA18 = (0 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 42 PTA19 = (0 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 43 PTA20 = (0 << GPIO_PORT_SHIFT | 20),
AnnaBridge 171:3a7713b1edbc 44 PTB0 = (1 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 45 PTB1 = (1 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 46 PTB2 = (1 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 47 PTB3 = (1 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 48 PTB16 = (1 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 49 PTB17 = (1 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 50 PTB18 = (1 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 51 PTB19 = (1 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 52 PTC0 = (2 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 53 PTC1 = (2 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 54 PTC2 = (2 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 55 PTC3 = (2 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 56 PTC4 = (2 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 57 PTC5 = (2 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 58 PTC6 = (2 << GPIO_PORT_SHIFT | 6 ),
AnnaBridge 171:3a7713b1edbc 59 PTC7 = (2 << GPIO_PORT_SHIFT | 7 ),
AnnaBridge 171:3a7713b1edbc 60 PTC8 = (2 << GPIO_PORT_SHIFT | 8 ),
AnnaBridge 171:3a7713b1edbc 61 PTC9 = (2 << GPIO_PORT_SHIFT | 9 ),
AnnaBridge 171:3a7713b1edbc 62 PTC10 = (2 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 63 PTC11 = (2 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 64 PTD0 = (3 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 65 PTD1 = (3 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 66 PTD2 = (3 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 67 PTD3 = (3 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 68 PTD4 = (3 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 69 PTD5 = (3 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 70 PTD6 = (3 << GPIO_PORT_SHIFT | 6 ),
AnnaBridge 171:3a7713b1edbc 71 PTD7 = (3 << GPIO_PORT_SHIFT | 7 ),
AnnaBridge 171:3a7713b1edbc 72 PTE0 = (4 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 73 PTE1 = (4 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 74 PTE16 = (4 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 75 PTE17 = (4 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 76 PTE18 = (4 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 77 PTE19 = (4 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 78 PTE20 = (4 << GPIO_PORT_SHIFT | 20),
AnnaBridge 171:3a7713b1edbc 79 PTE21 = (4 << GPIO_PORT_SHIFT | 21),
AnnaBridge 171:3a7713b1edbc 80 PTE22 = (4 << GPIO_PORT_SHIFT | 22),
AnnaBridge 171:3a7713b1edbc 81 PTE23 = (4 << GPIO_PORT_SHIFT | 23),
AnnaBridge 171:3a7713b1edbc 82 PTE24 = (4 << GPIO_PORT_SHIFT | 24),
AnnaBridge 171:3a7713b1edbc 83 PTE25 = (4 << GPIO_PORT_SHIFT | 25),
AnnaBridge 171:3a7713b1edbc 84 PTE29 = (4 << GPIO_PORT_SHIFT | 29),
AnnaBridge 171:3a7713b1edbc 85 PTE30 = (4 << GPIO_PORT_SHIFT | 30),
AnnaBridge 171:3a7713b1edbc 86 PTE31 = (4 << GPIO_PORT_SHIFT | 31),
AnnaBridge 171:3a7713b1edbc 87
AnnaBridge 171:3a7713b1edbc 88 LED_RED = PTB18,
AnnaBridge 171:3a7713b1edbc 89 LED_GREEN = PTB19,
AnnaBridge 171:3a7713b1edbc 90 LED_BLUE = PTA13,
AnnaBridge 171:3a7713b1edbc 91
AnnaBridge 171:3a7713b1edbc 92 // mbed original LED naming
AnnaBridge 171:3a7713b1edbc 93 LED1 = LED_RED,
AnnaBridge 171:3a7713b1edbc 94 LED2 = LED_GREEN,
AnnaBridge 171:3a7713b1edbc 95 LED3 = LED_BLUE,
AnnaBridge 171:3a7713b1edbc 96 LED4 = LED_RED,
AnnaBridge 171:3a7713b1edbc 97
AnnaBridge 171:3a7713b1edbc 98 //Push buttons
AnnaBridge 171:3a7713b1edbc 99 SW1 = PTA4,
AnnaBridge 171:3a7713b1edbc 100 SW3 = PTC1,
AnnaBridge 171:3a7713b1edbc 101 // Standardized button names
AnnaBridge 171:3a7713b1edbc 102 BUTTON1 = SW1,
AnnaBridge 171:3a7713b1edbc 103 BUTTON2 = SW3,
AnnaBridge 171:3a7713b1edbc 104
AnnaBridge 171:3a7713b1edbc 105 // USB Pins
AnnaBridge 171:3a7713b1edbc 106 USBTX = PTA2,
AnnaBridge 171:3a7713b1edbc 107 USBRX = PTA1,
AnnaBridge 171:3a7713b1edbc 108
AnnaBridge 171:3a7713b1edbc 109 // Arduino Headers
AnnaBridge 171:3a7713b1edbc 110
AnnaBridge 171:3a7713b1edbc 111 D0 = PTA1,
AnnaBridge 171:3a7713b1edbc 112 D1 = PTA2,
AnnaBridge 171:3a7713b1edbc 113 D2 = PTA12,
AnnaBridge 171:3a7713b1edbc 114 D3 = PTE25,
AnnaBridge 171:3a7713b1edbc 115 D4 = PTA13,
AnnaBridge 171:3a7713b1edbc 116 D5 = PTE24,
AnnaBridge 171:3a7713b1edbc 117 D6 = PTC9,
AnnaBridge 171:3a7713b1edbc 118 D7 = PTC8,
AnnaBridge 171:3a7713b1edbc 119 D8 = PTE31,
AnnaBridge 171:3a7713b1edbc 120 D9 = PTA5,
AnnaBridge 171:3a7713b1edbc 121 D10 = PTC4,
AnnaBridge 171:3a7713b1edbc 122 D11 = PTC6,
AnnaBridge 171:3a7713b1edbc 123 D12 = PTC7,
AnnaBridge 171:3a7713b1edbc 124 D13 = PTC5,
AnnaBridge 171:3a7713b1edbc 125 D14 = PTD6,
AnnaBridge 171:3a7713b1edbc 126 D15 = PTD7,
AnnaBridge 171:3a7713b1edbc 127
AnnaBridge 171:3a7713b1edbc 128 I2C_SCL = D15,
AnnaBridge 171:3a7713b1edbc 129 I2C_SDA = D14,
AnnaBridge 171:3a7713b1edbc 130
AnnaBridge 171:3a7713b1edbc 131 A0 = PTE16,
AnnaBridge 171:3a7713b1edbc 132 A1 = PTC0,
AnnaBridge 171:3a7713b1edbc 133 A2 = PTE20,
AnnaBridge 171:3a7713b1edbc 134 A3 = PTE21,
AnnaBridge 171:3a7713b1edbc 135 A4 = PTB1,
AnnaBridge 171:3a7713b1edbc 136 A5 = PTB0,
AnnaBridge 171:3a7713b1edbc 137
AnnaBridge 171:3a7713b1edbc 138 // Not connected
AnnaBridge 171:3a7713b1edbc 139 NC = (int)0xFFFFFFFF
AnnaBridge 171:3a7713b1edbc 140 } PinName;
AnnaBridge 171:3a7713b1edbc 141
AnnaBridge 171:3a7713b1edbc 142
AnnaBridge 171:3a7713b1edbc 143 typedef enum {
AnnaBridge 171:3a7713b1edbc 144 PullNone = 0,
AnnaBridge 171:3a7713b1edbc 145 PullDown = 1,
AnnaBridge 171:3a7713b1edbc 146 PullUp = 2,
AnnaBridge 171:3a7713b1edbc 147 PullDefault = PullUp
AnnaBridge 171:3a7713b1edbc 148 } PinMode;
AnnaBridge 171:3a7713b1edbc 149
AnnaBridge 171:3a7713b1edbc 150 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 151 }
AnnaBridge 171:3a7713b1edbc 152 #endif
AnnaBridge 171:3a7713b1edbc 153
AnnaBridge 171:3a7713b1edbc 154 #endif