libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
opamp_common_v1.h
Go to the documentation of this file.
1/** @addtogroup opamp_defines
2 *
3 * @date 10 Dec 2020
4 *
5 *LGPL License Terms @ref lgpl_license
6 */
7/*
8 * This file is part of the libopencm3 project.
9 *
10 * This library is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24/** @cond */
25#if defined(LIBOPENCM3_OPAMP_H)
26/** @endcond */
27#ifndef LIBOPENCM3_OPAMP_COMMON_V1_H
28#define LIBOPENCM3_OPAMP_COMMON_V1_H
29/**@{*/
30
32
33/* OPAMPx_CSR values */
34
35#define OPAMP_CSR_OUTCAL_MASK (0x1)
36#define OPAMP_CSR_OUTCAL_SHIFT (30)
37#define OPAMP_CSR_OUTCAL_NON_LO_INV (0x0)
38#define OPAMP_CSR_OUTCAL_NON_HI_INV (0x1)
39
40#define OPAMP_CSR_USER_TRIM (0x1 << 18)
41
42#define OPAMP_CSR_PGA_GAIN_MASK (0xf)
43#define OPAMP_CSR_PGA_GAIN_SHIFT (14)
44#define OPAMP_CSR_PGA_GAIN_2 (0x0)
45#define OPAMP_CSR_PGA_GAIN_4 (0x1)
46#define OPAMP_CSR_PGA_GAIN_8 (0x2)
47#define OPAMP_CSR_PGA_GAIN_16 (0x3)
48#define OPAMP_CSR_PGA_GAIN_2_MINUS_VM0 (0x8)
49#define OPAMP_CSR_PGA_GAIN_4_MINUS_VM0 (0x9)
50#define OPAMP_CSR_PGA_GAIN_8_MINUS_VM0 (0xa)
51#define OPAMP_CSR_PGA_GAIN_16_MINUS_VM0 (0xb)
52#define OPAMP_CSR_PGA_GAIN_2_MINUS_VM1 (0xc)
53#define OPAMP_CSR_PGA_GAIN_4_MINUS_VM1 (0xd)
54#define OPAMP_CSR_PGA_GAIN_8_MINUS_VM1 (0xe)
55#define OPAMP_CSR_PGA_GAIN_16_MINUS_VM1 (0xf)
56
57#define OPAMP_CSR_VPS_SEL_MASK (0x3)
58#define OPAMP_CSR_VPS_SEL_SHIFT (9)
59
60#define OPAMP_CSR_VMS_SEL_MASK (0x1)
61#define OPAMP_CSR_VMS_SEL_SHIFT (8)
62
63#define OPAMP_CSR_TCM_EN (0x1 << 7)
64
65#define OPAMP_CSR_VM_SEL_PGA_MODE (0x2)
66#define OPAMP_CSR_VM_SEL_FOLLOWER_MODE (0x3)
67
68
70
71bool opamp_read_outcal(uint32_t base);
72
73void opamp_vps_select(uint32_t base, uint32_t vps);
74void opamp_vms_select(uint32_t base, uint32_t vms);
75void opamp_tcm_enable(uint32_t base);
76void opamp_tcm_disable(uint32_t base);
77
79/**@}*/
80
81#endif
82/** @cond */
83#else
84#warning "opamp_common_v1.h should not be included directly, only via opamp.h"
85#endif
86/** @endcond */
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
bool opamp_read_outcal(uint32_t base)
void opamp_vms_select(uint32_t base, uint32_t vms)
void opamp_vps_select(uint32_t base, uint32_t vps)
void opamp_tcm_enable(uint32_t base)
void opamp_tcm_disable(uint32_t base)