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:
164:289d4deac6e4
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
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file PinNames.h
<> 149:156823d33999 4 * @brief Implements common PIN names for peripherals.
<> 149:156823d33999 5 * @internal
<> 149:156823d33999 6 * @author ON Semiconductor
<> 149:156823d33999 7 * $Rev: 0.1 $
<> 149:156823d33999 8 * $Date: 2015-11-06 $
<> 149:156823d33999 9 ******************************************************************************
<> 149:156823d33999 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
<> 149:156823d33999 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
<> 149:156823d33999 12 * under limited terms and conditions. The terms and conditions pertaining to the software
<> 149:156823d33999 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
<> 149:156823d33999 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
<> 149:156823d33999 15 * if applicable the software license agreement. Do not use this software and/or
<> 149:156823d33999 16 * documentation unless you have carefully read and you agree to the limited terms and
<> 149:156823d33999 17 * conditions. By using this software and/or documentation, you agree to the limited
<> 149:156823d33999 18 * terms and conditions.
<> 149:156823d33999 19 *
<> 149:156823d33999 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
<> 149:156823d33999 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
<> 149:156823d33999 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
<> 149:156823d33999 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
<> 149:156823d33999 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
<> 149:156823d33999 25 * @endinternal
<> 149:156823d33999 26 *
<> 149:156823d33999 27 * @ingroup debug
<> 149:156823d33999 28 */
<> 149:156823d33999 29
<> 149:156823d33999 30
<> 149:156823d33999 31 #ifndef PINNAME_H_
<> 149:156823d33999 32 #define PINNAME_H_
<> 149:156823d33999 33
<> 149:156823d33999 34 #include "types.h"
<> 149:156823d33999 35 #ifdef __cplusplus
<> 149:156823d33999 36 extern "C" {
<> 149:156823d33999 37 #endif
<> 149:156823d33999 38
<> 149:156823d33999 39 typedef enum {
<> 161:2cc1468da177 40 NC = (int)0xFFFFFFFF,
<> 149:156823d33999 41 GPIO0 = 0,
<> 149:156823d33999 42 GPIO1,
<> 149:156823d33999 43 GPIO2,
<> 149:156823d33999 44 GPIO3,
<> 149:156823d33999 45 GPIO4,
<> 149:156823d33999 46 GPIO5,
<> 149:156823d33999 47 GPIO6,
<> 149:156823d33999 48 GPIO7,
<> 149:156823d33999 49 GPIO8,
<> 149:156823d33999 50 GPIO9,
<> 149:156823d33999 51 GPIO10,
<> 149:156823d33999 52 GPIO11,
<> 149:156823d33999 53 GPIO12,
<> 149:156823d33999 54 GPIO13,
<> 149:156823d33999 55 GPIO14,
<> 149:156823d33999 56 GPIO15,
<> 149:156823d33999 57 GPIO16,
<> 149:156823d33999 58 GPIO17,
<> 149:156823d33999 59 A0,
<> 149:156823d33999 60 A1,
<> 149:156823d33999 61 A2,
<> 149:156823d33999 62 A3,
<> 161:2cc1468da177 63 A4 = NC,
<> 161:2cc1468da177 64 A5 = NC,
<> 149:156823d33999 65 UART1_TX = GPIO0,
<> 149:156823d33999 66 UART1_RX = GPIO1,
<> 149:156823d33999 67 UART2_TX = GPIO8,
<> 149:156823d33999 68 UART2_RX = GPIO9,
<> 149:156823d33999 69
<> 149:156823d33999 70 I2C1_SCLK_1 = GPIO2,
<> 149:156823d33999 71 I2C1_SDATA_1 = GPIO3,
<> 149:156823d33999 72 I2C1_SCLK_2 = GPIO5,
<> 149:156823d33999 73 I2C1_SDATA_2 = GPIO4,
<> 149:156823d33999 74 I2C1_SCLK = I2C1_SCLK_1, /*Default*/
<> 149:156823d33999 75 I2C1_SDATA = I2C1_SDATA_1, /*Default*/
<> 149:156823d33999 76
<> 149:156823d33999 77 I2C2_SCLK_1 = GPIO14,
<> 149:156823d33999 78 I2C2_SDATA_1 = GPIO15,
<> 149:156823d33999 79 I2C2_SCLK_2 = GPIO17,
<> 149:156823d33999 80 I2C2_SDATA_2 = GPIO16,
<> 149:156823d33999 81 I2C2_SCLK = I2C2_SCLK_2, /*Default*/
<> 149:156823d33999 82 I2C2_SDATA = I2C2_SDATA_2, /*Default*/
<> 149:156823d33999 83 I2C_SCL = I2C1_SCLK_1, /*Default*/
<> 149:156823d33999 84 I2C_SDA = I2C1_SDATA_1, /*Default*/
<> 149:156823d33999 85
<> 149:156823d33999 86 /* SPI 1 with 1st set of CROSS BAR */
<> 149:156823d33999 87 SPI1_SSNO0_1 = GPIO0,
<> 149:156823d33999 88 SPI1_SSNO1_1 = GPIO1,
<> 149:156823d33999 89 SPI1_SSNO2_1 = GPIO2,
<> 149:156823d33999 90 SPI1_SSNO3_1 = GPIO3,
<> 149:156823d33999 91
<> 149:156823d33999 92 /* SPI 1 with 2st set of CROSS BAR */
<> 149:156823d33999 93 SPI1_SCLK_2 = GPIO4,
<> 149:156823d33999 94 SPI1_SDATAO_2 = GPIO5,
<> 149:156823d33999 95 SPI1_SDATAI_2 = GPIO6,
<> 149:156823d33999 96 SPI1_SSNI_2 = GPIO7,
<> 149:156823d33999 97 SPI1_SSNO0_2 = GPIO8,
<> 149:156823d33999 98 SPI1_SSNO1_2 = GPIO9,
<> 149:156823d33999 99 SPI1_SSNO2_2 = GPIO10,
<> 149:156823d33999 100
<> 149:156823d33999 101 SPI1_SCLK = SPI1_SCLK_2, /*Default*/
<> 149:156823d33999 102 SPI1_SDATAO = SPI1_SDATAO_2, /*Default*/
<> 149:156823d33999 103 SPI1_SDATAI = SPI1_SDATAI_2, /*Default*/
<> 149:156823d33999 104 SPI1_SSNI = SPI1_SSNI_2, /*Default*/
<> 149:156823d33999 105 SPI1_SSNO0 = SPI1_SSNO0_2, /*Default*/
<> 149:156823d33999 106 SPI1_SSNO1 = SPI1_SSNO1_2, /*Default*/
<> 149:156823d33999 107 SPI1_SSNO2 = SPI1_SSNO2_2, /*Default*/
<> 149:156823d33999 108
<> 149:156823d33999 109 /* SPI 1 with 3rd set of CROSS BAR */
<> 149:156823d33999 110 SPI1_SCLK_3 = GPIO8,
<> 149:156823d33999 111 SPI1_SDATAO_3 = GPIO9,
<> 149:156823d33999 112 SPI1_SDATAI_3 = GPIO10,
<> 149:156823d33999 113
<> 149:156823d33999 114 /* SPI 2 */
<> 149:156823d33999 115 SPI2_SCLK = GPIO14,
<> 149:156823d33999 116 SPI2_SDATAO = GPIO15,
<> 149:156823d33999 117 SPI2_SDATAI = GPIO16,
<> 149:156823d33999 118 SPI2_SSNI = GPIO17,
<> 149:156823d33999 119 SPI2_SSNO0 = GPIO17,
<> 149:156823d33999 120
<> 149:156823d33999 121 // Generic signals namings
<> 149:156823d33999 122 LED1 = GPIO4,
<> 149:156823d33999 123 LED2 = GPIO6,
<> 149:156823d33999 124 LED3 = GPIO5,
<> 149:156823d33999 125 LED4 = (int)0xFFFFFFFF,
<> 149:156823d33999 126 LED5 = (int)0xFFFFFFFF,
<> 149:156823d33999 127 LED_GREEN = GPIO4,
<> 149:156823d33999 128 LED_YELLOW = GPIO6,
<> 149:156823d33999 129 LED_BLUE = GPIO5,
<> 149:156823d33999 130 USER_BUTTON = GPIO7, /*NEW connection on NCS36510-RF Rev 1.1 - Alias of SW1 */
Anna Bridge 164:289d4deac6e4 131
<> 149:156823d33999 132 SW1 = GPIO7, /*NEW connection on NCS36510-RF Rev 1.1 */
<> 149:156823d33999 133 SW2 = GPIO10, /*NEW connection on NCS36510-RF Rev 1.1 */
Anna Bridge 164:289d4deac6e4 134
Anna Bridge 164:289d4deac6e4 135 // Standardized button names
Anna Bridge 164:289d4deac6e4 136 BUTTON1 = SW1,
Anna Bridge 164:289d4deac6e4 137 BUTTON2 = SW2,
Anna Bridge 164:289d4deac6e4 138
<> 149:156823d33999 139 SERIAL_TX = GPIO0,
<> 149:156823d33999 140 SERIAL_RX = GPIO1,
<> 149:156823d33999 141 USBTX = GPIO0,
<> 149:156823d33999 142 USBRX = GPIO1,
<> 149:156823d33999 143 D0 = GPIO9,
<> 149:156823d33999 144 D1 = GPIO8,
<> 149:156823d33999 145 D2 = GPIO4,
<> 149:156823d33999 146 D3 = GPIO6,
<> 149:156823d33999 147 D4 = GPIO5,
<> 149:156823d33999 148 D5 = GPIO7,
<> 149:156823d33999 149 D6 = GPIO10,
<> 149:156823d33999 150 D7 = (int)0xFFFFFFFF,
<> 149:156823d33999 151 D8 = (int)0xFFFFFFFF,
<> 149:156823d33999 152 D9 = (int)0xFFFFFFFF,
<> 149:156823d33999 153 D10 = GPIO17,
<> 149:156823d33999 154 D11 = GPIO15,
<> 149:156823d33999 155 D12 = GPIO16,
<> 149:156823d33999 156 D13 = GPIO14,
<> 149:156823d33999 157 D14 = GPIO3,
<> 161:2cc1468da177 158 D15 = GPIO2
<> 149:156823d33999 159 } PinName;
<> 149:156823d33999 160
<> 149:156823d33999 161 typedef enum {
<> 149:156823d33999 162 PIN_INPUT,
<> 149:156823d33999 163 PIN_OUTPUT,
<> 149:156823d33999 164
<> 149:156823d33999 165 } PinDirection;
<> 149:156823d33999 166
<> 149:156823d33999 167 typedef enum {
<> 149:156823d33999 168 PushPullPullDown = 0,
<> 149:156823d33999 169 PushPullNoPull = 1,
<> 149:156823d33999 170 PushPullPullUp = 2,
<> 149:156823d33999 171 OpenDrainPullDown = 3,
<> 149:156823d33999 172 OpenDrainNoPull = 4,
<> 149:156823d33999 173 OpenDrainPullUp = 5,
<> 149:156823d33999 174 PullNone = PushPullNoPull,
<> 149:156823d33999 175 PullUp = PushPullPullUp,
<> 149:156823d33999 176 PullDown = PushPullPullDown,
<> 149:156823d33999 177 OpenDrain = OpenDrainPullUp,
<> 149:156823d33999 178 PullDefault = PullNone
<> 149:156823d33999 179
<> 149:156823d33999 180 } PinMode;
<> 149:156823d33999 181
<> 149:156823d33999 182 #ifdef __cplusplus
<> 149:156823d33999 183 }
<> 149:156823d33999 184 #endif
<> 149:156823d33999 185
<> 149:156823d33999 186 #endif //PINNAME_H_