stm8l15x_beep.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_beep.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the BEEP firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_BEEP_H
  30. #define __STM8L15x_BEEP_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup BEEP
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup BEEP_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup BEEP_Frequency
  44. * @{
  45. */
  46. typedef enum {
  47. BEEP_Frequency_1KHz = (uint8_t)0x00, /*!< Beep signal output frequency 1 KHz */
  48. BEEP_Frequency_2KHz = (uint8_t)0x40, /*!< Beep signal output frequency 2 KHz */
  49. BEEP_Frequency_4KHz = (uint8_t)0x80 /*!< Beep signal output frequency 4 KHz */
  50. } BEEP_Frequency_TypeDef;
  51. #define IS_BEEP_FREQUENCY(FREQ) (((FREQ) == BEEP_Frequency_1KHz) || \
  52. ((FREQ) == BEEP_Frequency_2KHz) || \
  53. ((FREQ) == BEEP_Frequency_4KHz))
  54. /**
  55. * @}
  56. */
  57. /**
  58. * @}
  59. */
  60. /* Exported constants --------------------------------------------------------*/
  61. /** @defgroup BEEP_Exported_Constants
  62. * @{
  63. */
  64. #define BEEP_CALIBRATION_DEFAULT ((uint8_t)0x01) /*!< Default value when calibration is not done */
  65. #define LSI_FREQUENCY_MIN ((uint32_t)25000) /*!< LSI minimum value in Hertz */
  66. #define LSI_FREQUENCY_MAX ((uint32_t)75000) /*!< LSI maximum value in Hertz */
  67. /**
  68. * @}
  69. */
  70. /* Exported macros -----------------------------------------------------------*/
  71. /** @defgroup BEEP_Exported_Macros
  72. * @{
  73. */
  74. #define IS_LSI_FREQUENCY(FREQ) (((FREQ) >= LSI_FREQUENCY_MIN) && ((FREQ) <= LSI_FREQUENCY_MAX))
  75. /**
  76. * @}
  77. */
  78. /* Exported functions ------------------------------------------------------- */
  79. /* Function used to set the BEEP configuration to the default reset state *****/
  80. void BEEP_DeInit(void);
  81. /* Initialization and Configuration functions *********************************/
  82. void BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency);
  83. void BEEP_Cmd(FunctionalState NewState);
  84. /* Low Speed Internal Clock(LSI) Calibration functions ***********************/
  85. void BEEP_LSClockToTIMConnectCmd(FunctionalState NewState);
  86. void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz);
  87. #endif /* __STM8L15x_BEEP_H */
  88. /**
  89. * @}
  90. */
  91. /**
  92. * @}
  93. */
  94. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/