mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c

Dependents:   Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay

Fork of mbed-dev by mbed official

Committer:
bogdanm
Date:
Thu Oct 01 15:25:22 2015 +0300
Revision:
0:9b334a45a8ff
Child:
144:ef7eb2e8f9f7
Initial commit on mbed-dev

Replaces mbed-src (now inactive)

Who changed what in which revision?

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