Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:0dee8840a1c0 1 /**
einsteingustavo 0:0dee8840a1c0 2 ******************************************************************************
einsteingustavo 0:0dee8840a1c0 3 * @file misc.h
einsteingustavo 0:0dee8840a1c0 4 * @author MCD Application Team
einsteingustavo 0:0dee8840a1c0 5 * @version V3.6.1
einsteingustavo 0:0dee8840a1c0 6 * @date 05-March-2012
einsteingustavo 0:0dee8840a1c0 7 * @brief This file contains all the functions prototypes for the miscellaneous
einsteingustavo 0:0dee8840a1c0 8 * firmware library functions (add-on to CMSIS functions).
einsteingustavo 0:0dee8840a1c0 9 *******************************************************************************
einsteingustavo 0:0dee8840a1c0 10 * Copyright (c) 2014, STMicroelectronics
einsteingustavo 0:0dee8840a1c0 11 * All rights reserved.
einsteingustavo 0:0dee8840a1c0 12 *
einsteingustavo 0:0dee8840a1c0 13 * Redistribution and use in source and binary forms, with or without
einsteingustavo 0:0dee8840a1c0 14 * modification, are permitted provided that the following conditions are met:
einsteingustavo 0:0dee8840a1c0 15 *
einsteingustavo 0:0dee8840a1c0 16 * 1. Redistributions of source code must retain the above copyright notice,
einsteingustavo 0:0dee8840a1c0 17 * this list of conditions and the following disclaimer.
einsteingustavo 0:0dee8840a1c0 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
einsteingustavo 0:0dee8840a1c0 19 * this list of conditions and the following disclaimer in the documentation
einsteingustavo 0:0dee8840a1c0 20 * and/or other materials provided with the distribution.
einsteingustavo 0:0dee8840a1c0 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
einsteingustavo 0:0dee8840a1c0 22 * may be used to endorse or promote products derived from this software
einsteingustavo 0:0dee8840a1c0 23 * without specific prior written permission.
einsteingustavo 0:0dee8840a1c0 24 *
einsteingustavo 0:0dee8840a1c0 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
einsteingustavo 0:0dee8840a1c0 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
einsteingustavo 0:0dee8840a1c0 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
einsteingustavo 0:0dee8840a1c0 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
einsteingustavo 0:0dee8840a1c0 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
einsteingustavo 0:0dee8840a1c0 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
einsteingustavo 0:0dee8840a1c0 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
einsteingustavo 0:0dee8840a1c0 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
einsteingustavo 0:0dee8840a1c0 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
einsteingustavo 0:0dee8840a1c0 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
einsteingustavo 0:0dee8840a1c0 35 *******************************************************************************
einsteingustavo 0:0dee8840a1c0 36 */
einsteingustavo 0:0dee8840a1c0 37
einsteingustavo 0:0dee8840a1c0 38 /* Define to prevent recursive inclusion -------------------------------------*/
einsteingustavo 0:0dee8840a1c0 39 #ifndef __MISC_H
einsteingustavo 0:0dee8840a1c0 40 #define __MISC_H
einsteingustavo 0:0dee8840a1c0 41
einsteingustavo 0:0dee8840a1c0 42 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 43 extern "C" {
einsteingustavo 0:0dee8840a1c0 44 #endif
einsteingustavo 0:0dee8840a1c0 45
einsteingustavo 0:0dee8840a1c0 46 /* Includes ------------------------------------------------------------------*/
einsteingustavo 0:0dee8840a1c0 47 #include "stm32f10x.h"
einsteingustavo 0:0dee8840a1c0 48
einsteingustavo 0:0dee8840a1c0 49 /** @addtogroup STM32F10x_StdPeriph_Driver
einsteingustavo 0:0dee8840a1c0 50 * @{
einsteingustavo 0:0dee8840a1c0 51 */
einsteingustavo 0:0dee8840a1c0 52
einsteingustavo 0:0dee8840a1c0 53 /** @addtogroup MISC
einsteingustavo 0:0dee8840a1c0 54 * @{
einsteingustavo 0:0dee8840a1c0 55 */
einsteingustavo 0:0dee8840a1c0 56
einsteingustavo 0:0dee8840a1c0 57 /** @defgroup MISC_Exported_Types
einsteingustavo 0:0dee8840a1c0 58 * @{
einsteingustavo 0:0dee8840a1c0 59 */
einsteingustavo 0:0dee8840a1c0 60
einsteingustavo 0:0dee8840a1c0 61 /**
einsteingustavo 0:0dee8840a1c0 62 * @brief NVIC Init Structure definition
einsteingustavo 0:0dee8840a1c0 63 */
einsteingustavo 0:0dee8840a1c0 64
einsteingustavo 0:0dee8840a1c0 65 typedef struct
einsteingustavo 0:0dee8840a1c0 66 {
einsteingustavo 0:0dee8840a1c0 67 uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
einsteingustavo 0:0dee8840a1c0 68 This parameter can be a value of @ref IRQn_Type
einsteingustavo 0:0dee8840a1c0 69 (For the complete STM32 Devices IRQ Channels list, please
einsteingustavo 0:0dee8840a1c0 70 refer to stm32f10x.h file) */
einsteingustavo 0:0dee8840a1c0 71
einsteingustavo 0:0dee8840a1c0 72 uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
einsteingustavo 0:0dee8840a1c0 73 specified in NVIC_IRQChannel. This parameter can be a value
einsteingustavo 0:0dee8840a1c0 74 between 0 and 15 as described in the table @ref NVIC_Priority_Table */
einsteingustavo 0:0dee8840a1c0 75
einsteingustavo 0:0dee8840a1c0 76 uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
einsteingustavo 0:0dee8840a1c0 77 in NVIC_IRQChannel. This parameter can be a value
einsteingustavo 0:0dee8840a1c0 78 between 0 and 15 as described in the table @ref NVIC_Priority_Table */
einsteingustavo 0:0dee8840a1c0 79
einsteingustavo 0:0dee8840a1c0 80 FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
einsteingustavo 0:0dee8840a1c0 81 will be enabled or disabled.
einsteingustavo 0:0dee8840a1c0 82 This parameter can be set either to ENABLE or DISABLE */
einsteingustavo 0:0dee8840a1c0 83 } NVIC_InitTypeDef;
einsteingustavo 0:0dee8840a1c0 84
einsteingustavo 0:0dee8840a1c0 85 /**
einsteingustavo 0:0dee8840a1c0 86 * @}
einsteingustavo 0:0dee8840a1c0 87 */
einsteingustavo 0:0dee8840a1c0 88
einsteingustavo 0:0dee8840a1c0 89 /** @defgroup NVIC_Priority_Table
einsteingustavo 0:0dee8840a1c0 90 * @{
einsteingustavo 0:0dee8840a1c0 91 */
einsteingustavo 0:0dee8840a1c0 92
einsteingustavo 0:0dee8840a1c0 93 /**
einsteingustavo 0:0dee8840a1c0 94 @code
einsteingustavo 0:0dee8840a1c0 95 The table below gives the allowed values of the pre-emption priority and subpriority according
einsteingustavo 0:0dee8840a1c0 96 to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
einsteingustavo 0:0dee8840a1c0 97 ============================================================================================================================
einsteingustavo 0:0dee8840a1c0 98 NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description
einsteingustavo 0:0dee8840a1c0 99 ============================================================================================================================
einsteingustavo 0:0dee8840a1c0 100 NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 101 | | | 4 bits for subpriority
einsteingustavo 0:0dee8840a1c0 102 ----------------------------------------------------------------------------------------------------------------------------
einsteingustavo 0:0dee8840a1c0 103 NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 104 | | | 3 bits for subpriority
einsteingustavo 0:0dee8840a1c0 105 ----------------------------------------------------------------------------------------------------------------------------
einsteingustavo 0:0dee8840a1c0 106 NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 107 | | | 2 bits for subpriority
einsteingustavo 0:0dee8840a1c0 108 ----------------------------------------------------------------------------------------------------------------------------
einsteingustavo 0:0dee8840a1c0 109 NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 110 | | | 1 bits for subpriority
einsteingustavo 0:0dee8840a1c0 111 ----------------------------------------------------------------------------------------------------------------------------
einsteingustavo 0:0dee8840a1c0 112 NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 113 | | | 0 bits for subpriority
einsteingustavo 0:0dee8840a1c0 114 ============================================================================================================================
einsteingustavo 0:0dee8840a1c0 115 @endcode
einsteingustavo 0:0dee8840a1c0 116 */
einsteingustavo 0:0dee8840a1c0 117
einsteingustavo 0:0dee8840a1c0 118 /**
einsteingustavo 0:0dee8840a1c0 119 * @}
einsteingustavo 0:0dee8840a1c0 120 */
einsteingustavo 0:0dee8840a1c0 121
einsteingustavo 0:0dee8840a1c0 122 /** @defgroup MISC_Exported_Constants
einsteingustavo 0:0dee8840a1c0 123 * @{
einsteingustavo 0:0dee8840a1c0 124 */
einsteingustavo 0:0dee8840a1c0 125
einsteingustavo 0:0dee8840a1c0 126 /** @defgroup Vector_Table_Base
einsteingustavo 0:0dee8840a1c0 127 * @{
einsteingustavo 0:0dee8840a1c0 128 */
einsteingustavo 0:0dee8840a1c0 129
einsteingustavo 0:0dee8840a1c0 130 #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
einsteingustavo 0:0dee8840a1c0 131 #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
einsteingustavo 0:0dee8840a1c0 132 #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
einsteingustavo 0:0dee8840a1c0 133 ((VECTTAB) == NVIC_VectTab_FLASH))
einsteingustavo 0:0dee8840a1c0 134 /**
einsteingustavo 0:0dee8840a1c0 135 * @}
einsteingustavo 0:0dee8840a1c0 136 */
einsteingustavo 0:0dee8840a1c0 137
einsteingustavo 0:0dee8840a1c0 138 /** @defgroup System_Low_Power
einsteingustavo 0:0dee8840a1c0 139 * @{
einsteingustavo 0:0dee8840a1c0 140 */
einsteingustavo 0:0dee8840a1c0 141
einsteingustavo 0:0dee8840a1c0 142 #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
einsteingustavo 0:0dee8840a1c0 143 #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
einsteingustavo 0:0dee8840a1c0 144 #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
einsteingustavo 0:0dee8840a1c0 145 #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
einsteingustavo 0:0dee8840a1c0 146 ((LP) == NVIC_LP_SLEEPDEEP) || \
einsteingustavo 0:0dee8840a1c0 147 ((LP) == NVIC_LP_SLEEPONEXIT))
einsteingustavo 0:0dee8840a1c0 148 /**
einsteingustavo 0:0dee8840a1c0 149 * @}
einsteingustavo 0:0dee8840a1c0 150 */
einsteingustavo 0:0dee8840a1c0 151
einsteingustavo 0:0dee8840a1c0 152 /** @defgroup Preemption_Priority_Group
einsteingustavo 0:0dee8840a1c0 153 * @{
einsteingustavo 0:0dee8840a1c0 154 */
einsteingustavo 0:0dee8840a1c0 155
einsteingustavo 0:0dee8840a1c0 156 #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 157 4 bits for subpriority */
einsteingustavo 0:0dee8840a1c0 158 #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 159 3 bits for subpriority */
einsteingustavo 0:0dee8840a1c0 160 #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 161 2 bits for subpriority */
einsteingustavo 0:0dee8840a1c0 162 #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 163 1 bits for subpriority */
einsteingustavo 0:0dee8840a1c0 164 #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
einsteingustavo 0:0dee8840a1c0 165 0 bits for subpriority */
einsteingustavo 0:0dee8840a1c0 166
einsteingustavo 0:0dee8840a1c0 167 #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
einsteingustavo 0:0dee8840a1c0 168 ((GROUP) == NVIC_PriorityGroup_1) || \
einsteingustavo 0:0dee8840a1c0 169 ((GROUP) == NVIC_PriorityGroup_2) || \
einsteingustavo 0:0dee8840a1c0 170 ((GROUP) == NVIC_PriorityGroup_3) || \
einsteingustavo 0:0dee8840a1c0 171 ((GROUP) == NVIC_PriorityGroup_4))
einsteingustavo 0:0dee8840a1c0 172
einsteingustavo 0:0dee8840a1c0 173 #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
einsteingustavo 0:0dee8840a1c0 174
einsteingustavo 0:0dee8840a1c0 175 #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
einsteingustavo 0:0dee8840a1c0 176
einsteingustavo 0:0dee8840a1c0 177 #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
einsteingustavo 0:0dee8840a1c0 178
einsteingustavo 0:0dee8840a1c0 179 /**
einsteingustavo 0:0dee8840a1c0 180 * @}
einsteingustavo 0:0dee8840a1c0 181 */
einsteingustavo 0:0dee8840a1c0 182
einsteingustavo 0:0dee8840a1c0 183 /** @defgroup SysTick_clock_source
einsteingustavo 0:0dee8840a1c0 184 * @{
einsteingustavo 0:0dee8840a1c0 185 */
einsteingustavo 0:0dee8840a1c0 186
einsteingustavo 0:0dee8840a1c0 187 #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
einsteingustavo 0:0dee8840a1c0 188 #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
einsteingustavo 0:0dee8840a1c0 189 #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
einsteingustavo 0:0dee8840a1c0 190 ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
einsteingustavo 0:0dee8840a1c0 191 /**
einsteingustavo 0:0dee8840a1c0 192 * @}
einsteingustavo 0:0dee8840a1c0 193 */
einsteingustavo 0:0dee8840a1c0 194
einsteingustavo 0:0dee8840a1c0 195 /**
einsteingustavo 0:0dee8840a1c0 196 * @}
einsteingustavo 0:0dee8840a1c0 197 */
einsteingustavo 0:0dee8840a1c0 198
einsteingustavo 0:0dee8840a1c0 199 /** @defgroup MISC_Exported_Macros
einsteingustavo 0:0dee8840a1c0 200 * @{
einsteingustavo 0:0dee8840a1c0 201 */
einsteingustavo 0:0dee8840a1c0 202
einsteingustavo 0:0dee8840a1c0 203 /**
einsteingustavo 0:0dee8840a1c0 204 * @}
einsteingustavo 0:0dee8840a1c0 205 */
einsteingustavo 0:0dee8840a1c0 206
einsteingustavo 0:0dee8840a1c0 207 /** @defgroup MISC_Exported_Functions
einsteingustavo 0:0dee8840a1c0 208 * @{
einsteingustavo 0:0dee8840a1c0 209 */
einsteingustavo 0:0dee8840a1c0 210
einsteingustavo 0:0dee8840a1c0 211 void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
einsteingustavo 0:0dee8840a1c0 212 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
einsteingustavo 0:0dee8840a1c0 213 void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
einsteingustavo 0:0dee8840a1c0 214 void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
einsteingustavo 0:0dee8840a1c0 215 void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
einsteingustavo 0:0dee8840a1c0 216
einsteingustavo 0:0dee8840a1c0 217 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 218 }
einsteingustavo 0:0dee8840a1c0 219 #endif
einsteingustavo 0:0dee8840a1c0 220
einsteingustavo 0:0dee8840a1c0 221 #endif /* __MISC_H */
einsteingustavo 0:0dee8840a1c0 222
einsteingustavo 0:0dee8840a1c0 223 /**
einsteingustavo 0:0dee8840a1c0 224 * @}
einsteingustavo 0:0dee8840a1c0 225 */
einsteingustavo 0:0dee8840a1c0 226
einsteingustavo 0:0dee8840a1c0 227 /**
einsteingustavo 0:0dee8840a1c0 228 * @}
einsteingustavo 0:0dee8840a1c0 229 */
einsteingustavo 0:0dee8840a1c0 230
einsteingustavo 0:0dee8840a1c0 231 /**
einsteingustavo 0:0dee8840a1c0 232 * @}
einsteingustavo 0:0dee8840a1c0 233 */
einsteingustavo 0:0dee8840a1c0 234
einsteingustavo 0:0dee8840a1c0 235 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
einsteingustavo 0:0dee8840a1c0 236