COMP driver modules. More...
Modules | |
COMP_Exported_Constants | |
COMP_Private_Functions | |
Classes | |
struct | COMP_InitTypeDef |
COMP Init structure definition. More... | |
Macros | |
#define | COMP_CSR_CLEAR_MASK ((uint32_t)0x00000003) |
Functions | |
void | COMP_Cmd (uint32_t COMP_Selection, FunctionalState NewState) |
Enable or disable the COMP peripheral. More... | |
void | COMP_DeInit (uint32_t COMP_Selection) |
Deinitializes COMP peripheral registers to their default reset values. More... | |
uint32_t | COMP_GetOutputLevel (uint32_t COMP_Selection) |
Return the output level (high or low) of the selected comparator. The output level depends on the selected polarity. If the polarity is not inverted: More... | |
void | COMP_Init (uint32_t COMP_Selection, COMP_InitTypeDef *COMP_InitStruct) |
Initializes the COMP peripheral according to the specified parameters in COMP_InitStruct. More... | |
void | COMP_LockConfig (uint32_t COMP_Selection) |
Lock the selected comparator (COMP1/COMP2) configuration. More... | |
void | COMP_StructInit (COMP_InitTypeDef *COMP_InitStruct) |
Fills each COMP_InitStruct member with its default value. More... | |
void | COMP_SwitchCmd (uint32_t COMP_Selection, FunctionalState NewState) |
Close or Open the SW1 switch. More... | |
void | COMP_WindowCmd (uint32_t COMP_Selection, FunctionalState NewState) |
Enables or disables the window mode. Window mode for comparators makes use of two comparators: COMP1 and COM2, COMP3 and COMP4, COMP5 and COMP6. In window mode, COMPx and COMPx-1 (where x can be 2, 4 or 6) non inverting inputs are connected together and only COMPx-1 non inverting input can be used. e.g When window mode enabled for COMP4, COMP3 non inverting input (PB14 or PD14) is to be used. More... | |
COMP driver modules.
#define COMP_CSR_CLEAR_MASK ((uint32_t)0x00000003) |
Definition at line 181 of file stm32f30x_comp.c.
void COMP_Cmd | ( | uint32_t | COMP_Selection, |
FunctionalState | NewState | ||
) |
Enable or disable the COMP peripheral.
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 1 to 7 to select the COMP peripheral. |
NewState | new state of the COMP peripheral. This parameter can be: ENABLE or DISABLE. When enabled, the comparator compares the non inverting input with the inverting input and the comparison result is available on comparator output. When disabled, the comparator doesn't perform comparison and the output level is low. |
None |
Definition at line 311 of file stm32f30x_comp.c.
void COMP_DeInit | ( | uint32_t | COMP_Selection | ) |
Deinitializes COMP peripheral registers to their default reset values.
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 1 to 7 to select the COMP peripheral. |
None |
None |
< Set COMP_CSR register to reset value
Definition at line 214 of file stm32f30x_comp.c.
uint32_t COMP_GetOutputLevel | ( | uint32_t | COMP_Selection | ) |
Return the output level (high or low) of the selected comparator. The output level depends on the selected polarity. If the polarity is not inverted:
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 1 to 7 to select the COMP peripheral. |
Returns | the selected comparator output level: low or high. |
Definition at line 377 of file stm32f30x_comp.c.
void COMP_Init | ( | uint32_t | COMP_Selection, |
COMP_InitTypeDef * | COMP_InitStruct | ||
) |
Initializes the COMP peripheral according to the specified parameters in COMP_InitStruct.
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 1 to 7 to select the COMP peripheral. |
COMP_InitStruct | pointer to an COMP_InitTypeDef structure that contains the configuration information for the specified COMP peripheral.
|
None |
< Get the COMPx_CSR register value
< Clear the COMP1SW1, COMPxINSEL, COMPxOUTSEL, COMPxPOL, COMPxHYST and COMPxMODE bits
< Configure COMP: inverting input, output redirection, hysteresis value and power mode
< Set COMPxINSEL bits according to COMP_InitStruct->COMP_InvertingInput value
< Set COMPxNONINSEL bits according to COMP_InitStruct->COMP_NonInvertingInput value
< Set COMPxBLANKING bits according to COMP_InitStruct->COMP_BlankingSrce value
< Set COMPxOUTSEL bits according to COMP_InitStruct->COMP_Output value
< Set COMPxPOL bit according to COMP_InitStruct->COMP_OutputPol value
< Set COMPxHYST bits according to COMP_InitStruct->COMP_Hysteresis value
< Set COMPxMODE bits according to COMP_InitStruct->COMP_Mode value
< Write to COMPx_CSR register
Definition at line 242 of file stm32f30x_comp.c.
void COMP_LockConfig | ( | uint32_t | COMP_Selection | ) |
Lock the selected comparator (COMP1/COMP2) configuration.
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 1 to 7 to select the COMP peripheral. |
None |
Definition at line 479 of file stm32f30x_comp.c.
void COMP_StructInit | ( | COMP_InitTypeDef * | COMP_InitStruct | ) |
Fills each COMP_InitStruct member with its default value.
COMP_InitStruct | pointer to an COMP_InitTypeDef structure which will be initialized. |
None |
Definition at line 284 of file stm32f30x_comp.c.
void COMP_SwitchCmd | ( | uint32_t | COMP_Selection, |
FunctionalState | NewState | ||
) |
Close or Open the SW1 switch.
NewState | New state of the analog switch. This parameter can be ENABLE so the SW1 is closed; PA1 is connected to PA4 or DISABLE so the SW1 switch is open; PA1 is disconnected from PA4 |
None |
Definition at line 341 of file stm32f30x_comp.c.
void COMP_WindowCmd | ( | uint32_t | COMP_Selection, |
FunctionalState | NewState | ||
) |
Enables or disables the window mode. Window mode for comparators makes use of two comparators: COMP1 and COM2, COMP3 and COMP4, COMP5 and COMP6. In window mode, COMPx and COMPx-1 (where x can be 2, 4 or 6) non inverting inputs are connected together and only COMPx-1 non inverting input can be used. e.g When window mode enabled for COMP4, COMP3 non inverting input (PB14 or PD14) is to be used.
COMP_Selection | the selected comparator. This parameter can be COMP_Selection_COMPx where x can be 2, 4 or 6 to select the COMP peripheral. param NewState: new state of the window mode. This parameter can be ENABLE or DISABLE. When enbaled, COMPx and COMPx-1 non inverting inputs are connected together. When disabled, COMPx and COMPx-1 non inverting inputs are disconnected. |
None |
Definition at line 434 of file stm32f30x_comp.c.