| BlueNRG-1 Peripherals drivers Examples

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

GPIO_IOWakeup_main.c
Go to the documentation of this file.
1
2 /******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
3 * File Name : GPIO_IOWakeup_main.c
4 * Author : VMA DIVISION
5 * Version : 1.0.0
6 * Date : 21-September-2015
7 * Description : Code demostrating the GPIO interrupt functionality
8 ********************************************************************************
9 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
10 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
11 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
12 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
13 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
14 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
15 *******************************************************************************/
16
156 /* Includes ------------------------------------------------------------------*/
157 #include "BlueNRG1.h"
158 #include "BlueNRG1_it.h"
159 #include "BlueNRG1_conf.h"
160 #include "SDK_EVAL_Config.h"
161
174 /* Private typedef -----------------------------------------------------------*/
175 /* Private define ------------------------------------------------------------*/
176 #define SYST_CLOCK 16000000 /* System clock frequency */
177
178 /* Private macro -------------------------------------------------------------*/
179 /* Private variables ---------------------------------------------------------*/
180 /* Private function prototypes -----------------------------------------------*/
181 void SWDClk_Interrupt_Configuration(void);
182
183 /* Private functions ---------------------------------------------------------*/
184
185
191 int main(void)
192 {
193 /* System initialization function */
194 SystemInit();
195
196 /* Identify BlueNRG1 platform */
197 SdkEvalIdentification();
198
199 /* Clear pending interrupt on cortex */
200 NVIC->ICPR[0] = 0xFFFFFFFF;
201
202 /* LED initialization */
203 SdkEvalLedInit(LED1);
204 SdkEvalLedInit(LED2);
205
206 /* Configure BUTTON_1 as interrupt sources */
207 SdkEvalPushButtonInit(BUTTON_1);
208 SdkEvalPushButtonIrq(BUTTON_1, IRQ_ON_BOTH_EDGE);
209
210 /* Configure SWD Clock as interrupt sources */
211 SWDClk_Interrupt_Configuration();
212
213 /* Cortex will enter in deep sleep mode when WFI command is executed */
214 SystemSleepCmd(ENABLE);
215 __WFI();
216
217 /* Configure SysTick to generate interrupt with 500ms period */
218 SysTick_Config(SYST_CLOCK/4 - 1);
219
220 /* Infinite loop */
221 while(1);
222 }
223
224
231 void SWDClk_Interrupt_Configuration(void)
232 {
233 /* Configure SWD_CLK as source of interrupt */
234 GPIO_EXTIConfigType GPIO_EXTIStructure;
235 GPIO_EXTIStructure.GPIO_Pin = SWD_CLK_PIN;
236 GPIO_EXTIStructure.GPIO_IrqSense = GPIO_IrqSense_Edge;
237 GPIO_EXTIStructure.GPIO_Event = GPIO_Event_High;
238 GPIO_EXTIConfig( &GPIO_EXTIStructure);
239
240 /* Clear GPIO pending interrupt on SWD_CLK */
241 GPIO_ClearITPendingBit(SWD_CLK_PIN);
242
243 /* Enable interrupt on WD_CLK*/
244 GPIO_EXTICmd(SWD_CLK_PIN, ENABLE);
245 }
246
247
248
249 #ifdef USE_FULL_ASSERT
250
257 void assert_failed(uint8_t* file, uint32_t line)
258 {
259 /* User can add his own implementation to report the file name and line number,
260 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
261
262 /* Infinite loop */
263 while (1)
264 {
265 }
266 }
267
268 #endif
269
282 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
SYST_CLOCK
#define SYST_CLOCK
Definition: GPIO_IOWakeup_main.c:176
main
int main(void)
Main program code.
Definition: GPIO_IOWakeup_main.c:191
SWDClk_Interrupt_Configuration
void SWDClk_Interrupt_Configuration(void)
GPIO Interrupt Configuration. Configure interrupt on rising edge on SWD_CLK_PIN.
Definition: GPIO_IOWakeup_main.c:231