apm32s10x_bakpr.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*!
  2. * @file apm32s10x_bakr.h
  3. *
  4. * @brief This file contains all the functions prototypes for the BAKPR firmware library.
  5. *
  6. * @version V1.0.1
  7. *
  8. * @date 2022-12-31
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2022-2023 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be usefull and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32S10X_BAKPR_H
  27. #define __APM32S10X_BAKPR_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32s10x.h"
  33. /** @addtogroup APM32S10x_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup BAKPR_Driver BAKPR Driver
  37. @{
  38. */
  39. /** @defgroup BAKPR_Enumerations Enumerations
  40. @{
  41. */
  42. /**
  43. * @brief BAKPR TAMPER Pin Active Level
  44. */
  45. typedef enum
  46. {
  47. BAKPR_TAMPER_PIN_LEVEL_HIGH,
  48. BAKPR_TAMPER_PIN_LEVEL_LOW
  49. } BAKPR_TAMPER_PIN_LEVEL_T;
  50. /**
  51. * @brief BAKPR RTC output source
  52. */
  53. typedef enum
  54. {
  55. BAKPR_RTC_OUTPUT_SOURCE_NONE,
  56. BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK,
  57. BAKPR_RTC_OUTPUT_SOURCE_ALARM,
  58. BAKPR_RTC_OUTPUT_SOURCE_SECOND
  59. } BAKPR_RTC_OUTPUT_SOURCE_T;
  60. /**
  61. * @brief BAKPR DATA register Addr
  62. */
  63. typedef enum
  64. {
  65. BAKPR_DATA1 = ((uint16_t)0x0004),
  66. BAKPR_DATA2 = ((uint16_t)0x0008),
  67. BAKPR_DATA3 = ((uint16_t)0x000C),
  68. BAKPR_DATA4 = ((uint16_t)0x0010),
  69. BAKPR_DATA5 = ((uint16_t)0x0014),
  70. BAKPR_DATA6 = ((uint16_t)0x0018),
  71. BAKPR_DATA7 = ((uint16_t)0x001C),
  72. BAKPR_DATA8 = ((uint16_t)0x0020),
  73. BAKPR_DATA9 = ((uint16_t)0x0024),
  74. BAKPR_DATA10 = ((uint16_t)0x0028)
  75. } BAKPR_DATA_T;
  76. /**@} end of group BAKPR_Enumerations */
  77. /** @defgroup BAKPR_Functions Functions
  78. @{
  79. */
  80. /* BAKPR reset and configuration */
  81. void BAKPR_Reset(void);
  82. void BAKPR_ConfigTamperPinLevel(BAKPR_TAMPER_PIN_LEVEL_T value);
  83. void BAKPR_EnableTamperPin(void);
  84. void BAKPR_DisableTamperPin(void);
  85. void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure);
  86. void BAKPR_ConfigRTCCalibrationValue(uint8_t calibrationValue);
  87. void BAKPR_ConfigBackupRegister(BAKPR_DATA_T bakrData, uint16_t data);
  88. uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData);
  89. /* Interrupts and flags */
  90. void BAKPR_EnableInterrupt(void);
  91. void BAKPR_DisableInterrupt(void);
  92. uint8_t BAKPR_ReadStatusFlag(void);
  93. void BAKPR_ClearStatusFlag(void);
  94. uint8_t BAKPR_ReadIntFlag(void);
  95. void BAKPR_ClearIntFlag(void);
  96. /**@} end of group BAKPR_Functions */
  97. /**@} end of group BAKPR_Driver */
  98. /**@} end of group APM32S10x_StdPeriphDriver */
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102. #endif /* __APM32S10X_BAKPR_H */