libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
comparator.h File Reference

Go to the source code of this file.

Macros

#define COMP1   (COMP_BASE + 0x1C)
 
#define COMP2   (COMP_BASE + 0x20)
 
#define COMP3   (COMP_BASE + 0x24)
 
#define COMP4   (COMP_BASE + 0x28)
 
#define COMP5   (COMP_BASE + 0x2C)
 
#define COMP6   (COMP_BASE + 0x30)
 
#define COMP7   (COMP_BASE + 0x34)
 
#define COMP_CSR(comp_base)   MMIO32((comp_base) + 0x00)
 
#define COMP1_CSR   COMP_CSR(COMP1)
 
#define COMP2_CSR   COMP_CSR(COMP2)
 
#define COMP3_CSR   COMP_CSR(COMP3)
 
#define COMP4_CSR   COMP_CSR(COMP4)
 
#define COMP5_CSR   COMP_CSR(COMP5)
 
#define COMP6_CSR   COMP_CSR(COMP6)
 
#define COMP7_CSR   COMP_CSR(COMP7)
 
#define COMP_CSR_LOCK   (0x1 << 31)
 
#define COMP_CSR_OUT   (0x1 << 30)
 
#define COMP_CSR_BLANKING_MASK   (0x7)
 
#define COMP_CSR_BLANKING_SHIFT   (18)
 
#define COMP_CSR_BLANKING_NONE   (0x0)
 
#define COMP_CSR_BLANKING(blanking)   (((blanking) & COMP_CSR_BLANKING_MASK) << COMP_CSR_BLANKING_SHIFT)
 
#define COMP_CSR_HYST_NONE   (0x0)
 
#define COMP_CSR_HYST_LOW   (0x1)
 
#define COMP_CSR_HYST_MEDIUM   (0x2)
 
#define COMP_CSR_HYST_HIGH   (0x3)
 
#define COMP_CSR_HYST_MASK   (0x3)
 
#define COMP_CSR_HYST_SHIFT   (16)
 
#define COMP_CSR_POL   (0x1 << 15)
 
#define COMP_CSR_OUTSEL(outsel)   (((outsel) & COMP_CSR_OUTSEL_MASK) << COMP_CSR_OUTSEL_SHIFT)
 
#define COMP_CSR_OUTSEL_MASK   (0xf)
 
#define COMP_CSR_OUTSEL_SHIFT   (10)
 
#define COMP_CSR_WINMODE   (0x1 << 9)
 
#define COMP_CSR_INPSEL   (0x1 << 7)
 
#define COMP_CSR_INMSEL(inmsel)
 
#define COMP_CSR_INMSEL_MASK   (0x7 << 4)
 
#define COMP_CSR_MODE_HIGHSPEED   (0x0)
 
#define COMP_CSR_MODE_MEDIUMSPEED   (0x1)
 
#define COMP_CSR_MODE_LOWSPEED   (0x2)
 
#define COMP_CSR_MODE_ULTRALOWPOWER   (0x3)
 
#define COMP_CSR_MODE_MASK   (0x3)
 
#define COMP_CSR_MODE_SHIFT   (2)
 
#define COMP_CSR_INPDAC   (0x1 << 1)
 
#define COMP_CSR_EN   (0x1 << 0)