| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

BlueNRG1_sysCtrl.h
Go to the documentation of this file.
1
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef BLUENRG1_SYSCTRL_H
25 #define BLUENRG1_SYSCTRL_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /* Includes ------------------------------------------------------------------*/
32 #include "BlueNRG1.h"
33
50 typedef enum
51 {
52 RESET_NONE,
53 RESET_SYSREQ,
54 RESET_WDG,
55 RESET_LOCKUP,
56 RESET_BLE_BOR,
57 RESET_BLE_POR,
58 RESET_BLE_WAKEUP_FROM_IO9,
59 RESET_BLE_WAKEUP_FROM_IO10,
60 RESET_BLE_WAKEUP_FROM_IO11,
61 RESET_BLE_WAKEUP_FROM_IO12,
62 RESET_BLE_WAKEUP_FROM_IO13,
63 RESET_BLE_WAKEUP_FROM_TIMER1,
64 RESET_BLE_WAKEUP_FROM_TIMER2,
65 } RESET_REASON_Type;
66
67
79 #define CLOCK_PERIPH_GPIO ((uint32_t)0x00000001)
80 #define CLOCK_PERIPH_NVM ((uint32_t)0x00000002)
81 #define CLOCK_PERIPH_SYS_CONTROL ((uint32_t)0x00000004)
82 #define CLOCK_PERIPH_UART ((uint32_t)0x00000008)
83 #define CLOCK_PERIPH_SPI ((uint32_t)0x00000010)
84 #define CLOCK_PERIPH_WDG ((uint32_t)0x00000080)
85 #define CLOCK_PERIPH_ADC ((uint32_t)0x00000100)
86 #define CLOCK_PERIPH_I2C1 ((uint32_t)0x00000200)
87 #define CLOCK_PERIPH_I2C2 ((uint32_t)0x00000400)
88 #define CLOCK_PERIPH_MTFX1 ((uint32_t)0x00000800)
89 #define CLOCK_PERIPH_MTFX2 ((uint32_t)0x00001000)
90 #define CLOCK_PERIPH_RTC ((uint32_t)0x00002000)
91 #define CLOCK_PERIPH_DMA ((uint32_t)0x00010000)
92 #define CLOCK_PERIPH_RNG ((uint32_t)0x00020000)
93
94 #define IS_CLOCK_PERIPH(PERIPH) ((PERIPH & 0x00033F9F) != 0)
95
105 #define WAKEUP_ON_IO9 ((uint8_t)0x01) /* Wakeup source is IO9 */
106 #define WAKEUP_ON_IO10 ((uint8_t)0x02) /* Wakeup source is IO10 */
107 #define WAKEUP_ON_IO11 ((uint8_t)0x04) /* Wakeup source is IO11 */
108 #define WAKEUP_ON_IO12 ((uint8_t)0x08) /* Wakeup source is IO12 */
109 #define WAKEUP_ON_IO13 ((uint8_t)0x10) /* Wakeup source is IO13 */
110
111 #define WAKEUP_ON_HIGH_STATE ((uint8_t)0) /* Wakeup on high state */
112 #define WAKEUP_ON_LOW_STATE ((uint8_t)1) /* Wakeup on low state */
113
114 #define IS_WAKEUP_ON_IO(IOS) ((IOS & 0x1F) != 0)
115
116 #define IS_WAKEUP_ON_STATE(STATE) ( ((STATE) == WAKEUP_ON_HIGH_STATE) || ((STATE) == WAKEUP_ON_LOW_STATE) )
117
127 #define XO_32MHZ ((uint8_t)1) /* The external clock XO used is a 32 MHz */
128 #define XO_16MHZ ((uint8_t)0) /* The external clock XO used is a 16 MHz */
129
130 #define IS_XO_FREQ(XO) ( ((XO) == XO_32MHZ) || ((XO) == XO_16MHZ) )
131
147 void SysCtrl_DeInit(void);
148 void SysCtrl_PeripheralClockCmd(uint32_t PeriphClock, FunctionalState NewState);
149 RESET_REASON_Type SysCtrl_GetWakeupResetReason(void);
150
151 void SysCtrl_WakeupFromIo(uint8_t IO, uint8_t LevelState, FunctionalState NewState);
152 void SysCtrl_SelectXO(uint8_t XOFreq);
153
154
167 #ifdef __cplusplus
168 }
169 #endif
170
171 #endif /* BLUENRG1_SYSCTRL_H */
172
173 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
RESET_BLE_WAKEUP_FROM_IO10
Definition: BlueNRG1_sysCtrl.h:59
RESET_REASON_Type
RESET_REASON_Type
System Reset and Wakeup Sources.
Definition: BlueNRG1_sysCtrl.h:50
RESET_BLE_WAKEUP_FROM_IO11
Definition: BlueNRG1_sysCtrl.h:60
SysCtrl_SelectXO
void SysCtrl_SelectXO(uint8_t XOFreq)
Enable disable the XO clock divider for the system control.
Definition: BlueNRG1_sysCtrl.c:253
RESET_BLE_WAKEUP_FROM_IO12
Definition: BlueNRG1_sysCtrl.h:61
SysCtrl_DeInit
void SysCtrl_DeInit(void)
De init function.
Definition: BlueNRG1_sysCtrl.c:100
RESET_LOCKUP
Definition: BlueNRG1_sysCtrl.h:55
SysCtrl_PeripheralClockCmd
void SysCtrl_PeripheralClockCmd(uint32_t PeriphClock, FunctionalState NewState)
Enables the clock for the specified peripheral.
Definition: BlueNRG1_sysCtrl.c:132
RESET_NONE
Definition: BlueNRG1_sysCtrl.h:52
RESET_WDG
Definition: BlueNRG1_sysCtrl.h:54
RESET_BLE_WAKEUP_FROM_TIMER2
Definition: BlueNRG1_sysCtrl.h:64
RESET_BLE_WAKEUP_FROM_TIMER1
Definition: BlueNRG1_sysCtrl.h:63
SysCtrl_GetWakeupResetReason
RESET_REASON_Type SysCtrl_GetWakeupResetReason(void)
Get the wakeup reason.
Definition: BlueNRG1_sysCtrl.c:151
RESET_BLE_WAKEUP_FROM_IO13
Definition: BlueNRG1_sysCtrl.h:62
SysCtrl_WakeupFromIo
void SysCtrl_WakeupFromIo(uint8_t IO, uint8_t LevelState, FunctionalState NewState)
Configure the wakeup source from IO.
Definition: BlueNRG1_sysCtrl.c:223
RESET_BLE_POR
Definition: BlueNRG1_sysCtrl.h:57
RESET_SYSREQ
Definition: BlueNRG1_sysCtrl.h:53
RESET_BLE_BOR
Definition: BlueNRG1_sysCtrl.h:56
RESET_BLE_WAKEUP_FROM_IO9
Definition: BlueNRG1_sysCtrl.h:58