mbed os with nrf51 internal bandgap enabled to read battery level

Dependents:   BLE_file_test BLE_Blink ExternalEncoder

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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