ch32v00X_exti.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v00X_exti.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2024/08/02
  6. * Description : This file contains all the functions prototypes for the
  7. * EXTI firmware library.
  8. *********************************************************************************
  9. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  10. * Attention: This software (modified or not) and binary are used for
  11. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  12. *******************************************************************************/
  13. #ifndef __CH32V00X_EXTI_H
  14. #define __CH32V00X_EXTI_H
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include <ch32v00X.h>
  19. /* EXTI mode enumeration */
  20. typedef enum
  21. {
  22. EXTI_Mode_Interrupt = 0x00,
  23. EXTI_Mode_Event = 0x04
  24. } EXTIMode_TypeDef;
  25. /* EXTI Trigger enumeration */
  26. typedef enum
  27. {
  28. EXTI_Trigger_Rising = 0x08,
  29. EXTI_Trigger_Falling = 0x0C,
  30. EXTI_Trigger_Rising_Falling = 0x10
  31. } EXTITrigger_TypeDef;
  32. /* EXTI Init Structure definition */
  33. typedef struct
  34. {
  35. uint32_t EXTI_Line; /* Specifies the EXTI lines to be enabled or disabled.
  36. This parameter can be any combination of @ref EXTI_Lines */
  37. EXTIMode_TypeDef EXTI_Mode; /* Specifies the mode for the EXTI lines.
  38. This parameter can be a value of @ref EXTIMode_TypeDef */
  39. EXTITrigger_TypeDef EXTI_Trigger; /* Specifies the trigger signal active edge for the EXTI lines.
  40. This parameter can be a value of @ref EXTIMode_TypeDef */
  41. FunctionalState EXTI_LineCmd; /* Specifies the new state of the selected EXTI lines.
  42. This parameter can be set either to ENABLE or DISABLE */
  43. } EXTI_InitTypeDef;
  44. /* EXTI_Lines */
  45. #define EXTI_Line0 ((uint32_t)0x00001) /* External interrupt line 0 */
  46. #define EXTI_Line1 ((uint32_t)0x00002) /* External interrupt line 1 */
  47. #define EXTI_Line2 ((uint32_t)0x00004) /* External interrupt line 2 */
  48. #define EXTI_Line3 ((uint32_t)0x00008) /* External interrupt line 3 */
  49. #define EXTI_Line4 ((uint32_t)0x00010) /* External interrupt line 4 */
  50. #define EXTI_Line5 ((uint32_t)0x00020) /* External interrupt line 5 */
  51. #define EXTI_Line6 ((uint32_t)0x00040) /* External interrupt line 6 */
  52. #define EXTI_Line7 ((uint32_t)0x00080) /* External interrupt line 7 */
  53. #define EXTI_Line8 ((uint32_t)0x00100) /* External interrupt line 8 Connected to the PVD Output */
  54. #define EXTI_Line9 ((uint32_t)0x00200) /* External interrupt line 9 Connected to the PWR Auto Wake-up event*/
  55. void EXTI_DeInit(void);
  56. void EXTI_Init(EXTI_InitTypeDef *EXTI_InitStruct);
  57. void EXTI_StructInit(EXTI_InitTypeDef *EXTI_InitStruct);
  58. void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
  59. FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
  60. void EXTI_ClearFlag(uint32_t EXTI_Line);
  61. ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
  62. void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* __CH32V00X_EXTI_H */