• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2   ******************************************************************************
3   * @file           : main.c
4   * @brief          : Main program body
5   ******************************************************************************
6   * @attention
7   *
8   * Copyright (c) 2021 Nuclei Limited. All rights reserved.
9   * All rights reserved.
10   *
11   * This software component is licensed by ST under BSD 3-Clause license,
12   * the "License"; You may not use this file except in compliance with the
13   * License. You may obtain a copy of the License at:
14   *                        opensource.org/licenses/BSD-3-Clause
15   *
16   ******************************************************************************
17   */
18 /* Includes ------------------------------------------------------------------*/
19 #include <stdio.h>
20 #include "nuclei_sdk_hal.h"
21 #include "task_sample.h"
22 #include "target_config.h"
23 
user_key_exti_config()24 void user_key_exti_config()
25 {
26     /* enable the AF clock */
27     rcu_periph_clock_enable(RCU_AF);
28 
29     /* connect EXTI line to key GPIO pin */
30     gpio_exti_source_select(WAKEUP_KEY_EXTI_PORT_SOURCE, WAKEUP_KEY_EXTI_PIN_SOURCE);
31 
32     /* configure key EXTI line */
33     exti_init(EXTI_0, EXTI_INTERRUPT, EXTI_TRIG_FALLING);
34     exti_interrupt_flag_clear(EXTI_0);
35 }
36 /**
37   * @brief  The application entry point.
38   * @retval int
39   */
main(void)40 int main(void)
41 {
42     /* USER CODE BEGIN Init */
43     gd_rvstar_key_init(WAKEUP_KEY_GPIO_PORT, KEY_MODE_EXTI);
44     user_key_exti_config();
45     RunTaskSample();
46     while (1) {
47     }
48 }
49 /************************ (C) COPYRIGHT Nuclei *****END OF FILE****/
50