Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
opamp.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_DRIVERS_OPAMP_H_
14#define ZEPHYR_INCLUDE_DRIVERS_OPAMP_H_
15
24
25#include <zephyr/device.h>
26#include <errno.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
53
59
63enum opamp_functional_mode {
65 OPAMP_FUNCTIONAL_MODE_DIFFERENTIAL = 0,
67 OPAMP_FUNCTIONAL_MODE_INVERTING,
69 OPAMP_FUNCTIONAL_MODE_NON_INVERTING,
71 OPAMP_FUNCTIONAL_MODE_FOLLOWER,
77 OPAMP_FUNCTIONAL_MODE_STANDALONE,
78};
79
80typedef int (*opamp_api_set_gain_t)(const struct device *dev, enum opamp_gain gain);
81
82__subsystem struct opamp_driver_api {
83 opamp_api_set_gain_t set_gain;
84};
85
87
97__syscall int opamp_set_gain(const struct device *dev, enum opamp_gain gain);
98
99static inline int z_impl_opamp_set_gain(const struct device *dev, enum opamp_gain gain)
100{
101 return DEVICE_API_GET(opamp, dev)->set_gain(dev, gain);
102}
103
104#ifdef __cplusplus
105}
106#endif
107
109
110#include <zephyr/syscalls/opamp.h>
111
112#endif /* ZEPHYR_INCLUDE_DRIVERS_OPAMP_H_ */
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1353
System error numbers.
int opamp_set_gain(const struct device *dev, enum opamp_gain gain)
Set opamp gain.
opamp_gain
OPAMP gain factors.
Definition opamp.h:33
@ OPAMP_GAIN_64
x 64.
Definition opamp.h:51
@ OPAMP_GAIN_2
x 2.
Definition opamp.h:38
@ OPAMP_GAIN_5_3
x 5/3.
Definition opamp.h:37
@ OPAMP_GAIN_11_5
x 11/5.
Definition opamp.h:39
@ OPAMP_GAIN_1
x 1.
Definition opamp.h:36
@ OPAMP_GAIN_4
x 4.
Definition opamp.h:41
@ OPAMP_GAIN_31
x 31.
Definition opamp.h:47
@ OPAMP_GAIN_7
x 7.
Definition opamp.h:43
@ OPAMP_GAIN_1_3
x 1/3.
Definition opamp.h:35
@ OPAMP_GAIN_15
x 15.
Definition opamp.h:45
@ OPAMP_GAIN_16
x 16.
Definition opamp.h:46
@ OPAMP_GAIN_1_7
x 1/7.
Definition opamp.h:34
@ OPAMP_GAIN_63
x 63.
Definition opamp.h:50
@ OPAMP_GAIN_3
x 3.
Definition opamp.h:40
@ OPAMP_GAIN_32
x 32.
Definition opamp.h:48
@ OPAMP_GAIN_33
x 33.
Definition opamp.h:49
@ OPAMP_GAIN_8
x 8.
Definition opamp.h:44
@ OPAMP_GAIN_13_3
x 13/3.
Definition opamp.h:42
Runtime device structure (in ROM) per driver instance.
Definition device.h:513