libgpiod 2.1.3
line-settings.hpp
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/* SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> */
3
8#ifndef __LIBGPIOD_CXX_LINE_SETTINGS_HPP__
9#define __LIBGPIOD_CXX_LINE_SETTINGS_HPP__
10
11#if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
12#error "Only gpiod.hpp can be included directly."
13#endif
14
15#include <chrono>
16#include <memory>
17
18#include "line.hpp"
19
20namespace gpiod {
21
22class line_config;
23
32class line_settings final
33{
34public:
35
40
46
51 line_settings(line_settings&& other) noexcept;
52
54
61
68
73 line_settings& reset() noexcept;
74
81
86 line::direction direction() const;
87
94
99 line::edge edge_detection() const;
100
107
112 line::bias bias() const;
113
120
125 line::drive drive() const;
126
133
138 bool active_low() const noexcept;
139
145 line_settings& set_debounce_period(const ::std::chrono::microseconds& period);
146
151 ::std::chrono::microseconds debounce_period() const noexcept;
152
159
164 line::clock event_clock() const;
165
171 line_settings& set_output_value(line::value value);
172
177 line::value output_value() const;
178
179private:
180
181 struct impl;
182
183 ::std::unique_ptr<impl> _m_priv;
184
185 friend line_config;
186};
187
194::std::ostream& operator<<(::std::ostream& out, const line_settings& settings);
195
200} /* namespace gpiod */
201
202#endif /* __LIBGPIOD_CXX_LINE_SETTINGS_HPP__ */
Contains a set of line config options used in line requests and reconfiguration.
Stores GPIO line settings.
line_settings & set_bias(line::bias bias)
Set bias setting.
line_settings()
Initializes the line_settings object with default values.
line_settings(line_settings &&other) noexcept
Move constructor.
line::bias bias() const
Get bias setting.
line::clock event_clock() const
Get the event clock used for edge event timestamps.
line_settings & reset() noexcept
Reset the line settings to default values.
line::drive drive() const
Get drive setting.
bool active_low() const noexcept
Get the active-low setting.
line::value output_value() const
Get the output value.
line_settings & set_direction(line::direction direction)
Set direction.
line_settings & operator=(const line_settings &other)
Copy assignment operator.
line_settings & set_active_low(bool active_low)
Set the active-low setting.
line_settings & set_output_value(line::value value)
Set the output value.
line_settings & set_edge_detection(line::edge edge)
Set edge detection.
line_settings(const line_settings &other)
Copy constructor.
line_settings & set_debounce_period(const ::std::chrono::microseconds &period)
Set debounce period.
line_settings & set_event_clock(line::clock event_clock)
Set the event clock to use for edge event timestamps.
line::direction direction() const
Get direction.
line_settings & set_drive(line::drive drive)
Set drive setting.
::std::chrono::microseconds debounce_period() const noexcept
Get debounce period.
line_settings & operator=(line_settings &&other)
Move assignment operator.
line::edge edge_detection() const
Get edge detection.