mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
181:57724642e740
mbed library release version 165

Who changed what in which revision?

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