libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
opamp_common_all.c
Go to the documentation of this file.
1/** @addtogroup opamp_file OPAMP peripheral API
2 * @ingroup peripheral_apis
3 */
4
5/*
6 * This file is part of the libopencm3 project.
7 *
8 * This library is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22/**@{*/
23
25
26void opamp_enable(uint32_t base)
27{
28 OPAMP_CSR(base) |= OPAMP_CSR_EN;
29}
30
31void opamp_disable(uint32_t base)
32{
33 OPAMP_CSR(base) &= ~OPAMP_CSR_EN;
34}
35
36void opamp_lock(uint32_t base)
37{
39}
40
41void opamp_set_calsel(uint32_t base, uint32_t calsel)
42{
44 OPAMP_CSR(base) |= calsel << OPAMP_CSR_CALSEL_SHIFT;
45}
46
47void opamp_force_vp_enable(uint32_t base)
48{
50}
51
52void opamp_force_vp_disable(uint32_t base)
53{
54 OPAMP_CSR(base) &= ~OPAMP_CSR_FORCE_VP;
55}
56
57void opamp_cal_enable(uint32_t base)
58{
60}
61
62void opamp_cal_disable(uint32_t base)
63{
64 OPAMP_CSR(base) &= ~OPAMP_CSR_CALON;
65}
66
67void opamp_trimoffsetn_set(uint32_t base, uint32_t trim)
68{
72}
73
74void opamp_trimoffsetp_set(uint32_t base, uint32_t trim)
75{
79}
80
81void opamp_user_trim_enable(uint32_t base)
82{
84}
85
86void opamp_user_trim_disable(uint32_t base)
87{
88 OPAMP_CSR(base) &= ~OPAMP_CSR_USER_TRIM;
89}
90
91void opamp_pga_gain_select(uint32_t base, uint32_t gain)
92{
95 OPAMP_CSR(base) |= gain << OPAMP_CSR_PGA_GAIN_SHIFT;
96}
97
98void opamp_vp_select(uint32_t base, uint32_t vp)
99{
102 OPAMP_CSR(base) |= vp << OPAMP_CSR_VP_SEL_SHIFT;
103}
104
105void opamp_vm_select(uint32_t base, uint32_t vm)
106{
109 OPAMP_CSR(base) |= vm << OPAMP_CSR_VM_SEL_SHIFT;
110}
111
112/**@}*/
#define OPAMP_CSR_CALSEL_MASK
#define OPAMP_CSR_VM_SEL_MASK
#define OPAMP_CSR_EN
#define OPAMP_CSR_LOCK
#define OPAMP_CSR_TRIMOFFSETP_SHIFT
#define OPAMP_CSR_VP_SEL_MASK
#define OPAMP_CSR_USER_TRIM
#define OPAMP_CSR_VP_SEL_SHIFT
#define OPAMP_CSR_TRIMOFFSETN_MASK
#define OPAMP_CSR_TRIMOFFSETN_SHIFT
#define OPAMP_CSR_CALSEL_SHIFT
#define OPAMP_CSR_CALON
#define OPAMP_CSR_PGA_GAIN_MASK
#define OPAMP_CSR_TRIMOFFSETP_MASK
#define OPAMP_CSR(opamp_base)
#define OPAMP_CSR_FORCE_VP
#define OPAMP_CSR_VM_SEL_SHIFT
#define OPAMP_CSR_PGA_GAIN_SHIFT
void opamp_cal_enable(uint32_t base)
void opamp_set_calsel(uint32_t base, uint32_t calsel)
void opamp_enable(uint32_t base)
void opamp_disable(uint32_t base)
void opamp_cal_disable(uint32_t base)
void opamp_trimoffsetn_set(uint32_t base, uint32_t trim)
void opamp_trimoffsetp_set(uint32_t base, uint32_t trim)
void opamp_force_vp_enable(uint32_t base)
void opamp_user_trim_enable(uint32_t base)
void opamp_pga_gain_select(uint32_t base, uint32_t gain)
void opamp_vp_select(uint32_t base, uint32_t vp)
void opamp_force_vp_disable(uint32_t base)
void opamp_lock(uint32_t base)
void opamp_vm_select(uint32_t base, uint32_t vm)
void opamp_user_trim_disable(uint32_t base)