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 PTA10 = (0 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 40 PTA11 = (0 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 41 PTA12 = (0 << GPIO_PORT_SHIFT | 12),
AnnaBridge 171:3a7713b1edbc 42 PTA13 = (0 << GPIO_PORT_SHIFT | 13),
AnnaBridge 171:3a7713b1edbc 43 PTA14 = (0 << GPIO_PORT_SHIFT | 14),
AnnaBridge 171:3a7713b1edbc 44 PTA15 = (0 << GPIO_PORT_SHIFT | 15),
AnnaBridge 171:3a7713b1edbc 45 PTA16 = (0 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 46 PTA17 = (0 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 47 PTA18 = (0 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 48 PTA19 = (0 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 49
AnnaBridge 171:3a7713b1edbc 50 PTB0 = (1 << GPIO_PORT_SHIFT | 0),
AnnaBridge 171:3a7713b1edbc 51 PTB1 = (1 << GPIO_PORT_SHIFT | 1),
AnnaBridge 171:3a7713b1edbc 52 PTB2 = (1 << GPIO_PORT_SHIFT | 2),
AnnaBridge 171:3a7713b1edbc 53 PTB3 = (1 << GPIO_PORT_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 54 PTB9 = (1 << GPIO_PORT_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 55 PTB10 = (1 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 56 PTB11 = (1 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 57 PTB16 = (1 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 58 PTB17 = (1 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 59 PTB18 = (1 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 60 PTB19 = (1 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 61 PTB20 = (1 << GPIO_PORT_SHIFT | 20),
AnnaBridge 171:3a7713b1edbc 62 PTB21 = (1 << GPIO_PORT_SHIFT | 21),
AnnaBridge 171:3a7713b1edbc 63 PTB22 = (1 << GPIO_PORT_SHIFT | 22),
AnnaBridge 171:3a7713b1edbc 64 PTB23 = (1 << GPIO_PORT_SHIFT | 23),
AnnaBridge 171:3a7713b1edbc 65
AnnaBridge 171:3a7713b1edbc 66 PTC0 = (2 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 67 PTC1 = (2 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 68 PTC2 = (2 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 69 PTC3 = (2 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 70 PTC4 = (2 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 71 PTC5 = (2 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 72 PTC6 = (2 << GPIO_PORT_SHIFT | 6 ),
AnnaBridge 171:3a7713b1edbc 73 PTC7 = (2 << GPIO_PORT_SHIFT | 7 ),
AnnaBridge 171:3a7713b1edbc 74 PTC8 = (2 << GPIO_PORT_SHIFT | 8 ),
AnnaBridge 171:3a7713b1edbc 75 PTC9 = (2 << GPIO_PORT_SHIFT | 9 ),
AnnaBridge 171:3a7713b1edbc 76 PTC10 = (2 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 77 PTC11 = (2 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 78 PTC12 = (2 << GPIO_PORT_SHIFT | 12),
AnnaBridge 171:3a7713b1edbc 79 PTC13 = (2 << GPIO_PORT_SHIFT | 13),
AnnaBridge 171:3a7713b1edbc 80 PTC14 = (2 << GPIO_PORT_SHIFT | 14),
AnnaBridge 171:3a7713b1edbc 81 PTC15 = (2 << GPIO_PORT_SHIFT | 15),
AnnaBridge 171:3a7713b1edbc 82 PTC17 = (2 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 83
AnnaBridge 171:3a7713b1edbc 84 PTD0 = (3 << GPIO_PORT_SHIFT | 0),
AnnaBridge 171:3a7713b1edbc 85 PTD1 = (3 << GPIO_PORT_SHIFT | 1),
AnnaBridge 171:3a7713b1edbc 86 PTD2 = (3 << GPIO_PORT_SHIFT | 2),
AnnaBridge 171:3a7713b1edbc 87 PTD3 = (3 << GPIO_PORT_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 88 PTD4 = (3 << GPIO_PORT_SHIFT | 4),
AnnaBridge 171:3a7713b1edbc 89 PTD5 = (3 << GPIO_PORT_SHIFT | 5),
AnnaBridge 171:3a7713b1edbc 90 PTD6 = (3 << GPIO_PORT_SHIFT | 6),
AnnaBridge 171:3a7713b1edbc 91 PTD7 = (3 << GPIO_PORT_SHIFT | 7),
AnnaBridge 171:3a7713b1edbc 92 PTD8 = (3 << GPIO_PORT_SHIFT | 8),
AnnaBridge 171:3a7713b1edbc 93 PTD9 = (3 << GPIO_PORT_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 94
AnnaBridge 171:3a7713b1edbc 95 PTE0 = (4 << GPIO_PORT_SHIFT | 0),
AnnaBridge 171:3a7713b1edbc 96 PTE1 = (4 << GPIO_PORT_SHIFT | 1),
AnnaBridge 171:3a7713b1edbc 97 PTE2 = (4 << GPIO_PORT_SHIFT | 2),
AnnaBridge 171:3a7713b1edbc 98 PTE3 = (4 << GPIO_PORT_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 99 PTE4 = (4 << GPIO_PORT_SHIFT | 4),
AnnaBridge 171:3a7713b1edbc 100 PTE5 = (4 << GPIO_PORT_SHIFT | 5),
AnnaBridge 171:3a7713b1edbc 101 PTE6 = (4 << GPIO_PORT_SHIFT | 6),
AnnaBridge 171:3a7713b1edbc 102 PTE7 = (4 << GPIO_PORT_SHIFT | 7),
AnnaBridge 171:3a7713b1edbc 103 PTE8 = (4 << GPIO_PORT_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 104 PTE9 = (4 << GPIO_PORT_SHIFT | 9),
AnnaBridge 171:3a7713b1edbc 105 PTE10 = (4 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 106 PTE11 = (4 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 107
AnnaBridge 171:3a7713b1edbc 108 LED_RED = PTC1,
AnnaBridge 171:3a7713b1edbc 109 LED_GREEN = PTC2,
AnnaBridge 171:3a7713b1edbc 110 LED_BLUE = PTC0,
AnnaBridge 171:3a7713b1edbc 111
AnnaBridge 171:3a7713b1edbc 112 // mbed original LED naming
AnnaBridge 171:3a7713b1edbc 113 LED1 = LED_RED,
AnnaBridge 171:3a7713b1edbc 114 LED2 = LED_GREEN,
AnnaBridge 171:3a7713b1edbc 115 LED3 = LED_BLUE,
AnnaBridge 171:3a7713b1edbc 116 LED4 = LED_RED,
AnnaBridge 171:3a7713b1edbc 117
AnnaBridge 171:3a7713b1edbc 118 //Push buttons
AnnaBridge 171:3a7713b1edbc 119 SW2 = PTA4,
AnnaBridge 171:3a7713b1edbc 120 SW3 = PTD0,
AnnaBridge 171:3a7713b1edbc 121 // Standardized button names
AnnaBridge 171:3a7713b1edbc 122 BUTTON1 = SW2,
AnnaBridge 171:3a7713b1edbc 123 BUTTON2 = SW3,
AnnaBridge 171:3a7713b1edbc 124
AnnaBridge 171:3a7713b1edbc 125 // USB Pins
AnnaBridge 171:3a7713b1edbc 126 USBTX = PTB17,
AnnaBridge 171:3a7713b1edbc 127 USBRX = PTB16,
AnnaBridge 171:3a7713b1edbc 128
AnnaBridge 171:3a7713b1edbc 129 DAC0_OUT = 0xFEFE, /* DAC does not have Pin Name in RM */
AnnaBridge 171:3a7713b1edbc 130
AnnaBridge 171:3a7713b1edbc 131 // Arduino Headers
AnnaBridge 171:3a7713b1edbc 132 D0 = PTB16,
AnnaBridge 171:3a7713b1edbc 133 D1 = PTB17,
AnnaBridge 171:3a7713b1edbc 134 D2 = PTD7,
AnnaBridge 171:3a7713b1edbc 135 D3 = PTC1,
AnnaBridge 171:3a7713b1edbc 136 D4 = PTC12,
AnnaBridge 171:3a7713b1edbc 137 D5 = PTC2,
AnnaBridge 171:3a7713b1edbc 138 D6 = PTC3,
AnnaBridge 171:3a7713b1edbc 139 D7 = PTC9,
AnnaBridge 171:3a7713b1edbc 140 D8 = PTD4,
AnnaBridge 171:3a7713b1edbc 141 D9 = PTD5,
AnnaBridge 171:3a7713b1edbc 142 D10 = PTC4,
AnnaBridge 171:3a7713b1edbc 143 D11 = PTC6,
AnnaBridge 171:3a7713b1edbc 144 D12 = PTC7,
AnnaBridge 171:3a7713b1edbc 145 D13 = PTC5,
AnnaBridge 171:3a7713b1edbc 146 D14 = PTC11,
AnnaBridge 171:3a7713b1edbc 147 D15 = PTC10,
AnnaBridge 171:3a7713b1edbc 148
AnnaBridge 171:3a7713b1edbc 149 I2C_SCL = D15,
AnnaBridge 171:3a7713b1edbc 150 I2C_SDA = D14,
AnnaBridge 171:3a7713b1edbc 151
AnnaBridge 171:3a7713b1edbc 152 A0 = DAC0_OUT,
AnnaBridge 171:3a7713b1edbc 153 A1 = PTD1,
AnnaBridge 171:3a7713b1edbc 154 A2 = PTC0,
AnnaBridge 171:3a7713b1edbc 155 A3 = PTD6,
AnnaBridge 171:3a7713b1edbc 156 A4 = PTB1,
AnnaBridge 171:3a7713b1edbc 157 A5 = PTB0,
AnnaBridge 171:3a7713b1edbc 158
AnnaBridge 171:3a7713b1edbc 159 /**** QSPI FLASH pins ****/
AnnaBridge 171:3a7713b1edbc 160 QSPI_FLASH1_IO0 = PTE2,
AnnaBridge 171:3a7713b1edbc 161 QSPI_FLASH1_IO1 = PTE4,
AnnaBridge 171:3a7713b1edbc 162 QSPI_FLASH1_IO2 = PTE3,
AnnaBridge 171:3a7713b1edbc 163 QSPI_FLASH1_IO3 = PTE0,
AnnaBridge 171:3a7713b1edbc 164 QSPI_FLASH1_SCK = PTE1,
AnnaBridge 171:3a7713b1edbc 165 QSPI_FLASH1_CSN = PTE5,
AnnaBridge 171:3a7713b1edbc 166
AnnaBridge 171:3a7713b1edbc 167 // Not connected
AnnaBridge 171:3a7713b1edbc 168 NC = (int)0xFFFFFFFF
AnnaBridge 171:3a7713b1edbc 169 } PinName;
AnnaBridge 171:3a7713b1edbc 170
AnnaBridge 171:3a7713b1edbc 171 typedef enum {
AnnaBridge 171:3a7713b1edbc 172 PullNone = 0,
AnnaBridge 171:3a7713b1edbc 173 PullDown = 1,
AnnaBridge 171:3a7713b1edbc 174 PullUp = 2,
AnnaBridge 171:3a7713b1edbc 175 PullDefault = PullUp
AnnaBridge 171:3a7713b1edbc 176 } PinMode;
AnnaBridge 171:3a7713b1edbc 177
AnnaBridge 171:3a7713b1edbc 178 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 179 }
AnnaBridge 171:3a7713b1edbc 180 #endif
AnnaBridge 171:3a7713b1edbc 181
AnnaBridge 171:3a7713b1edbc 182 #endif