mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/hal/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/xdot_low_power.h@148:21d94c44109e, 2016-09-30 (annotated)
- Committer:
- <>
- Date:
- Fri Sep 30 18:07:01 2016 +0100
- Revision:
- 148:21d94c44109e
This updates the lib to the mbed lib v127
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 148:21d94c44109e | 1 | /* mbed Microcontroller Library |
<> | 148:21d94c44109e | 2 | ******************************************************************************* |
<> | 148:21d94c44109e | 3 | * Copyright (c) 2016, MultiTech Systems |
<> | 148:21d94c44109e | 4 | * All rights reserved. |
<> | 148:21d94c44109e | 5 | * |
<> | 148:21d94c44109e | 6 | * Redistribution and use in source and binary forms, with or without |
<> | 148:21d94c44109e | 7 | * modification, are permitted provided that the following conditions are met: |
<> | 148:21d94c44109e | 8 | * |
<> | 148:21d94c44109e | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
<> | 148:21d94c44109e | 10 | * this list of conditions and the following disclaimer. |
<> | 148:21d94c44109e | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
<> | 148:21d94c44109e | 12 | * this list of conditions and the following disclaimer in the documentation |
<> | 148:21d94c44109e | 13 | * and/or other materials provided with the distribution. |
<> | 148:21d94c44109e | 14 | * 3. Neither the name of MultiTech nor the names of its contributors |
<> | 148:21d94c44109e | 15 | * may be used to endorse or promote products derived from this software |
<> | 148:21d94c44109e | 16 | * without specific prior written permission. |
<> | 148:21d94c44109e | 17 | * |
<> | 148:21d94c44109e | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
<> | 148:21d94c44109e | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
<> | 148:21d94c44109e | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 148:21d94c44109e | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
<> | 148:21d94c44109e | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
<> | 148:21d94c44109e | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
<> | 148:21d94c44109e | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
<> | 148:21d94c44109e | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
<> | 148:21d94c44109e | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
<> | 148:21d94c44109e | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 148:21d94c44109e | 28 | ******************************************************************************* |
<> | 148:21d94c44109e | 29 | */ |
<> | 148:21d94c44109e | 30 | |
<> | 148:21d94c44109e | 31 | #ifndef __XDOT_LOW_POWER_H__ |
<> | 148:21d94c44109e | 32 | #define __XDOT_LOW_POWER_H__ |
<> | 148:21d94c44109e | 33 | |
<> | 148:21d94c44109e | 34 | #include "cmsis.h" |
<> | 148:21d94c44109e | 35 | |
<> | 148:21d94c44109e | 36 | #ifdef __cplusplus |
<> | 148:21d94c44109e | 37 | extern "C" { |
<> | 148:21d94c44109e | 38 | #endif |
<> | 148:21d94c44109e | 39 | |
<> | 148:21d94c44109e | 40 | /* xdot_disable_systick_int |
<> | 148:21d94c44109e | 41 | * disable the systick interrupt |
<> | 148:21d94c44109e | 42 | * call this before xdot_enter_stop_mode so systick interrupt doesn't wake up the processor |
<> | 148:21d94c44109e | 43 | * only necessary if RTOS is used |
<> | 148:21d94c44109e | 44 | */ |
<> | 148:21d94c44109e | 45 | void xdot_disable_systick_int(); |
<> | 148:21d94c44109e | 46 | |
<> | 148:21d94c44109e | 47 | /* xdot_enable_systick_int |
<> | 148:21d94c44109e | 48 | * enable the systick interrupt |
<> | 148:21d94c44109e | 49 | * call this after xdot_enter_stop_mode so RTOS can function again |
<> | 148:21d94c44109e | 50 | * only necessary if RTOS is used |
<> | 148:21d94c44109e | 51 | */ |
<> | 148:21d94c44109e | 52 | void xdot_enable_systick_int(); |
<> | 148:21d94c44109e | 53 | |
<> | 148:21d94c44109e | 54 | /* xdot_save_gpio_state |
<> | 148:21d94c44109e | 55 | * save current state of all GPIOs |
<> | 148:21d94c44109e | 56 | * call this before xdot_enter_stop_mode |
<> | 148:21d94c44109e | 57 | * to achieve the lowest possible power consumption possible all GPIO pins must be configured for |
<> | 148:21d94c44109e | 58 | * analog mode with no pull resistors enabled before entering STOP mode |
<> | 148:21d94c44109e | 59 | * the xdot_enter_stop_mode function does this for USBTX/RX and all internal pins |
<> | 148:21d94c44109e | 60 | * after calling xdot_save_gpio_state, the user application must do the same for WAKE, GPIO*, |
<> | 148:21d94c44109e | 61 | * UART1_*, I2C_*, and SPI_* pins |
<> | 148:21d94c44109e | 62 | * the user application should make a call to xdot_restore_gpio_state after waking from STOP mode |
<> | 148:21d94c44109e | 63 | * in order to restore GPIO functionality |
<> | 148:21d94c44109e | 64 | */ |
<> | 148:21d94c44109e | 65 | void xdot_save_gpio_state(); |
<> | 148:21d94c44109e | 66 | |
<> | 148:21d94c44109e | 67 | /* xdot_restore_gpio_state |
<> | 148:21d94c44109e | 68 | * restore all GPIOs to the state they were in when xdot_save_gpio_state was called |
<> | 148:21d94c44109e | 69 | * call this after exiting from STOP mode |
<> | 148:21d94c44109e | 70 | */ |
<> | 148:21d94c44109e | 71 | void xdot_restore_gpio_state(); |
<> | 148:21d94c44109e | 72 | |
<> | 148:21d94c44109e | 73 | /* xdot_enter_stop_mode |
<> | 148:21d94c44109e | 74 | * put the processor into STOP mode |
<> | 148:21d94c44109e | 75 | * RAM and peripheral state is retained |
<> | 148:21d94c44109e | 76 | * can be woken up by a number of interrupt sources including GPIOs and internal interrupts |
<> | 148:21d94c44109e | 77 | * program execution resumes after this function when the device wakes up |
<> | 148:21d94c44109e | 78 | */ |
<> | 148:21d94c44109e | 79 | void xdot_enter_stop_mode(); |
<> | 148:21d94c44109e | 80 | |
<> | 148:21d94c44109e | 81 | /* xdot_enter_standby_mode |
<> | 148:21d94c44109e | 82 | * put the processor into STANDBY mode |
<> | 148:21d94c44109e | 83 | * RAM and peripheral state is lost |
<> | 148:21d94c44109e | 84 | * can be woken up by the RTC alarm and rising edge on WAKE pin (WAKE pin must be configured first) |
<> | 148:21d94c44109e | 85 | * program execution starts from the beginning of the application when the device wakes up |
<> | 148:21d94c44109e | 86 | */ |
<> | 148:21d94c44109e | 87 | void xdot_enter_standby_mode(); |
<> | 148:21d94c44109e | 88 | |
<> | 148:21d94c44109e | 89 | /* xdot_enable_standby_wake_pin |
<> | 148:21d94c44109e | 90 | * configure the WAKE pin as a wakeup source from standby mode |
<> | 148:21d94c44109e | 91 | * after this call, a rising edge on the WAKE pin will wake the processor up from standby mode |
<> | 148:21d94c44109e | 92 | * this function should be called immediately before xdot_enter_standby_mode |
<> | 148:21d94c44109e | 93 | */ |
<> | 148:21d94c44109e | 94 | void xdot_enable_standby_wake_pin(); |
<> | 148:21d94c44109e | 95 | |
<> | 148:21d94c44109e | 96 | /* xdot_disnable_standby_wake_pin |
<> | 148:21d94c44109e | 97 | * should be called after waking up from standby mode |
<> | 148:21d94c44109e | 98 | */ |
<> | 148:21d94c44109e | 99 | void xdot_disable_standby_wake_pin(); |
<> | 148:21d94c44109e | 100 | |
<> | 148:21d94c44109e | 101 | #ifdef __cplusplus |
<> | 148:21d94c44109e | 102 | } |
<> | 148:21d94c44109e | 103 | #endif |
<> | 148:21d94c44109e | 104 | |
<> | 148:21d94c44109e | 105 | #endif /* __XDOT_LOW_POWER_H__ */ |