init commit
This commit is contained in:
303
Utilities/lpm/tiny_lpm/Release_Notes.html
Normal file
303
Utilities/lpm/tiny_lpm/Release_Notes.html
Normal file
@@ -0,0 +1,303 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for STM32 TINY low power manager</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
ul.task-list{list-style: none;}
|
||||
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="_htmresc/mini-st.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<center>
|
||||
<h1 id="release-notes-for-stm32-tiny-low-power-manager">Release Notes for <mark>STM32 TINY low power manager</h1>
|
||||
<p>Copyright © 2019 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo_2020.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>The code source delivered is an utility to help customer to build a low power application.</p>
|
||||
</div>
|
||||
<section id="update-history" class="col-sm-12 col-lg-8">
|
||||
<h1>Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section7" checked aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.4.2 / 27-October-2022</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<h2 id="contents">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Ticket 137597 - [CodeSpell] Mistake in lpm module</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility">backward compatibility</h2>
|
||||
<h2 id="dependencies">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V1.4.1 / 17-June-2022</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<h2 id="contents-1">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Release note format update</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-1">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-1">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-1">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-1">backward compatibility</h2>
|
||||
<h2 id="dependencies-1">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V1.4.0 / 09-November-2021</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<h2 id="contents-2">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Ticket 115234 - [Licensing] Update the way to declare licenses in Cube and X-CUBE components</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-2">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-2">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-2">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-2">backward compatibility</h2>
|
||||
<h2 id="dependencies-2">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true">V1.3.1 / 10-September-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<h3 id="release-v1.3.1">release V1.3.1</h3>
|
||||
<h2 id="contents-3">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Ticket 86948 - CodeSpell : Correct some English words typo</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-3">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-3">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-3">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-3">backward compatibility</h2>
|
||||
<h2 id="dependencies-3">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V1.3.0 / 3-September-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<h3 id="release-v1.3.0">release V1.3.0</h3>
|
||||
<h2 id="contents-4">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Ticket 86948 - CodeSpell : Correct some English words typo</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Ticket 89624 - Utilities Releases Notes improvements - Link on openorg BSD-3-Clause</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Ticket 91318 - need specific CRITICAL_SECTION for UTIL_LPM_EnterLowPower function</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-4">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-4">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-4">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-4">backward compatibility</h2>
|
||||
<h2 id="dependencies-4">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.2.0 / 18-Mars-2020</label>
|
||||
<div>
|
||||
<h2 id="main-changes-5">Main Changes</h2>
|
||||
<h3 id="release-v1.2.0">release V1.2.0</h3>
|
||||
<h2 id="contents-5">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Add the doxygen tag in the source code.</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>MISRAC update.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-5">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-5">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-5">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-5">backward compatibility</h2>
|
||||
<h2 id="dependencies-5">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.1.0 / 04-June-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-6">Main Changes</h2>
|
||||
<h3 id="release-v1.1.0">release V1.1.0</h3>
|
||||
<h2 id="contents-6">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>Add CubeMx tag inside the template file.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-6">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-6">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-6">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-6">backward compatibility</h2>
|
||||
<h2 id="dependencies-6">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.0 / 13-May-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes-7">Main Changes</h2>
|
||||
<h3 id="first-release">First release</h3>
|
||||
<h2 id="contents-7">Contents</h2>
|
||||
<p><strong>Fixed bugs list</strong></p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th>Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td>first official release</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="known-limitations-7">known limitations</h2>
|
||||
<h2 id="development-toolchains-and-compilers-7">Development Toolchains and Compilers</h2>
|
||||
<ul>
|
||||
<li>IAR Embedded Workbench for ARM (EWARM) toolchain V8.20.2</li>
|
||||
<li>RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.25</li>
|
||||
<li>System Workbench STM32 (SW4STM32) toolchain V2.7.2</li>
|
||||
</ul>
|
||||
<h2 id="supported-devices-and-boards-7">Supported Devices and boards</h2>
|
||||
<h2 id="backward-compatibility-7">backward compatibility</h2>
|
||||
<h2 id="dependencies-7">Dependencies</h2>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
<div class="columns">
|
||||
<div class="column" style="width:95%;">
|
||||
|
||||
</div><div class="column" style="width:5%;">
|
||||
<p><abbr title="Based on template cx566953 version 2.1">Info</abbr></p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Utilities/lpm/tiny_lpm/_htmresc/favicon.png
Normal file
BIN
Utilities/lpm/tiny_lpm/_htmresc/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
1711
Utilities/lpm/tiny_lpm/_htmresc/mini-st.css
Normal file
1711
Utilities/lpm/tiny_lpm/_htmresc/mini-st.css
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Utilities/lpm/tiny_lpm/_htmresc/st_logo_2020.png
Normal file
BIN
Utilities/lpm/tiny_lpm/_htmresc/st_logo_2020.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
258
Utilities/lpm/tiny_lpm/stm32_lpm.c
Normal file
258
Utilities/lpm/tiny_lpm/stm32_lpm.c
Normal file
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_lpm.c
|
||||
* @author MCD Application Team
|
||||
* @brief Low Power Manager
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32_lpm.h"
|
||||
#include "utilities_conf.h"
|
||||
|
||||
/** @addtogroup TINY_LPM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/** @defgroup TINY_LPM_Private_macros TINY LPM private macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief macro used to initialized the critical section
|
||||
*/
|
||||
#ifndef UTIL_LPM_INIT_CRITICAL_SECTION
|
||||
#define UTIL_LPM_INIT_CRITICAL_SECTION( )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief macro used to enter the critical section
|
||||
*/
|
||||
#ifndef UTIL_LPM_ENTER_CRITICAL_SECTION
|
||||
#define UTIL_LPM_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION( )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief macro used to exit the critical section
|
||||
*/
|
||||
#ifndef UTIL_LPM_EXIT_CRITICAL_SECTION
|
||||
#define UTIL_LPM_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION( )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief macro used to enter the critical section when Entering Low Power
|
||||
* @note this macro is only called inside the function UTIL_LPM_EnterLowPower
|
||||
* and in a basic configuration shall be identcal to the macro
|
||||
* UTIL_LPM_EXIT_CRITICAL_SECTION. In general, the request to enter the
|
||||
* low power mode is already done under a critical section and
|
||||
* nesting it is useless (in specific implementations not even possible).
|
||||
* So the users could define their own macro)
|
||||
*/
|
||||
#ifndef UTIL_LPM_ENTER_CRITICAL_SECTION_ELP
|
||||
#define UTIL_LPM_ENTER_CRITICAL_SECTION_ELP( ) UTIL_LPM_ENTER_CRITICAL_SECTION( )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief macro used to exit the critical section when exiting Low Power mode
|
||||
* @note the behavior of the macro shall be symmetrical with the macro
|
||||
* UTIL_LPM_ENTER_CRITICAL_SECTION_ELP
|
||||
*/
|
||||
#ifndef UTIL_LPM_EXIT_CRITICAL_SECTION_ELP
|
||||
#define UTIL_LPM_EXIT_CRITICAL_SECTION_ELP( ) UTIL_LPM_EXIT_CRITICAL_SECTION( )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
/** @defgroup TINY_LPM_Private_define TINY LPM private defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief value used to reset the LPM mode
|
||||
*/
|
||||
#define UTIL_LPM_NO_BIT_SET (0UL)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/** @defgroup TINY_LPM_Private_variables TINY LPM private variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief value used to represent the LPM state of stop mode
|
||||
*/
|
||||
static UTIL_LPM_bm_t StopModeDisable = UTIL_LPM_NO_BIT_SET;
|
||||
|
||||
/**
|
||||
* @brief value used to represent the LPM state of off mode
|
||||
*/
|
||||
static UTIL_LPM_bm_t OffModeDisable = UTIL_LPM_NO_BIT_SET;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Global variables ----------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Functions Definition ------------------------------------------------------*/
|
||||
|
||||
/** @addtogroup TINY_LPM_Exported_function
|
||||
* @{
|
||||
*/
|
||||
void UTIL_LPM_Init( void )
|
||||
{
|
||||
StopModeDisable = UTIL_LPM_NO_BIT_SET;
|
||||
OffModeDisable = UTIL_LPM_NO_BIT_SET;
|
||||
UTIL_LPM_INIT_CRITICAL_SECTION( );
|
||||
}
|
||||
|
||||
void UTIL_LPM_DeInit( void )
|
||||
{
|
||||
}
|
||||
|
||||
void UTIL_LPM_SetStopMode( UTIL_LPM_bm_t lpm_id_bm, UTIL_LPM_State_t state )
|
||||
{
|
||||
UTIL_LPM_ENTER_CRITICAL_SECTION( );
|
||||
|
||||
switch( state )
|
||||
{
|
||||
case UTIL_LPM_DISABLE:
|
||||
{
|
||||
StopModeDisable |= lpm_id_bm;
|
||||
break;
|
||||
}
|
||||
case UTIL_LPM_ENABLE:
|
||||
{
|
||||
StopModeDisable &= ( ~lpm_id_bm );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UTIL_LPM_EXIT_CRITICAL_SECTION( );
|
||||
}
|
||||
|
||||
void UTIL_LPM_SetOffMode( UTIL_LPM_bm_t lpm_id_bm, UTIL_LPM_State_t state )
|
||||
{
|
||||
UTIL_LPM_ENTER_CRITICAL_SECTION( );
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case UTIL_LPM_DISABLE:
|
||||
{
|
||||
OffModeDisable |= lpm_id_bm;
|
||||
break;
|
||||
}
|
||||
case UTIL_LPM_ENABLE:
|
||||
{
|
||||
OffModeDisable &= ( ~lpm_id_bm );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UTIL_LPM_EXIT_CRITICAL_SECTION( );
|
||||
}
|
||||
|
||||
UTIL_LPM_Mode_t UTIL_LPM_GetMode( void )
|
||||
{
|
||||
UTIL_LPM_Mode_t mode_selected;
|
||||
|
||||
UTIL_LPM_ENTER_CRITICAL_SECTION( );
|
||||
|
||||
if( StopModeDisable != UTIL_LPM_NO_BIT_SET )
|
||||
{
|
||||
/**
|
||||
* At least one user disallows Stop Mode
|
||||
*/
|
||||
mode_selected = UTIL_LPM_SLEEPMODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( OffModeDisable != UTIL_LPM_NO_BIT_SET )
|
||||
{
|
||||
/**
|
||||
* At least one user disallows Off Mode
|
||||
*/
|
||||
mode_selected = UTIL_LPM_STOPMODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode_selected = UTIL_LPM_OFFMODE;
|
||||
}
|
||||
}
|
||||
|
||||
UTIL_LPM_EXIT_CRITICAL_SECTION( );
|
||||
|
||||
return mode_selected;
|
||||
}
|
||||
|
||||
void UTIL_LPM_EnterLowPower( void )
|
||||
{
|
||||
UTIL_LPM_ENTER_CRITICAL_SECTION_ELP( );
|
||||
|
||||
if( StopModeDisable != UTIL_LPM_NO_BIT_SET )
|
||||
{
|
||||
/**
|
||||
* At least one user disallows Stop Mode
|
||||
* SLEEP mode is required
|
||||
*/
|
||||
UTIL_PowerDriver.EnterSleepMode( );
|
||||
UTIL_PowerDriver.ExitSleepMode( );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( OffModeDisable != UTIL_LPM_NO_BIT_SET )
|
||||
{
|
||||
/**
|
||||
* At least one user disallows Off Mode
|
||||
* STOP mode is required
|
||||
*/
|
||||
UTIL_PowerDriver.EnterStopMode( );
|
||||
UTIL_PowerDriver.ExitStopMode( );
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* OFF mode is required
|
||||
*/
|
||||
UTIL_PowerDriver.EnterOffMode( );
|
||||
UTIL_PowerDriver.ExitOffMode( );
|
||||
}
|
||||
}
|
||||
|
||||
UTIL_LPM_EXIT_CRITICAL_SECTION_ELP( );
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
167
Utilities/lpm/tiny_lpm/stm32_lpm.h
Normal file
167
Utilities/lpm/tiny_lpm/stm32_lpm.h
Normal file
@@ -0,0 +1,167 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32_lpm.h
|
||||
* @author MCD Application Team
|
||||
* @brief Header for stm32_lpm.c module
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef STM32_TINY_LPM_H
|
||||
#define STM32_TINY_LPM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stdint.h"
|
||||
|
||||
/** @defgroup TINY_LPM TINY LPM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Exported typedef ---------------------------------------------------------*/
|
||||
/** @defgroup TINY_LPM_Exported_typedef TINY LPM exported typedef
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief type definition to represent the bit mask of an LPM mode
|
||||
*/
|
||||
typedef uint32_t UTIL_LPM_bm_t;
|
||||
|
||||
/**
|
||||
* @brief type definition to represent value of an LPM mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
UTIL_LPM_ENABLE=0,
|
||||
UTIL_LPM_DISABLE,
|
||||
} UTIL_LPM_State_t;
|
||||
|
||||
/**
|
||||
* @brief type definition to represent the different type of LPM mode
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UTIL_LPM_SLEEPMODE,
|
||||
UTIL_LPM_STOPMODE,
|
||||
UTIL_LPM_OFFMODE,
|
||||
} UTIL_LPM_Mode_t;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup TINY_LPM_Exported_struct TINY LPM exported struct
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LPM driver definition
|
||||
*/
|
||||
struct UTIL_LPM_Driver_s
|
||||
{
|
||||
void (*EnterSleepMode) ( void ); /*!<function to enter the sleep mode */
|
||||
void (*ExitSleepMode) ( void ); /*!<function to exit the sleep mode */
|
||||
void (*EnterStopMode) ( void ); /*!<function to enter the stop mode */
|
||||
void (*ExitStopMode) ( void ); /*!<function to exit the stop mode */
|
||||
void (*EnterOffMode) ( void ); /*!<function to enter the off mode */
|
||||
void (*ExitOffMode) ( void ); /*!<function to exit the off mode */
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
|
||||
/** @defgroup TINY_LPM_Exported_struct TINY LPM exported struct
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LPM driver
|
||||
*
|
||||
* @note This structure is defined and initialized in the specific platform
|
||||
* power implementation
|
||||
*/
|
||||
extern const struct UTIL_LPM_Driver_s UTIL_PowerDriver;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
||||
/** @defgroup TINY_LPM_Exported_function TINY LPM exported functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This API Initializes the LPM resources.
|
||||
*/
|
||||
void UTIL_LPM_Init( void );
|
||||
|
||||
/**
|
||||
* @brief This API Un-Initializes the LPM resources.
|
||||
*/
|
||||
void UTIL_LPM_DeInit( void );
|
||||
|
||||
/**
|
||||
* @brief This API returns the Low Power Mode selected that will be applied when the system will enter low power mode
|
||||
* if there is no update between the time the mode is read with this API and the time the system enters
|
||||
* low power mode.
|
||||
* @retval the LPM mode based on @ref UTIL_LPM_Mode_t
|
||||
*/
|
||||
UTIL_LPM_Mode_t UTIL_LPM_GetMode( void );
|
||||
|
||||
/**
|
||||
* @brief This API notifies the low power manager if the specified user allows the Stop mode or not.
|
||||
* The default mode selection for all users is Stop Mode enabled
|
||||
* @param lpm_id_bm: identifier of the user ( 1 bit per user )
|
||||
* @param state: Specify whether StopMode is allowed or not by this user
|
||||
*/
|
||||
void UTIL_LPM_SetStopMode( UTIL_LPM_bm_t lpm_id_bm, UTIL_LPM_State_t state );
|
||||
|
||||
/**
|
||||
* @brief This API notifies the low power manager if the specified user allows the Off mode or not.
|
||||
* The default mode selection for all users is Off mode enabled
|
||||
* @param lpm_id_bm: identifier of the user ( 1 bit per user )
|
||||
* @param state: Specify whether OffMode is allowed or not by this user
|
||||
*/
|
||||
void UTIL_LPM_SetOffMode( UTIL_LPM_bm_t lpm_id_bm, UTIL_LPM_State_t state );
|
||||
|
||||
/**
|
||||
* @brief This API is called by the low power manager in a critical section (PRIMASK bit set) to allow the
|
||||
* application to implement dedicated code before entering Low Power Mode
|
||||
*/
|
||||
void UTIL_LPM_EnterLowPower( void );
|
||||
|
||||
/**
|
||||
*@}
|
||||
*/
|
||||
|
||||
/**
|
||||
*@}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* STM32_TINY_LPM_H */
|
||||
|
||||
Reference in New Issue
Block a user