STM8S/A Standard Peripherals Drivers
|
stm8s_beep.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm8s_beep.h 00004 * @author MCD Application Team 00005 * @version V2.3.0 00006 * @date 16-June-2017 00007 * @brief This file contains all functions prototype and macros for the BEEP peripheral. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 00029 /* Define to prevent recursive inclusion -------------------------------------*/ 00030 #ifndef __STM8S_BEEP_H 00031 #define __STM8S_BEEP_H 00032 00033 /* Includes ------------------------------------------------------------------*/ 00034 #include "stm8s.h" 00035 00036 /* Exported types ------------------------------------------------------------*/ 00037 00038 /** @addtogroup BEEP_Exported_Types 00039 * @{ 00040 */ 00041 00042 /** 00043 * @brief BEEP Frequency selection 00044 */ 00045 typedef enum { 00046 BEEP_FREQUENCY_1KHZ = (uint8_t)0x00, /*!< Beep signal output frequency equals to 1 KHz */ 00047 BEEP_FREQUENCY_2KHZ = (uint8_t)0x40, /*!< Beep signal output frequency equals to 2 KHz */ 00048 BEEP_FREQUENCY_4KHZ = (uint8_t)0x80 /*!< Beep signal output frequency equals to 4 KHz */ 00049 } BEEP_Frequency_TypeDef; 00050 00051 /** 00052 * @} 00053 */ 00054 00055 /* Exported constants --------------------------------------------------------*/ 00056 00057 /** @addtogroup BEEP_Exported_Constants 00058 * @{ 00059 */ 00060 00061 #define BEEP_CALIBRATION_DEFAULT ((uint8_t)0x0B) /*!< Default value when calibration is not done */ 00062 00063 #define LSI_FREQUENCY_MIN ((uint32_t)110000) /*!< LSI minimum value in Hertz */ 00064 #define LSI_FREQUENCY_MAX ((uint32_t)150000) /*!< LSI maximum value in Hertz */ 00065 00066 /** 00067 * @} 00068 */ 00069 00070 /* Exported macros -----------------------------------------------------------*/ 00071 /* Private macros ------------------------------------------------------------*/ 00072 00073 /** @addtogroup BEEP_Private_Macros 00074 * @{ 00075 */ 00076 00077 /** 00078 * @brief Macro used by the assert function to check the different functions parameters. 00079 */ 00080 00081 /** 00082 * @brief Macro used by the assert function to check the BEEP frequencies. 00083 */ 00084 #define IS_BEEP_FREQUENCY_OK(FREQ) \ 00085 (((FREQ) == BEEP_FREQUENCY_1KHZ) || \ 00086 ((FREQ) == BEEP_FREQUENCY_2KHZ) || \ 00087 ((FREQ) == BEEP_FREQUENCY_4KHZ)) 00088 00089 /** 00090 * @brief Macro used by the assert function to check the LSI frequency (in Hz). 00091 */ 00092 #define IS_LSI_FREQUENCY_OK(FREQ) \ 00093 (((FREQ) >= LSI_FREQUENCY_MIN) && \ 00094 ((FREQ) <= LSI_FREQUENCY_MAX)) 00095 00096 /** 00097 * @} 00098 */ 00099 00100 /* Exported functions ------------------------------------------------------- */ 00101 00102 /** @addtogroup BEEP_Exported_Functions 00103 * @{ 00104 */ 00105 00106 void BEEP_DeInit(void); 00107 void BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency); 00108 void BEEP_Cmd(FunctionalState NewState); 00109 void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz); 00110 00111 00112 /** 00113 * @} 00114 */ 00115 00116 #endif /* __STM8S_BEEP_H */ 00117 00118 00119 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/