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
targets/TARGET_ONSEMI/TARGET_NCS36510/sleep_api.c@149:156823d33999, 2016-10-28 (annotated)
- Committer:
- <>
- Date:
- Fri Oct 28 11:17:30 2016 +0100
- Revision:
- 149:156823d33999
- Child:
- 150:02e0a0aed4ec
This updates the lib to the mbed lib v128
NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | /** |
<> | 149:156823d33999 | 2 | ******************************************************************************* |
<> | 149:156823d33999 | 3 | * @file sleep_api.c |
<> | 149:156823d33999 | 4 | * @brief Implementation of a sleep functionality |
<> | 149:156823d33999 | 5 | * @internal |
<> | 149:156823d33999 | 6 | * @author ON Semiconductor |
<> | 149:156823d33999 | 7 | * $Rev: $ |
<> | 149:156823d33999 | 8 | * $Date: $ |
<> | 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 | * |
<> | 149:156823d33999 | 21 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
<> | 149:156823d33999 | 22 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
<> | 149:156823d33999 | 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
<> | 149:156823d33999 | 24 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
<> | 149:156823d33999 | 25 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
<> | 149:156823d33999 | 26 | * @endinternal |
<> | 149:156823d33999 | 27 | * |
<> | 149:156823d33999 | 28 | * @ingroup sleep |
<> | 149:156823d33999 | 29 | * |
<> | 149:156823d33999 | 30 | * @details |
<> | 149:156823d33999 | 31 | * Sleep implementation TBD - Dummy function is fine for first release |
<> | 149:156823d33999 | 32 | * |
<> | 149:156823d33999 | 33 | */ |
<> | 149:156823d33999 | 34 | |
<> | 149:156823d33999 | 35 | #if DEVICE_SLEEP |
<> | 149:156823d33999 | 36 | #include "sleep.h" |
<> | 149:156823d33999 | 37 | #include "sleep_api.h" |
<> | 149:156823d33999 | 38 | #include "cmsis_nvic.h" |
<> | 149:156823d33999 | 39 | |
<> | 149:156823d33999 | 40 | void mbed_enter_sleep(sleep_t *obj) |
<> | 149:156823d33999 | 41 | { |
<> | 149:156823d33999 | 42 | |
<> | 149:156823d33999 | 43 | #ifdef SLEEP_TYPE_DEFAULT |
<> | 149:156823d33999 | 44 | |
<> | 149:156823d33999 | 45 | if(SLEEP_TYPE_DEFAULT == SLEEP_TYPE_SLEEP) { |
<> | 149:156823d33999 | 46 | /* Sleep mode */ |
<> | 149:156823d33999 | 47 | sleep(); |
<> | 149:156823d33999 | 48 | } else if(SLEEP_TYPE_DEFAULT == SLEEP_TYPE_DEEPSLEEP) { |
<> | 149:156823d33999 | 49 | /* Deep Sleep mode */ |
<> | 149:156823d33999 | 50 | deepsleep(); |
<> | 149:156823d33999 | 51 | } else { |
<> | 149:156823d33999 | 52 | /* Coma mode */ |
<> | 149:156823d33999 | 53 | coma(); |
<> | 149:156823d33999 | 54 | } |
<> | 149:156823d33999 | 55 | |
<> | 149:156823d33999 | 56 | #else |
<> | 149:156823d33999 | 57 | |
<> | 149:156823d33999 | 58 | if(obj->SleepType == SLEEP_TYPE_NONE) { |
<> | 149:156823d33999 | 59 | /* Select low power mode based on sleep duration */ |
<> | 149:156823d33999 | 60 | |
<> | 149:156823d33999 | 61 | if(obj->timeToSleep <= SLEEP_DURATION_SLEEP_MAX) { |
<> | 149:156823d33999 | 62 | /* Sleep mode */ |
<> | 149:156823d33999 | 63 | sleep(); |
<> | 149:156823d33999 | 64 | } else if(obj->timeToSleep <= SLEEP_DURATION_DEEPSLEEP_MAX) { |
<> | 149:156823d33999 | 65 | /* Deep sleep */ |
<> | 149:156823d33999 | 66 | deepsleep(); |
<> | 149:156823d33999 | 67 | } else { |
<> | 149:156823d33999 | 68 | /* Coma */ |
<> | 149:156823d33999 | 69 | coma(); |
<> | 149:156823d33999 | 70 | } |
<> | 149:156823d33999 | 71 | } else if(obj->SleepType == SLEEP_TYPE_SLEEP) { |
<> | 149:156823d33999 | 72 | /* Sleep mode */ |
<> | 149:156823d33999 | 73 | sleep(); |
<> | 149:156823d33999 | 74 | } else if(obj->SleepType == SLEEP_TYPE_DEEPSLEEP) { |
<> | 149:156823d33999 | 75 | /* Deep Sleep mode */ |
<> | 149:156823d33999 | 76 | deepsleep(); |
<> | 149:156823d33999 | 77 | } else { |
<> | 149:156823d33999 | 78 | /* Coma mode */ |
<> | 149:156823d33999 | 79 | coma(); |
<> | 149:156823d33999 | 80 | } |
<> | 149:156823d33999 | 81 | |
<> | 149:156823d33999 | 82 | #endif |
<> | 149:156823d33999 | 83 | } |
<> | 149:156823d33999 | 84 | |
<> | 149:156823d33999 | 85 | void mbed_exit_sleep(sleep_t *obj) |
<> | 149:156823d33999 | 86 | { |
<> | 149:156823d33999 | 87 | (void)obj; |
<> | 149:156823d33999 | 88 | } |
<> | 149:156823d33999 | 89 | |
<> | 149:156823d33999 | 90 | #endif /* DEVICE_SLEEP */ |