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 PTA18 = (0 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 39 PTA19 = (0 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 40 PTB3 = (1 << GPIO_PORT_SHIFT | 3),
AnnaBridge 171:3a7713b1edbc 41 PTB10 = (1 << GPIO_PORT_SHIFT | 10),
AnnaBridge 171:3a7713b1edbc 42 PTB11 = (1 << GPIO_PORT_SHIFT | 11),
AnnaBridge 171:3a7713b1edbc 43 PTB16 = (1 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 44 PTB17 = (1 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 45 PTB19 = (1 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 46 PTC0 = (2 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 47 PTC1 = (2 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 48 PTC3 = (2 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 49 PTC4 = (2 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 50 PTC5 = (2 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 51 PTC6 = (2 << GPIO_PORT_SHIFT | 6 ),
AnnaBridge 171:3a7713b1edbc 52 PTC7 = (2 << GPIO_PORT_SHIFT | 7 ),
AnnaBridge 171:3a7713b1edbc 53 PTD1 = (3 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 54 PTD2 = (3 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 55 PTD3 = (3 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 56 PTD4 = (3 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 57 PTD5 = (3 << GPIO_PORT_SHIFT | 5 ),
AnnaBridge 171:3a7713b1edbc 58 PTD6 = (3 << GPIO_PORT_SHIFT | 6 ),
AnnaBridge 171:3a7713b1edbc 59 PTD7 = (3 << GPIO_PORT_SHIFT | 7 ),
AnnaBridge 171:3a7713b1edbc 60 PTE0 = (4 << GPIO_PORT_SHIFT | 0 ),
AnnaBridge 171:3a7713b1edbc 61 PTE1 = (4 << GPIO_PORT_SHIFT | 1 ),
AnnaBridge 171:3a7713b1edbc 62 PTE2 = (4 << GPIO_PORT_SHIFT | 2 ),
AnnaBridge 171:3a7713b1edbc 63 PTE3 = (4 << GPIO_PORT_SHIFT | 3 ),
AnnaBridge 171:3a7713b1edbc 64 PTE4 = (4 << GPIO_PORT_SHIFT | 4 ),
AnnaBridge 171:3a7713b1edbc 65 PTE16 = (4 << GPIO_PORT_SHIFT | 16),
AnnaBridge 171:3a7713b1edbc 66 PTE17 = (4 << GPIO_PORT_SHIFT | 17),
AnnaBridge 171:3a7713b1edbc 67 PTE18 = (4 << GPIO_PORT_SHIFT | 18),
AnnaBridge 171:3a7713b1edbc 68 PTE19 = (4 << GPIO_PORT_SHIFT | 19),
AnnaBridge 171:3a7713b1edbc 69
AnnaBridge 171:3a7713b1edbc 70 LED_RED = PTD4,
AnnaBridge 171:3a7713b1edbc 71 LED_GREEN = PTD5,
AnnaBridge 171:3a7713b1edbc 72 LED_BLUE = PTD6,
AnnaBridge 171:3a7713b1edbc 73
AnnaBridge 171:3a7713b1edbc 74 // mbed original LED naming
AnnaBridge 171:3a7713b1edbc 75 LED1 = LED_RED,
AnnaBridge 171:3a7713b1edbc 76 LED2 = LED_GREEN,
AnnaBridge 171:3a7713b1edbc 77 LED3 = LED_BLUE,
AnnaBridge 171:3a7713b1edbc 78 LED4 = PTD7,
AnnaBridge 171:3a7713b1edbc 79
AnnaBridge 171:3a7713b1edbc 80 //Push buttons
AnnaBridge 171:3a7713b1edbc 81 SW1 = PTE4,
AnnaBridge 171:3a7713b1edbc 82 SW2 = PTE3,
AnnaBridge 171:3a7713b1edbc 83 SW3 = PTD1,
AnnaBridge 171:3a7713b1edbc 84 SW4 = PTA19,
AnnaBridge 171:3a7713b1edbc 85 // Standardized button names
AnnaBridge 171:3a7713b1edbc 86 BUTTON1 = SW1,
AnnaBridge 171:3a7713b1edbc 87 BUTTON2 = SW2,
AnnaBridge 171:3a7713b1edbc 88 BUTTON3 = SW3,
AnnaBridge 171:3a7713b1edbc 89 BUTTON4 = SW4,
AnnaBridge 171:3a7713b1edbc 90
AnnaBridge 171:3a7713b1edbc 91 // USB Pins
AnnaBridge 171:3a7713b1edbc 92 USBTX = PTE0,
AnnaBridge 171:3a7713b1edbc 93 USBRX = PTE1,
AnnaBridge 171:3a7713b1edbc 94
AnnaBridge 171:3a7713b1edbc 95 // Not connected
AnnaBridge 171:3a7713b1edbc 96 NC = (int)0xFFFFFFFF,
AnnaBridge 171:3a7713b1edbc 97
AnnaBridge 171:3a7713b1edbc 98 // Arduino Headers
AnnaBridge 171:3a7713b1edbc 99 D0 = PTD7,
AnnaBridge 171:3a7713b1edbc 100 D1 = PTD6,
AnnaBridge 171:3a7713b1edbc 101 D2 = PTD5,
AnnaBridge 171:3a7713b1edbc 102 D3 = PTD4,
AnnaBridge 171:3a7713b1edbc 103 D4 = NC,
AnnaBridge 171:3a7713b1edbc 104 D5 = NC,
AnnaBridge 171:3a7713b1edbc 105 D6 = PTE4,
AnnaBridge 171:3a7713b1edbc 106 D7 = PTD1,
AnnaBridge 171:3a7713b1edbc 107 D8 = PTA19,
AnnaBridge 171:3a7713b1edbc 108 D9 = PTA18,
AnnaBridge 171:3a7713b1edbc 109 D10 = PTC4,
AnnaBridge 171:3a7713b1edbc 110 D11 = PTC6,
AnnaBridge 171:3a7713b1edbc 111 D12 = PTC7,
AnnaBridge 171:3a7713b1edbc 112 D13 = PTC5,
AnnaBridge 171:3a7713b1edbc 113 D14 = PTD3,
AnnaBridge 171:3a7713b1edbc 114 D15 = PTD2,
AnnaBridge 171:3a7713b1edbc 115
AnnaBridge 171:3a7713b1edbc 116 I2C_SCL = D15,
AnnaBridge 171:3a7713b1edbc 117 I2C_SDA = D14,
AnnaBridge 171:3a7713b1edbc 118
AnnaBridge 171:3a7713b1edbc 119 A0 = NC,
AnnaBridge 171:3a7713b1edbc 120 A1 = NC,
AnnaBridge 171:3a7713b1edbc 121 A2 = NC,
AnnaBridge 171:3a7713b1edbc 122 A3 = NC,
AnnaBridge 171:3a7713b1edbc 123 A4 = NC,
AnnaBridge 171:3a7713b1edbc 124 A5 = NC
AnnaBridge 171:3a7713b1edbc 125 } PinName;
AnnaBridge 171:3a7713b1edbc 126
AnnaBridge 171:3a7713b1edbc 127
AnnaBridge 171:3a7713b1edbc 128 typedef enum {
AnnaBridge 171:3a7713b1edbc 129 PullNone = 0,
AnnaBridge 171:3a7713b1edbc 130 PullDown = 1,
AnnaBridge 171:3a7713b1edbc 131 PullUp = 2,
AnnaBridge 171:3a7713b1edbc 132 PullDefault = PullUp
AnnaBridge 171:3a7713b1edbc 133 } PinMode;
AnnaBridge 171:3a7713b1edbc 134
AnnaBridge 171:3a7713b1edbc 135 #ifdef __cplusplus
AnnaBridge 171:3a7713b1edbc 136 }
AnnaBridge 171:3a7713b1edbc 137 #endif
AnnaBridge 171:3a7713b1edbc 138
AnnaBridge 171:3a7713b1edbc 139 #endif