This is a RTC additional function. This is only for Nucleo F401RE & F411RE mbed(Added L152RE, F334R8, L476RG & F746xx). If you connected battery backup circuit for internal RTC, you can make a power-off and reset condition. RTC still has proper time and date.
Dependents: Nucleo_rtos_sample PB_Emma_Ethernet
Please refer following NOTE information.
/users/kenjiArai/notebook/nucleo-series-rtc-control-under-power-onoff-and-re/
SetRTC.cpp@5:1a8e7aed053d, 2015-02-18 (annotated)
- Committer:
- kenjiArai
- Date:
- Wed Feb 18 09:14:28 2015 +0000
- Revision:
- 5:1a8e7aed053d
- Parent:
- 2:765470eab2a6
- Child:
- 6:ef7d2c83034d
Only for L152RE, change Deep sleep mode to Standby mode to reduce backup current
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:e4c20fd769f1 | 1 | /* |
kenjiArai | 0:e4c20fd769f1 | 2 | * mbed Library program |
kenjiArai | 0:e4c20fd769f1 | 3 | * Check & set RTC function and set proper clock if we can set |
kenjiArai | 0:e4c20fd769f1 | 4 | * ONLY FOR "Nucleo Board" |
kenjiArai | 0:e4c20fd769f1 | 5 | * |
kenjiArai | 0:e4c20fd769f1 | 6 | * Copyright (c) 2014-2015 Kenji Arai / JH1PJL |
kenjiArai | 0:e4c20fd769f1 | 7 | * http://www.page.sannet.ne.jp/kenjia/index.html |
kenjiArai | 0:e4c20fd769f1 | 8 | * http://mbed.org/users/kenjiArai/ |
kenjiArai | 0:e4c20fd769f1 | 9 | * Created: October 24th, 2014 |
kenjiArai | 5:1a8e7aed053d | 10 | * Revised: Feburary 18th, 2015 |
kenjiArai | 0:e4c20fd769f1 | 11 | * |
kenjiArai | 0:e4c20fd769f1 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
kenjiArai | 0:e4c20fd769f1 | 13 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
kenjiArai | 0:e4c20fd769f1 | 14 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kenjiArai | 0:e4c20fd769f1 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kenjiArai | 0:e4c20fd769f1 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kenjiArai | 0:e4c20fd769f1 | 17 | */ |
kenjiArai | 0:e4c20fd769f1 | 18 | |
kenjiArai | 0:e4c20fd769f1 | 19 | #if defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_L152RE) |
kenjiArai | 0:e4c20fd769f1 | 20 | |
kenjiArai | 0:e4c20fd769f1 | 21 | //#define DEBUG // use Communication with PC(UART) |
kenjiArai | 0:e4c20fd769f1 | 22 | |
kenjiArai | 0:e4c20fd769f1 | 23 | // Include --------------------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 24 | #include "mbed.h" |
kenjiArai | 0:e4c20fd769f1 | 25 | #include "SetRTC.h" |
kenjiArai | 0:e4c20fd769f1 | 26 | |
kenjiArai | 0:e4c20fd769f1 | 27 | // Definition ------------------------------------------------------------------------------------ |
kenjiArai | 0:e4c20fd769f1 | 28 | #ifdef DEBUG |
kenjiArai | 0:e4c20fd769f1 | 29 | #define BAUD(x) pcr.baud(x) |
kenjiArai | 0:e4c20fd769f1 | 30 | #define GETC(x) pcr.getc(x) |
kenjiArai | 0:e4c20fd769f1 | 31 | #define PUTC(x) pcr.putc(x) |
kenjiArai | 0:e4c20fd769f1 | 32 | #define PRINTF(...) pcr.printf(__VA_ARGS__) |
kenjiArai | 0:e4c20fd769f1 | 33 | #define READABLE(x) pcr.readable(x) |
kenjiArai | 0:e4c20fd769f1 | 34 | #else |
kenjiArai | 0:e4c20fd769f1 | 35 | #define BAUD(x) {;} |
kenjiArai | 0:e4c20fd769f1 | 36 | #define GETC(x) {;} |
kenjiArai | 0:e4c20fd769f1 | 37 | #define PUTC(x) {;} |
kenjiArai | 0:e4c20fd769f1 | 38 | #define PRINTF(...) {;} |
kenjiArai | 0:e4c20fd769f1 | 39 | #define READABLE(x) {;} |
kenjiArai | 0:e4c20fd769f1 | 40 | #endif |
kenjiArai | 0:e4c20fd769f1 | 41 | |
kenjiArai | 0:e4c20fd769f1 | 42 | // Object ---------------------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 43 | Serial pcr(USBTX, USBRX); |
kenjiArai | 0:e4c20fd769f1 | 44 | |
kenjiArai | 0:e4c20fd769f1 | 45 | // RAM ------------------------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 46 | |
kenjiArai | 0:e4c20fd769f1 | 47 | // ROM / Constant data --------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 48 | |
kenjiArai | 0:e4c20fd769f1 | 49 | // Function prototypes --------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 50 | static int32_t set_RTC_LSI(void); |
kenjiArai | 0:e4c20fd769f1 | 51 | static int32_t set_RTC_LSE(void); |
kenjiArai | 0:e4c20fd769f1 | 52 | static int32_t rtc_external_osc_init(void); |
kenjiArai | 0:e4c20fd769f1 | 53 | static uint32_t read_RTC_reg(uint32_t RTC_BKP_DR); |
kenjiArai | 0:e4c20fd769f1 | 54 | static uint32_t check_RTC_backup_reg( void ); |
kenjiArai | 0:e4c20fd769f1 | 55 | static int xatoi (char **str, unsigned long *res); |
kenjiArai | 0:e4c20fd769f1 | 56 | static void get_line (char *buff, int len); |
kenjiArai | 2:765470eab2a6 | 57 | static void set_5v_drop_detect(void); |
kenjiArai | 0:e4c20fd769f1 | 58 | |
kenjiArai | 0:e4c20fd769f1 | 59 | //------------------------------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 60 | // Control Program |
kenjiArai | 0:e4c20fd769f1 | 61 | //------------------------------------------------------------------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 62 | int32_t SetRTC() |
kenjiArai | 0:e4c20fd769f1 | 63 | { |
kenjiArai | 0:e4c20fd769f1 | 64 | if (rtc_external_osc_init() == OK) { |
kenjiArai | 2:765470eab2a6 | 65 | set_5v_drop_detect(); |
kenjiArai | 0:e4c20fd769f1 | 66 | return OK; |
kenjiArai | 0:e4c20fd769f1 | 67 | } else { |
kenjiArai | 0:e4c20fd769f1 | 68 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 69 | } |
kenjiArai | 0:e4c20fd769f1 | 70 | } |
kenjiArai | 0:e4c20fd769f1 | 71 | |
kenjiArai | 0:e4c20fd769f1 | 72 | int32_t set_RTC_LSE(void) |
kenjiArai | 0:e4c20fd769f1 | 73 | { |
kenjiArai | 0:e4c20fd769f1 | 74 | uint32_t timeout = 0; |
kenjiArai | 0:e4c20fd769f1 | 75 | |
kenjiArai | 0:e4c20fd769f1 | 76 | //---------------------------- LSE Configuration ------------------------- |
kenjiArai | 0:e4c20fd769f1 | 77 | // Enable Power Clock |
kenjiArai | 0:e4c20fd769f1 | 78 | __PWR_CLK_ENABLE(); |
kenjiArai | 0:e4c20fd769f1 | 79 | // Enable write access to Backup domain |
kenjiArai | 0:e4c20fd769f1 | 80 | PWR->CR |= PWR_CR_DBP; |
kenjiArai | 0:e4c20fd769f1 | 81 | // Wait for Backup domain Write protection disable |
kenjiArai | 0:e4c20fd769f1 | 82 | timeout = HAL_GetTick() + DBP_TIMEOUT_VALUE; |
kenjiArai | 0:e4c20fd769f1 | 83 | while((PWR->CR & PWR_CR_DBP) == RESET) { |
kenjiArai | 0:e4c20fd769f1 | 84 | if(HAL_GetTick() >= timeout) { |
kenjiArai | 0:e4c20fd769f1 | 85 | PRINTF("Time-Out 1\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 86 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 87 | } |
kenjiArai | 0:e4c20fd769f1 | 88 | } |
kenjiArai | 0:e4c20fd769f1 | 89 | // Reset LSEON and LSEBYP bits before configuring the LSE ---------------- |
kenjiArai | 0:e4c20fd769f1 | 90 | __HAL_RCC_LSE_CONFIG(RCC_LSE_OFF); |
kenjiArai | 0:e4c20fd769f1 | 91 | // Get timeout |
kenjiArai | 0:e4c20fd769f1 | 92 | timeout = HAL_GetTick() + TIMEOUT; |
kenjiArai | 0:e4c20fd769f1 | 93 | // Wait till LSE is ready |
kenjiArai | 0:e4c20fd769f1 | 94 | while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) != RESET) { |
kenjiArai | 0:e4c20fd769f1 | 95 | if(HAL_GetTick() >= timeout) { |
kenjiArai | 0:e4c20fd769f1 | 96 | PRINTF("Time-Out 2\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 97 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 98 | } |
kenjiArai | 0:e4c20fd769f1 | 99 | } |
kenjiArai | 0:e4c20fd769f1 | 100 | // Set the new LSE configuration ----------------------------------------- |
kenjiArai | 0:e4c20fd769f1 | 101 | __HAL_RCC_LSE_CONFIG(RCC_LSE_ON); |
kenjiArai | 0:e4c20fd769f1 | 102 | // Get timeout |
kenjiArai | 0:e4c20fd769f1 | 103 | timeout = HAL_GetTick() + TIMEOUT; |
kenjiArai | 0:e4c20fd769f1 | 104 | // Wait till LSE is ready |
kenjiArai | 0:e4c20fd769f1 | 105 | while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET) { |
kenjiArai | 0:e4c20fd769f1 | 106 | if(HAL_GetTick() >= timeout) { |
kenjiArai | 0:e4c20fd769f1 | 107 | PRINTF("Time-Out 3\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 108 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 109 | } |
kenjiArai | 0:e4c20fd769f1 | 110 | } |
kenjiArai | 0:e4c20fd769f1 | 111 | PRINTF("OK"); |
kenjiArai | 0:e4c20fd769f1 | 112 | return OK; |
kenjiArai | 0:e4c20fd769f1 | 113 | } |
kenjiArai | 0:e4c20fd769f1 | 114 | |
kenjiArai | 0:e4c20fd769f1 | 115 | int32_t set_RTC_LSI(void) |
kenjiArai | 0:e4c20fd769f1 | 116 | { |
kenjiArai | 0:e4c20fd769f1 | 117 | uint32_t timeout = 0; |
kenjiArai | 0:e4c20fd769f1 | 118 | |
kenjiArai | 0:e4c20fd769f1 | 119 | // Enable Power clock |
kenjiArai | 0:e4c20fd769f1 | 120 | __PWR_CLK_ENABLE(); |
kenjiArai | 0:e4c20fd769f1 | 121 | // Enable access to Backup domain |
kenjiArai | 0:e4c20fd769f1 | 122 | HAL_PWR_EnableBkUpAccess(); |
kenjiArai | 0:e4c20fd769f1 | 123 | // Reset Backup domain |
kenjiArai | 0:e4c20fd769f1 | 124 | __HAL_RCC_BACKUPRESET_FORCE(); |
kenjiArai | 0:e4c20fd769f1 | 125 | __HAL_RCC_BACKUPRESET_RELEASE(); |
kenjiArai | 0:e4c20fd769f1 | 126 | // Enable Power Clock |
kenjiArai | 0:e4c20fd769f1 | 127 | __PWR_CLK_ENABLE(); |
kenjiArai | 0:e4c20fd769f1 | 128 | // Enable write access to Backup domain |
kenjiArai | 0:e4c20fd769f1 | 129 | PWR->CR |= PWR_CR_DBP; |
kenjiArai | 0:e4c20fd769f1 | 130 | // Wait for Backup domain Write protection disable |
kenjiArai | 0:e4c20fd769f1 | 131 | timeout = HAL_GetTick() + DBP_TIMEOUT_VALUE; |
kenjiArai | 0:e4c20fd769f1 | 132 | while((PWR->CR & PWR_CR_DBP) == RESET) { |
kenjiArai | 0:e4c20fd769f1 | 133 | if(HAL_GetTick() >= timeout) { |
kenjiArai | 0:e4c20fd769f1 | 134 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 135 | } |
kenjiArai | 0:e4c20fd769f1 | 136 | } |
kenjiArai | 0:e4c20fd769f1 | 137 | __HAL_RCC_LSE_CONFIG(RCC_LSE_OFF); |
kenjiArai | 0:e4c20fd769f1 | 138 | // Enable LSI |
kenjiArai | 0:e4c20fd769f1 | 139 | __HAL_RCC_LSI_ENABLE(); |
kenjiArai | 0:e4c20fd769f1 | 140 | timeout = HAL_GetTick() + TIMEOUT; |
kenjiArai | 0:e4c20fd769f1 | 141 | // Wait till LSI is ready |
kenjiArai | 0:e4c20fd769f1 | 142 | while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSIRDY) == RESET) { |
kenjiArai | 0:e4c20fd769f1 | 143 | if(HAL_GetTick() >= timeout) { |
kenjiArai | 0:e4c20fd769f1 | 144 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 145 | } |
kenjiArai | 0:e4c20fd769f1 | 146 | } |
kenjiArai | 0:e4c20fd769f1 | 147 | // Connect LSI to RTC |
kenjiArai | 0:e4c20fd769f1 | 148 | __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSI); |
kenjiArai | 0:e4c20fd769f1 | 149 | __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI); |
kenjiArai | 0:e4c20fd769f1 | 150 | return OK; |
kenjiArai | 0:e4c20fd769f1 | 151 | } |
kenjiArai | 0:e4c20fd769f1 | 152 | |
kenjiArai | 0:e4c20fd769f1 | 153 | int32_t rtc_external_osc_init(void) |
kenjiArai | 0:e4c20fd769f1 | 154 | { |
kenjiArai | 0:e4c20fd769f1 | 155 | // Enable Power clock |
kenjiArai | 0:e4c20fd769f1 | 156 | __PWR_CLK_ENABLE(); |
kenjiArai | 0:e4c20fd769f1 | 157 | // Enable access to Backup domain |
kenjiArai | 0:e4c20fd769f1 | 158 | HAL_PWR_EnableBkUpAccess(); |
kenjiArai | 0:e4c20fd769f1 | 159 | // Check backup condition |
kenjiArai | 0:e4c20fd769f1 | 160 | if ( check_RTC_backup_reg() ) { |
kenjiArai | 0:e4c20fd769f1 | 161 | return OK; |
kenjiArai | 0:e4c20fd769f1 | 162 | } else { |
kenjiArai | 0:e4c20fd769f1 | 163 | // Reset Backup domain |
kenjiArai | 0:e4c20fd769f1 | 164 | __HAL_RCC_BACKUPRESET_FORCE(); |
kenjiArai | 0:e4c20fd769f1 | 165 | __HAL_RCC_BACKUPRESET_RELEASE(); |
kenjiArai | 0:e4c20fd769f1 | 166 | // Enable LSE Oscillator |
kenjiArai | 0:e4c20fd769f1 | 167 | if (set_RTC_LSE() == OK) { |
kenjiArai | 0:e4c20fd769f1 | 168 | // Connect LSE to RTC |
kenjiArai | 0:e4c20fd769f1 | 169 | __HAL_RCC_RTC_CLKPRESCALER(RCC_RTCCLKSOURCE_LSE); |
kenjiArai | 0:e4c20fd769f1 | 170 | __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE); |
kenjiArai | 0:e4c20fd769f1 | 171 | return OK; |
kenjiArai | 0:e4c20fd769f1 | 172 | } else { |
kenjiArai | 0:e4c20fd769f1 | 173 | set_RTC_LSI(); |
kenjiArai | 0:e4c20fd769f1 | 174 | return NG; |
kenjiArai | 0:e4c20fd769f1 | 175 | } |
kenjiArai | 0:e4c20fd769f1 | 176 | } |
kenjiArai | 0:e4c20fd769f1 | 177 | } |
kenjiArai | 0:e4c20fd769f1 | 178 | |
kenjiArai | 0:e4c20fd769f1 | 179 | uint32_t read_RTC_reg(uint32_t RTC_BKP_DR) |
kenjiArai | 0:e4c20fd769f1 | 180 | { |
kenjiArai | 0:e4c20fd769f1 | 181 | __IO uint32_t tmp = 0; |
kenjiArai | 0:e4c20fd769f1 | 182 | |
kenjiArai | 0:e4c20fd769f1 | 183 | // Check the parameters |
kenjiArai | 0:e4c20fd769f1 | 184 | assert_param(IS_RTC_BKP(RTC_BKP_DR)); |
kenjiArai | 0:e4c20fd769f1 | 185 | tmp = RTC_BASE + 0x50; |
kenjiArai | 0:e4c20fd769f1 | 186 | tmp += (RTC_BKP_DR * 4); |
kenjiArai | 0:e4c20fd769f1 | 187 | // Read the specified register |
kenjiArai | 0:e4c20fd769f1 | 188 | return (*(__IO uint32_t *)tmp); |
kenjiArai | 0:e4c20fd769f1 | 189 | } |
kenjiArai | 0:e4c20fd769f1 | 190 | |
kenjiArai | 0:e4c20fd769f1 | 191 | // Check RTC Backup registers contents |
kenjiArai | 0:e4c20fd769f1 | 192 | uint32_t check_RTC_backup_reg( void ) |
kenjiArai | 0:e4c20fd769f1 | 193 | { |
kenjiArai | 0:e4c20fd769f1 | 194 | if ( read_RTC_reg( RTC_BKP_DR0 ) == RTC_DAT0 ) { |
kenjiArai | 0:e4c20fd769f1 | 195 | if ( read_RTC_reg( RTC_BKP_DR1 ) == RTC_DAT1 ) { |
kenjiArai | 0:e4c20fd769f1 | 196 | return 1; |
kenjiArai | 0:e4c20fd769f1 | 197 | } |
kenjiArai | 0:e4c20fd769f1 | 198 | } |
kenjiArai | 0:e4c20fd769f1 | 199 | return 0; |
kenjiArai | 0:e4c20fd769f1 | 200 | } |
kenjiArai | 0:e4c20fd769f1 | 201 | |
kenjiArai | 0:e4c20fd769f1 | 202 | void show_RTC_reg( void ) |
kenjiArai | 0:e4c20fd769f1 | 203 | { |
kenjiArai | 0:e4c20fd769f1 | 204 | // Show registers |
kenjiArai | 0:e4c20fd769f1 | 205 | pcr.printf( "\r\nShow RTC registers by JH1PJL\r\n" ); |
kenjiArai | 0:e4c20fd769f1 | 206 | pcr.printf( " Reg0 =0x%08x, Reg1 =0x%08x\r\n", |
kenjiArai | 0:e4c20fd769f1 | 207 | read_RTC_reg( RTC_BKP_DR0 ), |
kenjiArai | 0:e4c20fd769f1 | 208 | read_RTC_reg( RTC_BKP_DR1 ) |
kenjiArai | 0:e4c20fd769f1 | 209 | ); |
kenjiArai | 0:e4c20fd769f1 | 210 | pcr.printf( " TR =0x..%06x, DR =0x..%06x, CR =0x..%06x\r\n", |
kenjiArai | 0:e4c20fd769f1 | 211 | RTC->TR, RTC->DR, RTC->CR |
kenjiArai | 0:e4c20fd769f1 | 212 | ); |
kenjiArai | 0:e4c20fd769f1 | 213 | pcr.printf( " ISR =0x...%05x, PRER =0x..%06x, WUTR =0x....%04x\r\n", |
kenjiArai | 0:e4c20fd769f1 | 214 | RTC->ISR, RTC->PRER, RTC->WUTR |
kenjiArai | 0:e4c20fd769f1 | 215 | ); |
kenjiArai | 0:e4c20fd769f1 | 216 | pcr.printf( " CALIBR=0x....%04x, ALRMAR=0x%08x, ALRMBR=0x%08x\r\n", |
kenjiArai | 0:e4c20fd769f1 | 217 | RTC->CALIBR, RTC->ALRMAR, RTC->ALRMBR |
kenjiArai | 0:e4c20fd769f1 | 218 | ); |
kenjiArai | 0:e4c20fd769f1 | 219 | pcr.printf( |
kenjiArai | 0:e4c20fd769f1 | 220 | " WPR =0x......%02x, SSR =0x....%04x, SHIFTR=0x....%04x\r\n", |
kenjiArai | 0:e4c20fd769f1 | 221 | RTC->WPR, RTC->SSR, RTC->SHIFTR |
kenjiArai | 0:e4c20fd769f1 | 222 | ); |
kenjiArai | 0:e4c20fd769f1 | 223 | pcr.printf( |
kenjiArai | 0:e4c20fd769f1 | 224 | " TSTR =0x..%06x, TSDR =0x....%04x, TSSSR =0x....%04x\r\n\r\n", |
kenjiArai | 0:e4c20fd769f1 | 225 | RTC->TSTR, RTC->TSDR, RTC->TSSSR |
kenjiArai | 0:e4c20fd769f1 | 226 | ); |
kenjiArai | 0:e4c20fd769f1 | 227 | } |
kenjiArai | 0:e4c20fd769f1 | 228 | |
kenjiArai | 0:e4c20fd769f1 | 229 | // Change string -> integer |
kenjiArai | 0:e4c20fd769f1 | 230 | int xatoi (char **str, unsigned long *res) |
kenjiArai | 0:e4c20fd769f1 | 231 | { |
kenjiArai | 0:e4c20fd769f1 | 232 | unsigned long val; |
kenjiArai | 0:e4c20fd769f1 | 233 | unsigned char c, radix, s = 0; |
kenjiArai | 0:e4c20fd769f1 | 234 | |
kenjiArai | 0:e4c20fd769f1 | 235 | while ((c = **str) == ' ') (*str)++; |
kenjiArai | 0:e4c20fd769f1 | 236 | if (c == '-') { |
kenjiArai | 0:e4c20fd769f1 | 237 | s = 1; |
kenjiArai | 0:e4c20fd769f1 | 238 | c = *(++(*str)); |
kenjiArai | 0:e4c20fd769f1 | 239 | } |
kenjiArai | 0:e4c20fd769f1 | 240 | if (c == '0') { |
kenjiArai | 0:e4c20fd769f1 | 241 | c = *(++(*str)); |
kenjiArai | 0:e4c20fd769f1 | 242 | if (c <= ' ') { |
kenjiArai | 0:e4c20fd769f1 | 243 | *res = 0; |
kenjiArai | 0:e4c20fd769f1 | 244 | return 1; |
kenjiArai | 0:e4c20fd769f1 | 245 | } |
kenjiArai | 0:e4c20fd769f1 | 246 | if (c == 'x') { |
kenjiArai | 0:e4c20fd769f1 | 247 | radix = 16; |
kenjiArai | 0:e4c20fd769f1 | 248 | c = *(++(*str)); |
kenjiArai | 0:e4c20fd769f1 | 249 | } else { |
kenjiArai | 0:e4c20fd769f1 | 250 | if (c == 'b') { |
kenjiArai | 0:e4c20fd769f1 | 251 | radix = 2; |
kenjiArai | 0:e4c20fd769f1 | 252 | c = *(++(*str)); |
kenjiArai | 0:e4c20fd769f1 | 253 | } else { |
kenjiArai | 0:e4c20fd769f1 | 254 | if ((c >= '0')&&(c <= '9')) { |
kenjiArai | 0:e4c20fd769f1 | 255 | radix = 8; |
kenjiArai | 0:e4c20fd769f1 | 256 | } else { |
kenjiArai | 0:e4c20fd769f1 | 257 | return 0; |
kenjiArai | 0:e4c20fd769f1 | 258 | } |
kenjiArai | 0:e4c20fd769f1 | 259 | } |
kenjiArai | 0:e4c20fd769f1 | 260 | } |
kenjiArai | 0:e4c20fd769f1 | 261 | } else { |
kenjiArai | 0:e4c20fd769f1 | 262 | if ((c < '1')||(c > '9')) { |
kenjiArai | 0:e4c20fd769f1 | 263 | return 0; |
kenjiArai | 0:e4c20fd769f1 | 264 | } |
kenjiArai | 0:e4c20fd769f1 | 265 | radix = 10; |
kenjiArai | 0:e4c20fd769f1 | 266 | } |
kenjiArai | 0:e4c20fd769f1 | 267 | val = 0; |
kenjiArai | 0:e4c20fd769f1 | 268 | while (c > ' ') { |
kenjiArai | 0:e4c20fd769f1 | 269 | if (c >= 'a') c -= 0x20; |
kenjiArai | 0:e4c20fd769f1 | 270 | c -= '0'; |
kenjiArai | 0:e4c20fd769f1 | 271 | if (c >= 17) { |
kenjiArai | 0:e4c20fd769f1 | 272 | c -= 7; |
kenjiArai | 0:e4c20fd769f1 | 273 | if (c <= 9) return 0; |
kenjiArai | 0:e4c20fd769f1 | 274 | } |
kenjiArai | 0:e4c20fd769f1 | 275 | if (c >= radix) return 0; |
kenjiArai | 0:e4c20fd769f1 | 276 | val = val * radix + c; |
kenjiArai | 0:e4c20fd769f1 | 277 | c = *(++(*str)); |
kenjiArai | 0:e4c20fd769f1 | 278 | } |
kenjiArai | 0:e4c20fd769f1 | 279 | if (s) val = -val; |
kenjiArai | 0:e4c20fd769f1 | 280 | *res = val; |
kenjiArai | 0:e4c20fd769f1 | 281 | return 1; |
kenjiArai | 0:e4c20fd769f1 | 282 | } |
kenjiArai | 0:e4c20fd769f1 | 283 | |
kenjiArai | 0:e4c20fd769f1 | 284 | // Get key input data |
kenjiArai | 0:e4c20fd769f1 | 285 | void get_line (char *buff, int len) |
kenjiArai | 0:e4c20fd769f1 | 286 | { |
kenjiArai | 0:e4c20fd769f1 | 287 | char c; |
kenjiArai | 0:e4c20fd769f1 | 288 | int idx = 0; |
kenjiArai | 0:e4c20fd769f1 | 289 | |
kenjiArai | 0:e4c20fd769f1 | 290 | for (;;) { |
kenjiArai | 0:e4c20fd769f1 | 291 | c = pcr.getc(); |
kenjiArai | 0:e4c20fd769f1 | 292 | if (c == '\r') { |
kenjiArai | 0:e4c20fd769f1 | 293 | buff[idx++] = c; |
kenjiArai | 0:e4c20fd769f1 | 294 | break; |
kenjiArai | 0:e4c20fd769f1 | 295 | } |
kenjiArai | 0:e4c20fd769f1 | 296 | if ((c == '\b') && idx) { |
kenjiArai | 0:e4c20fd769f1 | 297 | idx--; |
kenjiArai | 0:e4c20fd769f1 | 298 | pcr.putc(c); |
kenjiArai | 0:e4c20fd769f1 | 299 | pcr.putc(' '); |
kenjiArai | 0:e4c20fd769f1 | 300 | pcr.putc(c); |
kenjiArai | 0:e4c20fd769f1 | 301 | } |
kenjiArai | 0:e4c20fd769f1 | 302 | if (((uint8_t)c >= ' ') && (idx < len - 1)) { |
kenjiArai | 0:e4c20fd769f1 | 303 | buff[idx++] = c; |
kenjiArai | 0:e4c20fd769f1 | 304 | pcr.putc(c); |
kenjiArai | 0:e4c20fd769f1 | 305 | } |
kenjiArai | 0:e4c20fd769f1 | 306 | } |
kenjiArai | 0:e4c20fd769f1 | 307 | buff[idx] = 0; |
kenjiArai | 0:e4c20fd769f1 | 308 | pcr.putc('\n'); |
kenjiArai | 0:e4c20fd769f1 | 309 | } |
kenjiArai | 0:e4c20fd769f1 | 310 | |
kenjiArai | 0:e4c20fd769f1 | 311 | // RTC related subroutines |
kenjiArai | 0:e4c20fd769f1 | 312 | void chk_and_set_time(char *ptr) |
kenjiArai | 0:e4c20fd769f1 | 313 | { |
kenjiArai | 0:e4c20fd769f1 | 314 | unsigned long p1; |
kenjiArai | 0:e4c20fd769f1 | 315 | struct tm t; |
kenjiArai | 0:e4c20fd769f1 | 316 | time_t seconds; |
kenjiArai | 0:e4c20fd769f1 | 317 | |
kenjiArai | 0:e4c20fd769f1 | 318 | if (xatoi(&ptr, &p1)) { |
kenjiArai | 0:e4c20fd769f1 | 319 | t.tm_year = (uint8_t)p1 + 100; |
kenjiArai | 0:e4c20fd769f1 | 320 | PRINTF("Year:%d ",p1); |
kenjiArai | 0:e4c20fd769f1 | 321 | xatoi( &ptr, &p1 ); |
kenjiArai | 0:e4c20fd769f1 | 322 | t.tm_mon = (uint8_t)p1 - 1; |
kenjiArai | 0:e4c20fd769f1 | 323 | PRINTF("Month:%d ",p1); |
kenjiArai | 0:e4c20fd769f1 | 324 | xatoi( &ptr, &p1 ); |
kenjiArai | 0:e4c20fd769f1 | 325 | t.tm_mday = (uint8_t)p1; |
kenjiArai | 0:e4c20fd769f1 | 326 | PRINTF("Day:%d ",p1); |
kenjiArai | 0:e4c20fd769f1 | 327 | xatoi( &ptr, &p1 ); |
kenjiArai | 0:e4c20fd769f1 | 328 | t.tm_hour = (uint8_t)p1; |
kenjiArai | 0:e4c20fd769f1 | 329 | PRINTF("Hour:%d ",p1); |
kenjiArai | 0:e4c20fd769f1 | 330 | xatoi( &ptr, &p1 ); |
kenjiArai | 0:e4c20fd769f1 | 331 | t.tm_min = (uint8_t)p1; |
kenjiArai | 0:e4c20fd769f1 | 332 | PRINTF("Min:%d ",p1); |
kenjiArai | 0:e4c20fd769f1 | 333 | xatoi( &ptr, &p1 ); |
kenjiArai | 0:e4c20fd769f1 | 334 | t.tm_sec = (uint8_t)p1; |
kenjiArai | 0:e4c20fd769f1 | 335 | PRINTF("Sec: %d \r\n",p1); |
kenjiArai | 0:e4c20fd769f1 | 336 | } else { |
kenjiArai | 0:e4c20fd769f1 | 337 | return; |
kenjiArai | 0:e4c20fd769f1 | 338 | } |
kenjiArai | 0:e4c20fd769f1 | 339 | seconds = mktime(&t); |
kenjiArai | 0:e4c20fd769f1 | 340 | set_time(seconds); |
kenjiArai | 0:e4c20fd769f1 | 341 | // Show Time with several example |
kenjiArai | 0:e4c20fd769f1 | 342 | // ex.1 |
kenjiArai | 0:e4c20fd769f1 | 343 | pcr.printf("Date: %04d/%02d/%02d, %02d:%02d:%02d\r\n", |
kenjiArai | 2:765470eab2a6 | 344 | t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); |
kenjiArai | 0:e4c20fd769f1 | 345 | #if 0 |
kenjiArai | 0:e4c20fd769f1 | 346 | time_t seconds; |
kenjiArai | 0:e4c20fd769f1 | 347 | char buf[40]; |
kenjiArai | 0:e4c20fd769f1 | 348 | |
kenjiArai | 0:e4c20fd769f1 | 349 | seconds = mktime(&t); |
kenjiArai | 0:e4c20fd769f1 | 350 | // ex.2 |
kenjiArai | 0:e4c20fd769f1 | 351 | strftime(buf, 40, "%x %X", localtime(&seconds)); |
kenjiArai | 0:e4c20fd769f1 | 352 | pcr.printf("Date: %s\r\n", buf); |
kenjiArai | 0:e4c20fd769f1 | 353 | // ex.3 |
kenjiArai | 0:e4c20fd769f1 | 354 | strftime(buf, 40, "%I:%M:%S %p (%Y/%m/%d)", localtime(&seconds)); |
kenjiArai | 0:e4c20fd769f1 | 355 | pcr.printf("Date: %s\r\n", buf); |
kenjiArai | 0:e4c20fd769f1 | 356 | // ex.4 |
kenjiArai | 0:e4c20fd769f1 | 357 | strftime(buf, 40, "%B %d,'%y, %H:%M:%S", localtime(&seconds)); |
kenjiArai | 0:e4c20fd769f1 | 358 | pcr.printf("Date: %s\r\n", buf); |
kenjiArai | 0:e4c20fd769f1 | 359 | #endif |
kenjiArai | 0:e4c20fd769f1 | 360 | } |
kenjiArai | 0:e4c20fd769f1 | 361 | |
kenjiArai | 0:e4c20fd769f1 | 362 | void time_enter_mode(void) |
kenjiArai | 0:e4c20fd769f1 | 363 | { |
kenjiArai | 0:e4c20fd769f1 | 364 | char *ptr; |
kenjiArai | 0:e4c20fd769f1 | 365 | char linebuf[64]; |
kenjiArai | 0:e4c20fd769f1 | 366 | |
kenjiArai | 0:e4c20fd769f1 | 367 | pcr.printf("\r\nSet time into RTC\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 368 | pcr.printf(" e.g. >15 2 7 10 11 12 -> Feb. 7th, '15, 10:11:12\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 369 | pcr.printf(" If time is fine, just hit enter\r\n"); |
kenjiArai | 0:e4c20fd769f1 | 370 | pcr.putc('>'); |
kenjiArai | 0:e4c20fd769f1 | 371 | ptr = linebuf; |
kenjiArai | 0:e4c20fd769f1 | 372 | get_line(ptr, sizeof(linebuf)); |
kenjiArai | 0:e4c20fd769f1 | 373 | pcr.printf("\r"); |
kenjiArai | 0:e4c20fd769f1 | 374 | chk_and_set_time(ptr); |
kenjiArai | 0:e4c20fd769f1 | 375 | } |
kenjiArai | 0:e4c20fd769f1 | 376 | |
kenjiArai | 2:765470eab2a6 | 377 | #if defined(TARGET_NUCLEO_L152RE) |
kenjiArai | 5:1a8e7aed053d | 378 | void goto_standby(void) |
kenjiArai | 2:765470eab2a6 | 379 | { |
kenjiArai | 5:1a8e7aed053d | 380 | RCC->AHBENR |= (RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOCEN | |
kenjiArai | 5:1a8e7aed053d | 381 | RCC_AHBENR_GPIODEN | RCC_AHBENR_GPIOHEN); |
kenjiArai | 5:1a8e7aed053d | 382 | #if 0 |
kenjiArai | 2:765470eab2a6 | 383 | GPIO_InitTypeDef GPIO_InitStruct; |
kenjiArai | 2:765470eab2a6 | 384 | // All other ports are analog input mode |
kenjiArai | 2:765470eab2a6 | 385 | GPIO_InitStruct.Pin = GPIO_PIN_All; |
kenjiArai | 2:765470eab2a6 | 386 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
kenjiArai | 2:765470eab2a6 | 387 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
kenjiArai | 2:765470eab2a6 | 388 | GPIO_InitStruct.Speed = GPIO_SPEED_LOW; |
kenjiArai | 2:765470eab2a6 | 389 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 390 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 391 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 392 | HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 393 | HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 394 | HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); |
kenjiArai | 5:1a8e7aed053d | 395 | #else |
kenjiArai | 5:1a8e7aed053d | 396 | GPIOA->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 397 | GPIOB->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 398 | GPIOC->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 399 | GPIOD->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 400 | GPIOE->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 401 | GPIOH->MODER = 0xffffffff; |
kenjiArai | 5:1a8e7aed053d | 402 | #endif |
kenjiArai | 5:1a8e7aed053d | 403 | RCC->AHBENR &= ~(RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN |RCC_AHBENR_GPIOCEN | |
kenjiArai | 5:1a8e7aed053d | 404 | RCC_AHBENR_GPIODEN | RCC_AHBENR_GPIOHEN); |
kenjiArai | 2:765470eab2a6 | 405 | while(1) { |
kenjiArai | 5:1a8e7aed053d | 406 | #if 0 |
kenjiArai | 5:1a8e7aed053d | 407 | // Stop mode |
kenjiArai | 2:765470eab2a6 | 408 | HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); |
kenjiArai | 5:1a8e7aed053d | 409 | #else |
kenjiArai | 5:1a8e7aed053d | 410 | // Standby mode |
kenjiArai | 5:1a8e7aed053d | 411 | HAL_PWR_EnterSTANDBYMode(); |
kenjiArai | 5:1a8e7aed053d | 412 | #endif |
kenjiArai | 2:765470eab2a6 | 413 | } |
kenjiArai | 2:765470eab2a6 | 414 | } |
kenjiArai | 0:e4c20fd769f1 | 415 | #else |
kenjiArai | 5:1a8e7aed053d | 416 | void goto_standby(void) |
kenjiArai | 2:765470eab2a6 | 417 | { |
kenjiArai | 5:1a8e7aed053d | 418 | deepsleep(); // Not Standby Mode but Deep Sleep Mode |
kenjiArai | 2:765470eab2a6 | 419 | } |
kenjiArai | 2:765470eab2a6 | 420 | #endif |
kenjiArai | 2:765470eab2a6 | 421 | |
kenjiArai | 2:765470eab2a6 | 422 | #if defined(TARGET_NUCLEO_L152RE) |
kenjiArai | 2:765470eab2a6 | 423 | #if defined(USE_IRQ_FOR_RTC_BKUP) |
kenjiArai | 2:765470eab2a6 | 424 | // COMP2 Interrupt routine |
kenjiArai | 2:765470eab2a6 | 425 | void irq_comp2_handler(void) |
kenjiArai | 2:765470eab2a6 | 426 | { |
kenjiArai | 2:765470eab2a6 | 427 | __disable_irq(); |
kenjiArai | 5:1a8e7aed053d | 428 | goto_standby(); |
kenjiArai | 2:765470eab2a6 | 429 | } |
kenjiArai | 2:765470eab2a6 | 430 | |
kenjiArai | 2:765470eab2a6 | 431 | COMP_HandleTypeDef COMP_HandleStruct; |
kenjiArai | 2:765470eab2a6 | 432 | GPIO_InitTypeDef GPIO_InitStruct; |
kenjiArai | 2:765470eab2a6 | 433 | |
kenjiArai | 5:1a8e7aed053d | 434 | // Set BOR level3 (2.54 to 2.74V) |
kenjiArai | 5:1a8e7aed053d | 435 | void set_BOR_level3(void) |
kenjiArai | 2:765470eab2a6 | 436 | { |
kenjiArai | 2:765470eab2a6 | 437 | FLASH_OBProgramInitTypeDef my_flash; |
kenjiArai | 2:765470eab2a6 | 438 | |
kenjiArai | 2:765470eab2a6 | 439 | HAL_FLASHEx_OBGetConfig(&my_flash); // read current configuration |
kenjiArai | 5:1a8e7aed053d | 440 | if (my_flash.BORLevel != OB_BOR_LEVEL3) { |
kenjiArai | 5:1a8e7aed053d | 441 | my_flash.BORLevel = OB_BOR_LEVEL3; |
kenjiArai | 2:765470eab2a6 | 442 | HAL_FLASHEx_OBProgram(&my_flash); |
kenjiArai | 2:765470eab2a6 | 443 | } |
kenjiArai | 2:765470eab2a6 | 444 | } |
kenjiArai | 2:765470eab2a6 | 445 | |
kenjiArai | 2:765470eab2a6 | 446 | void set_5v_drop_detect(void) |
kenjiArai | 2:765470eab2a6 | 447 | { |
kenjiArai | 5:1a8e7aed053d | 448 | set_BOR_level3(); |
kenjiArai | 2:765470eab2a6 | 449 | // Set Analog voltage input (PB5 or PB6) |
kenjiArai | 2:765470eab2a6 | 450 | #if defined(USE_PB5_FOR_COMP) |
kenjiArai | 2:765470eab2a6 | 451 | GPIO_InitStruct.Pin = GPIO_PIN_5; // PB5 comp input |
kenjiArai | 2:765470eab2a6 | 452 | #elif defined(USE_PB6_FOR_COMP) |
kenjiArai | 2:765470eab2a6 | 453 | GPIO_InitStruct.Pin = GPIO_PIN_6; // PB6 comp input |
kenjiArai | 2:765470eab2a6 | 454 | #else |
kenjiArai | 2:765470eab2a6 | 455 | #error "Please define USE_PB5_FOR_COMP or USE_PB6_FOR_COMP in SetRTC.h" |
kenjiArai | 2:765470eab2a6 | 456 | #endif |
kenjiArai | 2:765470eab2a6 | 457 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; |
kenjiArai | 2:765470eab2a6 | 458 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
kenjiArai | 2:765470eab2a6 | 459 | GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; |
kenjiArai | 2:765470eab2a6 | 460 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
kenjiArai | 2:765470eab2a6 | 461 | // COMP2 sets for low volatage detection |
kenjiArai | 2:765470eab2a6 | 462 | __COMP_CLK_ENABLE(); |
kenjiArai | 2:765470eab2a6 | 463 | COMP_HandleStruct.Instance = COMP2; |
kenjiArai | 2:765470eab2a6 | 464 | COMP_HandleStruct.Init.InvertingInput = COMP_INVERTINGINPUT_VREFINT; |
kenjiArai | 2:765470eab2a6 | 465 | #if defined(USE_PB5_FOR_COMP) |
kenjiArai | 2:765470eab2a6 | 466 | COMP_HandleStruct.Init.NonInvertingInput = COMP_NONINVERTINGINPUT_PB5; |
kenjiArai | 2:765470eab2a6 | 467 | #elif defined(USE_PB6_FOR_COMP) |
kenjiArai | 2:765470eab2a6 | 468 | COMP_HandleStruct.Init.NonInvertingInput = COMP_NONINVERTINGINPUT_PB6; |
kenjiArai | 2:765470eab2a6 | 469 | #endif |
kenjiArai | 2:765470eab2a6 | 470 | COMP_HandleStruct.Init.Output = COMP_OUTPUT_NONE; |
kenjiArai | 2:765470eab2a6 | 471 | COMP_HandleStruct.Init.Mode = COMP_MODE_HIGHSPEED; |
kenjiArai | 2:765470eab2a6 | 472 | COMP_HandleStruct.Init.WindowMode = COMP_WINDOWMODE_DISABLED; |
kenjiArai | 2:765470eab2a6 | 473 | COMP_HandleStruct.Init.TriggerMode = COMP_TRIGGERMODE_IT_FALLING; |
kenjiArai | 2:765470eab2a6 | 474 | HAL_COMP_Init(&COMP_HandleStruct); |
kenjiArai | 2:765470eab2a6 | 475 | // Interrupt configuration |
kenjiArai | 2:765470eab2a6 | 476 | NVIC_SetVector(COMP_IRQn, (uint32_t)irq_comp2_handler); |
kenjiArai | 2:765470eab2a6 | 477 | HAL_NVIC_SetPriority(COMP_IRQn, 0, 0); |
kenjiArai | 2:765470eab2a6 | 478 | HAL_NVIC_ClearPendingIRQ(COMP_IRQn); |
kenjiArai | 2:765470eab2a6 | 479 | HAL_COMP_Start_IT(&COMP_HandleStruct); |
kenjiArai | 2:765470eab2a6 | 480 | HAL_NVIC_EnableIRQ(COMP_IRQn); |
kenjiArai | 2:765470eab2a6 | 481 | } |
kenjiArai | 2:765470eab2a6 | 482 | #else // defined(USE_IRQ_FOR_RTC_BKUP) |
kenjiArai | 2:765470eab2a6 | 483 | void set_5v_drop_detect(void) |
kenjiArai | 2:765470eab2a6 | 484 | { |
kenjiArai | 2:765470eab2a6 | 485 | ; // No implementation |
kenjiArai | 2:765470eab2a6 | 486 | } |
kenjiArai | 2:765470eab2a6 | 487 | #endif // defined(USE_IRQ_FOR_RTC_BKUP) |
kenjiArai | 2:765470eab2a6 | 488 | |
kenjiArai | 2:765470eab2a6 | 489 | #else // defined(TARGET_NUCLEO_L152RE) |
kenjiArai | 2:765470eab2a6 | 490 | void set_5v_drop_detect(void) |
kenjiArai | 2:765470eab2a6 | 491 | { |
kenjiArai | 2:765470eab2a6 | 492 | ; // No implementation |
kenjiArai | 2:765470eab2a6 | 493 | } |
kenjiArai | 2:765470eab2a6 | 494 | #endif // defined(TARGET_NUCLEO_L152RE) |
kenjiArai | 2:765470eab2a6 | 495 | |
kenjiArai | 2:765470eab2a6 | 496 | #else // defined(TARGET_NUCLEO_F401RE,TARGET_NUCLEO_F411RE,TARGET_NUCLEO_L152RE) |
kenjiArai | 0:e4c20fd769f1 | 497 | #error "No suport this mbed, only for Nucleo mbed" |
kenjiArai | 2:765470eab2a6 | 498 | #endif // defined(TARGET_NUCLEO_F401RE,TARGET_NUCLEO_F411RE,TARGET_NUCLEO_L152RE) |