libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
COMP Defines

libopencm3 Defined Constants and Types for the STM32F0xx Comparator module More...

Collaboration diagram for COMP Defines:

Macros

#define COMP1   0
 
#define COMP2   1
 
#define COMP_CSR(i)   MMIO16(SYSCFG_COMP_BASE + 0x1c + (i)*2)
 
#define COMP_CSR1   COMP_CSR(COMP1)
 
#define COMP_CSR2   COMP_CSR(COMP2)
 
#define COMP_CSR_LOCK   (1 << 15)
 
#define COMP_CSR_OUT   (1 << 14)
 
#define COMP_CSR_HYST_SHIFT   12
 
#define COMP_CSR_HYST   (3 << COMP_CSR_HYST_SHIFT)
 
#define COMP_CSR_HYST_NO   (0 << COMP_CSR_HYST_SHIFT)
 
#define COMP_CSR_HYST_LOW   (1 << COMP_CSR_HYST_SHIFT)
 
#define COMP_CSR_HYST_MED   (2 << COMP_CSR_HYST_SHIFT)
 
#define COMP_CSR_HYST_HIGH   (3 << COMP_CSR_HYST_SHIFT)
 
#define COMP_CSR_POL   (1 << 11)
 
#define COMP_CSR_OUTSEL_SHIFT   8
 
#define COMP_CSR_OUTSEL   (7 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_NONE   (0 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM1_BRK   (1 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM1_IC1   (2 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM1_OCRCLR   (3 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM2_IC4   (4 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM2_OCRCLR   (5 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM3_IC1   (6 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_TIM3_OCRCLR   (7 << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_WINDWEN   (1 << 23)
 
#define COMP_CSR_INSEL_SHIFT   4
 
#define COMP_CSR_INSEL   (7 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_1_4_VREFINT   (0 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_2_4_VREFINT   (1 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_3_4_VREFINT   (2 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_4_4_VREFINT   (3 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_VREFINT   (3 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_INM4   (4 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_INM5   (5 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_INSEL_INM6   (6 << COMP_CSR_INSEL_SHIFT)
 
#define COMP_CSR_SPEED_SHIFT   2
 
#define COMP_CSR_SPEED   (3 << COMP_CSR_SPEED_SHIFT)
 
#define COMP_CSR_SPEED_HIGH   (0 << COMP_CSR_SPEED_SHIFT)
 
#define COMP_CSR_SPEED_MED   (1 << COMP_CSR_SPEED_SHIFT)
 
#define COMP_CSR_SPEED_LOW   (2 << COMP_CSR_SPEED_SHIFT)
 
#define COMP_CSR_SPEED_VERYLOW   (3 << COMP_CSR_SPEED_SHIFT)
 
#define COMP_CSR_SW1   (1 << 1)
 
#define COMP_CSR_EN   (1 << 0)
 

Functions

void comp_enable (uint8_t id)
 
void comp_disable (uint8_t id)
 
void comp_select_input (uint8_t id, uint32_t input)
 
void comp_select_output (uint8_t id, uint32_t output)
 
void comp_select_hyst (uint8_t id, uint32_t hyst)
 
void comp_select_speed (uint8_t id, uint32_t speed)
 

Detailed Description

libopencm3 Defined Constants and Types for the STM32F0xx Comparator module

Version
1.0.0
Date
29 Jun 2013

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ COMP1

#define COMP1   0

Definition at line 41 of file f0/comparator.h.

◆ COMP2

#define COMP2   1

Definition at line 42 of file f0/comparator.h.

◆ COMP_CSR

#define COMP_CSR (   i)    MMIO16(SYSCFG_COMP_BASE + 0x1c + (i)*2)

Definition at line 48 of file f0/comparator.h.

◆ COMP_CSR1

#define COMP_CSR1   COMP_CSR(COMP1)

Definition at line 49 of file f0/comparator.h.

◆ COMP_CSR2

#define COMP_CSR2   COMP_CSR(COMP2)

Definition at line 50 of file f0/comparator.h.

◆ COMP_CSR_EN

#define COMP_CSR_EN   (1 << 0)

Definition at line 102 of file f0/comparator.h.

◆ COMP_CSR_HYST

#define COMP_CSR_HYST   (3 << COMP_CSR_HYST_SHIFT)

Definition at line 62 of file f0/comparator.h.

◆ COMP_CSR_HYST_HIGH

#define COMP_CSR_HYST_HIGH   (3 << COMP_CSR_HYST_SHIFT)

Definition at line 66 of file f0/comparator.h.

◆ COMP_CSR_HYST_LOW

#define COMP_CSR_HYST_LOW   (1 << COMP_CSR_HYST_SHIFT)

Definition at line 64 of file f0/comparator.h.

◆ COMP_CSR_HYST_MED

#define COMP_CSR_HYST_MED   (2 << COMP_CSR_HYST_SHIFT)

Definition at line 65 of file f0/comparator.h.

◆ COMP_CSR_HYST_NO

#define COMP_CSR_HYST_NO   (0 << COMP_CSR_HYST_SHIFT)

Definition at line 63 of file f0/comparator.h.

◆ COMP_CSR_HYST_SHIFT

#define COMP_CSR_HYST_SHIFT   12

Definition at line 61 of file f0/comparator.h.

◆ COMP_CSR_INSEL

#define COMP_CSR_INSEL   (7 << COMP_CSR_INSEL_SHIFT)

Definition at line 84 of file f0/comparator.h.

◆ COMP_CSR_INSEL_1_4_VREFINT

#define COMP_CSR_INSEL_1_4_VREFINT   (0 << COMP_CSR_INSEL_SHIFT)

Definition at line 85 of file f0/comparator.h.

◆ COMP_CSR_INSEL_2_4_VREFINT

#define COMP_CSR_INSEL_2_4_VREFINT   (1 << COMP_CSR_INSEL_SHIFT)

Definition at line 86 of file f0/comparator.h.

◆ COMP_CSR_INSEL_3_4_VREFINT

#define COMP_CSR_INSEL_3_4_VREFINT   (2 << COMP_CSR_INSEL_SHIFT)

Definition at line 87 of file f0/comparator.h.

◆ COMP_CSR_INSEL_4_4_VREFINT

#define COMP_CSR_INSEL_4_4_VREFINT   (3 << COMP_CSR_INSEL_SHIFT)

Definition at line 88 of file f0/comparator.h.

◆ COMP_CSR_INSEL_INM4

#define COMP_CSR_INSEL_INM4   (4 << COMP_CSR_INSEL_SHIFT)

Definition at line 90 of file f0/comparator.h.

◆ COMP_CSR_INSEL_INM5

#define COMP_CSR_INSEL_INM5   (5 << COMP_CSR_INSEL_SHIFT)

Definition at line 91 of file f0/comparator.h.

◆ COMP_CSR_INSEL_INM6

#define COMP_CSR_INSEL_INM6   (6 << COMP_CSR_INSEL_SHIFT)

Definition at line 92 of file f0/comparator.h.

◆ COMP_CSR_INSEL_SHIFT

#define COMP_CSR_INSEL_SHIFT   4

Definition at line 83 of file f0/comparator.h.

◆ COMP_CSR_INSEL_VREFINT

#define COMP_CSR_INSEL_VREFINT   (3 << COMP_CSR_INSEL_SHIFT)

Definition at line 89 of file f0/comparator.h.

◆ COMP_CSR_LOCK

#define COMP_CSR_LOCK   (1 << 15)

Definition at line 58 of file f0/comparator.h.

◆ COMP_CSR_OUT

#define COMP_CSR_OUT   (1 << 14)

Definition at line 59 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL

#define COMP_CSR_OUTSEL   (7 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 71 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_NONE

#define COMP_CSR_OUTSEL_NONE   (0 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 72 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_SHIFT

#define COMP_CSR_OUTSEL_SHIFT   8

Definition at line 70 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM1_BRK

#define COMP_CSR_OUTSEL_TIM1_BRK   (1 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 73 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM1_IC1

#define COMP_CSR_OUTSEL_TIM1_IC1   (2 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 74 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM1_OCRCLR

#define COMP_CSR_OUTSEL_TIM1_OCRCLR   (3 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 75 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM2_IC4

#define COMP_CSR_OUTSEL_TIM2_IC4   (4 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 76 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM2_OCRCLR

#define COMP_CSR_OUTSEL_TIM2_OCRCLR   (5 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 77 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM3_IC1

#define COMP_CSR_OUTSEL_TIM3_IC1   (6 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 78 of file f0/comparator.h.

◆ COMP_CSR_OUTSEL_TIM3_OCRCLR

#define COMP_CSR_OUTSEL_TIM3_OCRCLR   (7 << COMP_CSR_OUTSEL_SHIFT)

Definition at line 79 of file f0/comparator.h.

◆ COMP_CSR_POL

#define COMP_CSR_POL   (1 << 11)

Definition at line 68 of file f0/comparator.h.

◆ COMP_CSR_SPEED

#define COMP_CSR_SPEED   (3 << COMP_CSR_SPEED_SHIFT)

Definition at line 95 of file f0/comparator.h.

◆ COMP_CSR_SPEED_HIGH

#define COMP_CSR_SPEED_HIGH   (0 << COMP_CSR_SPEED_SHIFT)

Definition at line 96 of file f0/comparator.h.

◆ COMP_CSR_SPEED_LOW

#define COMP_CSR_SPEED_LOW   (2 << COMP_CSR_SPEED_SHIFT)

Definition at line 98 of file f0/comparator.h.

◆ COMP_CSR_SPEED_MED

#define COMP_CSR_SPEED_MED   (1 << COMP_CSR_SPEED_SHIFT)

Definition at line 97 of file f0/comparator.h.

◆ COMP_CSR_SPEED_SHIFT

#define COMP_CSR_SPEED_SHIFT   2

Definition at line 94 of file f0/comparator.h.

◆ COMP_CSR_SPEED_VERYLOW

#define COMP_CSR_SPEED_VERYLOW   (3 << COMP_CSR_SPEED_SHIFT)

Definition at line 99 of file f0/comparator.h.

◆ COMP_CSR_SW1

#define COMP_CSR_SW1   (1 << 1)

Definition at line 101 of file f0/comparator.h.

◆ COMP_CSR_WINDWEN

#define COMP_CSR_WINDWEN   (1 << 23)

Definition at line 81 of file f0/comparator.h.

Function Documentation

◆ comp_disable()

void comp_disable ( uint8_t  id)

Definition at line 38 of file comparator.c.

References COMP_CSR.

◆ comp_enable()

void comp_enable ( uint8_t  id)

Definition at line 33 of file comparator.c.

References COMP_CSR, and COMP_CSR_EN.

◆ comp_select_hyst()

void comp_select_hyst ( uint8_t  id,
uint32_t  hyst 
)

Definition at line 53 of file comparator.c.

References COMP_CSR.

◆ comp_select_input()

void comp_select_input ( uint8_t  id,
uint32_t  input 
)

Definition at line 43 of file comparator.c.

References COMP_CSR.

◆ comp_select_output()

void comp_select_output ( uint8_t  id,
uint32_t  output 
)

Definition at line 48 of file comparator.c.

References COMP_CSR.

◆ comp_select_speed()

void comp_select_speed ( uint8_t  id,
uint32_t  speed 
)

Definition at line 58 of file comparator.c.

References COMP_CSR.