MG32L003 Standard Peripherals Firmware Library

mg32l003_beep.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32L003_BEEP_H
12 #define __MG32L003_BEEP_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32l003.h"
20
29 /* Exported types ------------------------------------------------------------*/
30
34 typedef struct
35 {
36 uint32_t BEEP_ClkSel;
39 uint32_t BEEP_Prescaler;
42 uint32_t BEEP_OutDiv;
45 } BEEP_InitTypeDef;
46
47 /* Exported constants --------------------------------------------------------*/
48
53 #define IS_BEEP_ALL_PERIPH(PERIPH) (((PERIPH) == BEEP))
54
58 #define BEEP_ClkSel_STOP ((uint32_t)(0x00U << BEEP_CSR_CLKSEL_Pos))
59 #define BEEP_ClkSel_LSI ((uint32_t)(0x01U << BEEP_CSR_CLKSEL_Pos))
60 #define BEEP_ClkSel_HSE ((uint32_t)(0x02U << BEEP_CSR_CLKSEL_Pos))
61 #define BEEP_ClkSel_PCLK ((uint32_t)(0x03U << BEEP_CSR_CLKSEL_Pos))
62
70 #define BEEP_OutDiv8 ((uint32_t)(0x00U << BEEP_CSR_BEEPSEL_Pos))
71 #define BEEP_OutDiv4 ((uint32_t)(0x01U << BEEP_CSR_BEEPSEL_Pos))
72 #define BEEP_OutDiv2 ((uint32_t)(0x02U << BEEP_CSR_BEEPSEL_Pos))
73
81 /* Exported macro ------------------------------------------------------------*/
82
83 #define IS_BEEP_CLK_SEL(SEL) (((SEL) == BEEP_ClkSel_STOP) || \
84 ((SEL) == BEEP_ClkSel_LSI) || \
85 ((SEL) == BEEP_ClkSel_HSE) || \
86 ((SEL) == BEEP_ClkSel_PCLK))
87
88 #define IS_BEEP_PRESCALER(PRESCALER) ((PRESCALER) < 4096)
89
90 #define IS_BEEP_OUT_DIV(DIV) (((DIV) == BEEP_OutDiv2) || \
91 ((DIV) == BEEP_OutDiv4) || \
92 ((DIV) == BEEP_OutDiv8))
93
94 /* Exported functions --------------------------------------------------------*/
95
96 void BEEP_DeInit(BEEP_TypeDef* BEEPx);
97 void BEEP_Init(BEEP_TypeDef* BEEPx, BEEP_InitTypeDef *BEEP_InitStruct);
98 void BEEP_Cmd(BEEP_TypeDef* BEEPx, FunctionalState NewState);
99
108 #ifdef __cplusplus
109 }
110 #endif
111
112 #endif /*__MG32L003_BEEP_H */
BEEP_Cmd
void BEEP_Cmd(BEEP_TypeDef *BEEPx, FunctionalState NewState)
Enables or disables BEEP peripheral.
Definition: mg32l003_beep.c:84
BEEP_InitTypeDef::BEEP_Prescaler
uint32_t BEEP_Prescaler
Definition: mg32l003_beep.h:39
BEEP_Init
void BEEP_Init(BEEP_TypeDef *BEEPx, BEEP_InitTypeDef *BEEP_InitStruct)
Initializes the BEEP peripheral according to the specified parameters in the BEEP_InitStruct.
Definition: mg32l003_beep.c:61
BEEP_InitTypeDef::BEEP_ClkSel
uint32_t BEEP_ClkSel
Definition: mg32l003_beep.h:36
BEEP_TypeDef
Definition: mg32l003.h:395
BEEP_DeInit
void BEEP_DeInit(BEEP_TypeDef *BEEPx)
Deinitializes the BEEP peripheral registers to their default reset values.
Definition: mg32l003_beep.c:40
BEEP_InitTypeDef::BEEP_OutDiv
uint32_t BEEP_OutDiv
Definition: mg32l003_beep.h:42
BEEP_InitTypeDef
BEEP Init structure definition
Definition: mg32l003_beep.h:34