| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

misc.c
Go to the documentation of this file.
1
23 /* Includes ------------------------------------------------------------------*/
24 #include "misc.h"
25
46 #define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000)
47
87 void NVIC_Init(NVIC_InitType* NVIC_InitStruct)
88 {
89 /* Check the parameters */
90 assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
91 assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
92
93 if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
94 {
95 /* Compute the Corresponding IRQ Priority --------------------------------*/
96 NVIC_SetPriority((IRQn_Type)NVIC_InitStruct->NVIC_IRQChannel, NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority);
97
98 /* Enable the Selected IRQ Channels --------------------------------------*/
99 NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
100 (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
101 }
102 else
103 {
104 /* Disable the Selected IRQ Channels -------------------------------------*/
105 NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
106 (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);
107 }
108 }
109
116 void SystemSleepCmd(FunctionalState NewState)
117 {
118 /* Check the parameters */
119 assert_param(IS_FUNCTIONAL_STATE(NewState));
120
121 if (NewState != DISABLE) {
123 SCB->SCR |= 1<<SCB_SCR_SLEEPDEEP_Pos;
124 }
125 else {
127 SCB->SCR &= ~(1<<SCB_SCR_SLEEPDEEP_Pos);
128 }
129 }
130
131 void SysTick_State(FunctionalState NewState)
132 {
133 /* Check the parameters */
134 assert_param(IS_FUNCTIONAL_STATE(NewState));
135
136 if (NewState != DISABLE) {
137 SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
138 }
139 else {
140 SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
141 }
142 }
143
144
157 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
NVIC_InitType::NVIC_IRQChannelCmd
FunctionalState NVIC_IRQChannelCmd
Definition: misc.h:62
SysTick_State
void SysTick_State(FunctionalState NewState)
Definition: misc.c:131
misc.h
This file contains all the functions prototypes for the miscellaneous firmware library functions (add...
NVIC_Init
void NVIC_Init(NVIC_InitType *NVIC_InitStruct)
Initializes the NVIC peripheral according to the specified parameters in the NVIC_InitStruct.
Definition: misc.c:87
NVIC_InitType
Structure definition of NVIC initialization.
Definition: misc.h:51
IS_NVIC_PREEMPTION_PRIORITY
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY)
Definition: misc.h:89
NVIC_InitType::NVIC_IRQChannelPreemptionPriority
uint8_t NVIC_IRQChannelPreemptionPriority
Definition: misc.h:58
NVIC_InitType::NVIC_IRQChannel
uint8_t NVIC_IRQChannel
Definition: misc.h:53
SystemSleepCmd
void SystemSleepCmd(FunctionalState NewState)
Enables or disables sleep/stop mode on system level.
Definition: misc.c:116