apm32f10x_misc.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*!
  2. * @file apm32f10x_misc.h
  3. *
  4. * @brief This file provides all the miscellaneous firmware functions.
  5. * Include NVIC,SystemTick and Power management.
  6. *
  7. * @version V1.0.1
  8. *
  9. * @date 2021-03-23
  10. *
  11. */
  12. #ifndef __APM32F10X_MISC_H
  13. #define __APM32F10X_MISC_H
  14. #include "apm32f10x.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /** @addtogroup Peripherals_Library Standard Peripheral Library
  19. @{
  20. */
  21. /** @addtogroup MISC_Driver MISC Driver
  22. @{
  23. */
  24. /** @addtogroup MISC_Enumerations Enumerations
  25. @{
  26. */
  27. /**
  28. * @brief NVIC Vect table
  29. */
  30. typedef enum
  31. {
  32. NVIC_VECT_TAB_RAM = 0x20000000,
  33. NVIC_VECT_TAB_FLASH = 0x08000000,
  34. }NVIC_VECT_TAB_T;
  35. /**
  36. * @brief system low power mode
  37. */
  38. typedef enum
  39. {
  40. NVIC_LOWPOWER_SEVONPEND = 0x10,
  41. NVIC_LOWPOWER_SLEEPDEEP = 0x04,
  42. NVIC_LOWPOWER_SLEEPONEXIT = 0x02
  43. }NVIC_LOWPOWER_T;
  44. /**
  45. * @brief nvic priority group
  46. */
  47. typedef enum
  48. {
  49. NVIC_PRIORITY_GROUP_0 = 0x700, //!< 0 bits for pre-emption priority,4 bits for subpriority
  50. NVIC_PRIORITY_GROUP_1 = 0x600, //!< 1 bits for pre-emption priority,3 bits for subpriority
  51. NVIC_PRIORITY_GROUP_2 = 0x500, //!< 2 bits for pre-emption priority,2 bits for subpriority
  52. NVIC_PRIORITY_GROUP_3 = 0x400, //!< 3 bits for pre-emption priority,1 bits for subpriority
  53. NVIC_PRIORITY_GROUP_4 = 0x300 //!< 4 bits for pre-emption priority,0 bits for subpriority
  54. }NVIC_PRIORITY_GROUP_T;
  55. /**
  56. * @brief SysTick Clock source
  57. */
  58. typedef enum
  59. {
  60. SYSTICK_CLK_SOURCE_HCLK_DIV8 = 0x00,
  61. SYSTICK_CLK_SOURCE_HCLK = 0x01
  62. }SYSTICK_CLK_SOURCE_T;
  63. /**@} end of group MISC_Enumerations*/
  64. /** @addtogroup MISC_Fuctions Fuctions
  65. @{
  66. */
  67. /** NVIC */
  68. void NVIC_ConfigPriorityGroup(NVIC_PRIORITY_GROUP_T priorityGroup);
  69. void NVIC_EnableIRQRequest(IRQn_Type irq, uint8_t preemptionPriority, uint8_t subPriority);
  70. void NVIC_DisableIRQRequest(IRQn_Type irq);
  71. /** Vector Table */
  72. void NVIC_ConfigVectorTable(NVIC_VECT_TAB_T vectTab, uint32_t offset);
  73. /** Power */
  74. void NVIC_SetSystemLowPower(NVIC_LOWPOWER_T lowPowerMode);
  75. void NVIC_ResetystemLowPower(NVIC_LOWPOWER_T lowPowerMode);
  76. /** Systick */
  77. void SysTick_ConfigCLKSource(SYSTICK_CLK_SOURCE_T clkSource);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* __APM32F10X_MISC_H */