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:
maxxir
Date:
Tue Nov 07 16:46:29 2017 +0000
Revision:
177:619788de047e
Parent:
149:156823d33999
To fix broken RTC on Nucleo_F103RB / STM32F103 BluePill etc..;  Used direct RTC register manipulation for STM32F1xx;  rtc_read() && rtc_write()  (native rtc_init() - works good);  also added stub for non-working on STM32F1xx rtc_read_subseconds().

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 80:bdf1132a57cf 1 /* mbed Microcontroller Library
mbed_official 80:bdf1132a57cf 2 * Copyright (c) 2006-2013 ARM Limited
mbed_official 80:bdf1132a57cf 3 *
mbed_official 80:bdf1132a57cf 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 80:bdf1132a57cf 5 * you may not use this file except in compliance with the License.
mbed_official 80:bdf1132a57cf 6 * You may obtain a copy of the License at
mbed_official 80:bdf1132a57cf 7 *
mbed_official 80:bdf1132a57cf 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 80:bdf1132a57cf 9 *
mbed_official 80:bdf1132a57cf 10 * Unless required by applicable law or agreed to in writing, software
mbed_official 80:bdf1132a57cf 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 80:bdf1132a57cf 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 80:bdf1132a57cf 13 * See the License for the specific language governing permissions and
mbed_official 80:bdf1132a57cf 14 * limitations under the License.
mbed_official 80:bdf1132a57cf 15 */
mbed_official 80:bdf1132a57cf 16 #ifndef MBED_PINNAMES_H
mbed_official 80:bdf1132a57cf 17 #define MBED_PINNAMES_H
mbed_official 80:bdf1132a57cf 18
mbed_official 80:bdf1132a57cf 19 #include "cmsis.h"
mbed_official 80:bdf1132a57cf 20
mbed_official 80:bdf1132a57cf 21 #ifdef __cplusplus
mbed_official 80:bdf1132a57cf 22 extern "C" {
mbed_official 80:bdf1132a57cf 23 #endif
mbed_official 80:bdf1132a57cf 24
mbed_official 80:bdf1132a57cf 25 typedef enum {
mbed_official 80:bdf1132a57cf 26 PIN_INPUT,
mbed_official 80:bdf1132a57cf 27 PIN_OUTPUT
mbed_official 80:bdf1132a57cf 28 } PinDirection;
mbed_official 80:bdf1132a57cf 29
mbed_official 80:bdf1132a57cf 30 #define PORT_SHIFT 5
mbed_official 80:bdf1132a57cf 31
mbed_official 80:bdf1132a57cf 32 typedef enum {
mbed_official 80:bdf1132a57cf 33 // MPS2 EXP Pin Names
mbed_official 80:bdf1132a57cf 34 EXP0 = 0 ,
mbed_official 80:bdf1132a57cf 35 EXP1 = 4 ,
mbed_official 80:bdf1132a57cf 36 EXP2 = 2 ,
mbed_official 80:bdf1132a57cf 37 EXP3 = 3 ,
mbed_official 80:bdf1132a57cf 38 EXP4 = 1 ,
mbed_official 80:bdf1132a57cf 39 EXP5 = 15,
mbed_official 80:bdf1132a57cf 40 EXP6 = 5 ,
mbed_official 80:bdf1132a57cf 41 EXP7 = 6 ,
mbed_official 80:bdf1132a57cf 42 EXP8 = 7 ,
mbed_official 80:bdf1132a57cf 43 EXP9 = 8 ,
mbed_official 80:bdf1132a57cf 44 EXP10 =9 ,
mbed_official 80:bdf1132a57cf 45 EXP11 =13,
mbed_official 80:bdf1132a57cf 46 EXP12 =10,
mbed_official 80:bdf1132a57cf 47 EXP13 =11,
mbed_official 80:bdf1132a57cf 48 EXP14 =12,
mbed_official 80:bdf1132a57cf 49 EXP15 =14,
mbed_official 80:bdf1132a57cf 50 EXP16 =18,
mbed_official 80:bdf1132a57cf 51 EXP17 =19,
mbed_official 80:bdf1132a57cf 52 EXP18 =20,
mbed_official 80:bdf1132a57cf 53 EXP19 =21,
mbed_official 80:bdf1132a57cf 54 EXP20 =52,
mbed_official 80:bdf1132a57cf 55 EXP21 =53,
mbed_official 80:bdf1132a57cf 56 EXP22 =54,
mbed_official 80:bdf1132a57cf 57 EXP23 =55,
mbed_official 80:bdf1132a57cf 58 EXP24 =56,
mbed_official 80:bdf1132a57cf 59 EXP25 =57,
mbed_official 80:bdf1132a57cf 60
mbed_official 80:bdf1132a57cf 61 EXP26 =16,
mbed_official 80:bdf1132a57cf 62 EXP27 =25,
mbed_official 80:bdf1132a57cf 63 EXP28 =24,
mbed_official 80:bdf1132a57cf 64 EXP29 =31,
mbed_official 80:bdf1132a57cf 65 EXP30 =17,
mbed_official 80:bdf1132a57cf 66 EXP31 =23,
mbed_official 80:bdf1132a57cf 67 EXP32 =27,
mbed_official 80:bdf1132a57cf 68 EXP33 =30,
mbed_official 80:bdf1132a57cf 69 EXP34 =26,
mbed_official 80:bdf1132a57cf 70 EXP35 =28,
mbed_official 80:bdf1132a57cf 71 EXP36 =29,
mbed_official 80:bdf1132a57cf 72 EXP37 =58,
mbed_official 80:bdf1132a57cf 73 EXP38 =48,
mbed_official 80:bdf1132a57cf 74 EXP39 =49,
mbed_official 80:bdf1132a57cf 75 EXP40 =50,
mbed_official 80:bdf1132a57cf 76 EXP41 =22,
mbed_official 80:bdf1132a57cf 77 EXP42 =59,
mbed_official 80:bdf1132a57cf 78 EXP43 =60,
mbed_official 80:bdf1132a57cf 79 EXP44 =51,
mbed_official 80:bdf1132a57cf 80 EXP45 =61,
mbed_official 80:bdf1132a57cf 81 EXP46 =62,
mbed_official 80:bdf1132a57cf 82 EXP47 =63,
mbed_official 80:bdf1132a57cf 83 EXP48 =64,
mbed_official 80:bdf1132a57cf 84 EXP49 =65,
mbed_official 80:bdf1132a57cf 85 EXP50 =66,
mbed_official 80:bdf1132a57cf 86 EXP51 =67,
mbed_official 80:bdf1132a57cf 87
mbed_official 80:bdf1132a57cf 88 // Other mbed Pin Names
mbed_official 80:bdf1132a57cf 89
mbed_official 80:bdf1132a57cf 90 //LEDs on mps2
mbed_official 80:bdf1132a57cf 91 //user leds
mbed_official 80:bdf1132a57cf 92 USERLED1 = 100,
mbed_official 80:bdf1132a57cf 93 USERLED2 = 101,
mbed_official 80:bdf1132a57cf 94 //user switches
mbed_official 80:bdf1132a57cf 95 USERSW1 = 110,
mbed_official 80:bdf1132a57cf 96 USERSW2 = 111,
mbed_official 80:bdf1132a57cf 97
mbed_official 80:bdf1132a57cf 98 //mcc leds
mbed_official 80:bdf1132a57cf 99 LED1 = 200,
mbed_official 80:bdf1132a57cf 100 LED2 = 201,
mbed_official 80:bdf1132a57cf 101 LED3 = 202,
mbed_official 80:bdf1132a57cf 102 LED4 = 203,
mbed_official 80:bdf1132a57cf 103 LED5 = 204,
mbed_official 80:bdf1132a57cf 104 LED6 = 205,
mbed_official 80:bdf1132a57cf 105 LED7 = 206,
mbed_official 80:bdf1132a57cf 106 LED8 = 207,
mbed_official 80:bdf1132a57cf 107
mbed_official 80:bdf1132a57cf 108 //MCC Switches
mbed_official 80:bdf1132a57cf 109 SW1 = 210,
mbed_official 80:bdf1132a57cf 110 SW2 = 211,
mbed_official 80:bdf1132a57cf 111 SW3 = 212,
mbed_official 80:bdf1132a57cf 112 SW4 = 213,
mbed_official 80:bdf1132a57cf 113 SW5 = 214,
mbed_official 80:bdf1132a57cf 114 SW6 = 215,
mbed_official 80:bdf1132a57cf 115 SW7 = 216,
mbed_official 80:bdf1132a57cf 116 SW8 = 217,
mbed_official 80:bdf1132a57cf 117
mbed_official 80:bdf1132a57cf 118 //MPS2 SPI header pins j21
mbed_official 80:bdf1132a57cf 119 MOSI_SPI = 300,
mbed_official 80:bdf1132a57cf 120 MISO_SPI = 301,
mbed_official 80:bdf1132a57cf 121 SCLK_SPI = 302,
mbed_official 80:bdf1132a57cf 122 SSEL_SPI = 303,
mbed_official 80:bdf1132a57cf 123
mbed_official 80:bdf1132a57cf 124 //MPS2 CLCD SPI
mbed_official 80:bdf1132a57cf 125 CLCD_MOSI = 304,
mbed_official 80:bdf1132a57cf 126 CLCD_MISO = 305,
mbed_official 80:bdf1132a57cf 127 CLCD_SCLK = 306,
mbed_official 80:bdf1132a57cf 128 CLCD_SSEL = 307,
mbed_official 80:bdf1132a57cf 129 CLCD_RESET = 308,
mbed_official 80:bdf1132a57cf 130 CLCD_RS = 309,
mbed_official 80:bdf1132a57cf 131 CLCD_RD = 310,
mbed_official 80:bdf1132a57cf 132 CLCD_BL_CTRL = 311,
mbed_official 80:bdf1132a57cf 133
mbed_official 80:bdf1132a57cf 134 //MPS2 shield 0 SPI
mbed_official 80:bdf1132a57cf 135 SHIELD_0_SPI_SCK = 320,
mbed_official 80:bdf1132a57cf 136 SHIELD_0_SPI_MOSI = 321,
mbed_official 80:bdf1132a57cf 137 SHIELD_0_SPI_MISO = 322,
mbed_official 80:bdf1132a57cf 138 SHIELD_0_SPI_nCS = 323,
mbed_official 80:bdf1132a57cf 139
mbed_official 80:bdf1132a57cf 140 //MPS2 shield 1 SPI
mbed_official 80:bdf1132a57cf 141 SHIELD_1_SPI_SCK = 331,
mbed_official 80:bdf1132a57cf 142 SHIELD_1_SPI_MOSI = 332,
mbed_official 80:bdf1132a57cf 143 SHIELD_1_SPI_MISO = 333,
mbed_official 80:bdf1132a57cf 144 SHIELD_1_SPI_nCS = 334,
mbed_official 80:bdf1132a57cf 145
mbed_official 80:bdf1132a57cf 146 //MPS2 shield ADC SPI
mbed_official 80:bdf1132a57cf 147 ADC_MOSI = 650,
mbed_official 80:bdf1132a57cf 148 ADC_MISO = 651,
mbed_official 80:bdf1132a57cf 149 ADC_SCLK = 652,
mbed_official 80:bdf1132a57cf 150 ADC_SSEL = 653,
mbed_official 80:bdf1132a57cf 151
mbed_official 80:bdf1132a57cf 152 //MPS2 Uart
mbed_official 80:bdf1132a57cf 153 USBTX = 400,
mbed_official 80:bdf1132a57cf 154 USBRX = 401,
mbed_official 80:bdf1132a57cf 155 XB_TX = 402,
mbed_official 80:bdf1132a57cf 156 XB_RX = 403,
mbed_official 80:bdf1132a57cf 157 SH0_TX = 404,
mbed_official 80:bdf1132a57cf 158 SH0_RX = 405,
mbed_official 80:bdf1132a57cf 159 SH1_TX = 406,
mbed_official 80:bdf1132a57cf 160 SH1_RX = 407,
mbed_official 80:bdf1132a57cf 161
mbed_official 80:bdf1132a57cf 162 //MPS2 I2C touchscreen and audio
mbed_official 80:bdf1132a57cf 163 TSC_SDA = 500,
mbed_official 80:bdf1132a57cf 164 TSC_SCL = 501,
mbed_official 80:bdf1132a57cf 165 AUD_SDA = 502,
mbed_official 80:bdf1132a57cf 166 AUD_SCL = 503,
mbed_official 80:bdf1132a57cf 167
mbed_official 80:bdf1132a57cf 168 //MPS2 I2C for shield
mbed_official 80:bdf1132a57cf 169 SHIELD_0_SDA = 504,
mbed_official 80:bdf1132a57cf 170 SHIELD_0_SCL = 505,
mbed_official 80:bdf1132a57cf 171 SHIELD_1_SDA = 506,
mbed_official 80:bdf1132a57cf 172 SHIELD_1_SCL = 507,
mbed_official 80:bdf1132a57cf 173
mbed_official 80:bdf1132a57cf 174 //MPS2 shield Analog pins
mbed_official 80:bdf1132a57cf 175 A0_0 = 600,
mbed_official 80:bdf1132a57cf 176 A0_1 = 601,
mbed_official 80:bdf1132a57cf 177 A0_2 = 602,
mbed_official 80:bdf1132a57cf 178 A0_3 = 603,
mbed_official 80:bdf1132a57cf 179 A0_4 = 604,
mbed_official 80:bdf1132a57cf 180 A0_5 = 605,
mbed_official 80:bdf1132a57cf 181 A1_0 = 606,
mbed_official 80:bdf1132a57cf 182 A1_1 = 607,
mbed_official 80:bdf1132a57cf 183 A1_2 = 608,
mbed_official 80:bdf1132a57cf 184 A1_3 = 609,
mbed_official 80:bdf1132a57cf 185 A1_4 = 610,
mbed_official 80:bdf1132a57cf 186 A1_5 = 611,
mbed_official 80:bdf1132a57cf 187 //MPS2 Shield Digital pins
mbed_official 80:bdf1132a57cf 188 D0_0 = EXP0,
mbed_official 80:bdf1132a57cf 189 D0_1 = EXP4,
mbed_official 80:bdf1132a57cf 190 D0_2 = EXP2,
mbed_official 80:bdf1132a57cf 191 D0_3 = EXP3,
mbed_official 80:bdf1132a57cf 192 D0_4 = EXP1,
mbed_official 80:bdf1132a57cf 193 D0_5 = EXP6,
mbed_official 80:bdf1132a57cf 194 D0_6 = EXP7,
mbed_official 80:bdf1132a57cf 195 D0_7 = EXP8,
mbed_official 80:bdf1132a57cf 196 D0_8 = EXP9,
mbed_official 80:bdf1132a57cf 197 D0_9 = EXP10,
mbed_official 80:bdf1132a57cf 198 D0_10 = EXP12,
mbed_official 80:bdf1132a57cf 199 D0_11 = EXP13,
mbed_official 80:bdf1132a57cf 200 D0_12 = EXP14,
mbed_official 80:bdf1132a57cf 201 D0_13 = EXP11,
mbed_official 80:bdf1132a57cf 202 D0_14 = EXP15,
mbed_official 80:bdf1132a57cf 203 D0_15 = EXP5,
mbed_official 80:bdf1132a57cf 204
mbed_official 80:bdf1132a57cf 205 D1_0 = EXP26,
mbed_official 80:bdf1132a57cf 206 D1_1 = EXP30,
mbed_official 80:bdf1132a57cf 207 D1_2 = EXP28,
mbed_official 80:bdf1132a57cf 208 D1_3 = EXP29,
mbed_official 80:bdf1132a57cf 209 D1_4 = EXP27,
mbed_official 80:bdf1132a57cf 210 D1_5 = EXP32,
mbed_official 80:bdf1132a57cf 211 D1_6 = EXP33,
mbed_official 80:bdf1132a57cf 212 D1_7 = EXP34,
mbed_official 80:bdf1132a57cf 213 D1_8 = EXP35,
mbed_official 80:bdf1132a57cf 214 D1_9 = EXP36,
mbed_official 80:bdf1132a57cf 215 D1_10 = EXP38,
mbed_official 80:bdf1132a57cf 216 D1_11 = EXP39,
mbed_official 80:bdf1132a57cf 217 D1_12 = EXP40,
mbed_official 80:bdf1132a57cf 218 D1_13 = EXP44,
mbed_official 80:bdf1132a57cf 219 D1_14 = EXP41,
mbed_official 80:bdf1132a57cf 220 D1_15 = EXP31,
mbed_official 80:bdf1132a57cf 221
mbed_official 80:bdf1132a57cf 222 // Not connected
mbed_official 80:bdf1132a57cf 223 NC = (int)0xFFFFFFFF,
mbed_official 80:bdf1132a57cf 224 } PinName;
mbed_official 80:bdf1132a57cf 225
mbed_official 80:bdf1132a57cf 226
mbed_official 80:bdf1132a57cf 227 typedef enum {
mbed_official 80:bdf1132a57cf 228 PullUp = 2,
mbed_official 80:bdf1132a57cf 229 PullDown = 1,
mbed_official 80:bdf1132a57cf 230 PullNone = 0,
mbed_official 80:bdf1132a57cf 231 Repeater = 3,
mbed_official 80:bdf1132a57cf 232 OpenDrain = 4,
mbed_official 80:bdf1132a57cf 233 PullDefault = PullDown
mbed_official 80:bdf1132a57cf 234 } PinMode;
mbed_official 80:bdf1132a57cf 235
mbed_official 80:bdf1132a57cf 236 #ifdef __cplusplus
mbed_official 80:bdf1132a57cf 237 }
mbed_official 80:bdf1132a57cf 238 #endif
mbed_official 80:bdf1132a57cf 239
mbed_official 80:bdf1132a57cf 240 #endif
mbed_official 80:bdf1132a57cf 241