Loading...
Searching...
No Matches
line.hpp
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
#ifndef __LIBGPIOD_CXX_LINE_HPP__
#define __LIBGPIOD_CXX_LINE_HPP__
#if !defined(__LIBGPIOD_GPIOD_CXX_INSIDE__)
#error "Only gpiod.hpp can be included directly."
#endif
#include <ostream>
#include <utility>
#include <vector>
namespace gpiod {
namespace line {
class offset
{
public:
offset(unsigned int off = 0) : _m_offset(off) { }
offset(const offset& other) = default;
offset(offset&& other) = default;
~offset() = default;
offset& operator=(const offset& other) = default;
offset& operator=(offset&& other) noexcept = default;
operator unsigned int() const noexcept
{
return this->_m_offset;
}
private:
unsigned int _m_offset;
};
enum class value
{
INACTIVE = 0,
ACTIVE = 1,
};
enum class direction
{
AS_IS = 1,
INPUT,
OUTPUT,
};
enum class edge
{
NONE = 1,
RISING,
FALLING,
BOTH,
};
enum class bias
{
AS_IS = 1,
UNKNOWN,
DISABLED,
PULL_UP,
PULL_DOWN,
};
enum class drive
{
PUSH_PULL = 1,
OPEN_DRAIN,
OPEN_SOURCE,
};
enum class clock
{
MONOTONIC = 1,
REALTIME,
HTE,
/*<< Line uses the hardware timestamp engine for event timestamps. */
};
using offsets = ::std::vector<offset>;
using values = ::std::vector<value>;
using value_mapping = ::std::pair<offset, value>;
using value_mappings = ::std::vector<value_mapping>;
::std::ostream& operator<<(::std::ostream& out, value val);
::std::ostream& operator<<(::std::ostream& out, direction dir);
::std::ostream& operator<<(::std::ostream& out, edge edge);
::std::ostream& operator<<(::std::ostream& out, bias bias);
::std::ostream& operator<<(::std::ostream& out, drive drive);
::std::ostream& operator<<(::std::ostream& out, clock clock);
::std::ostream& operator<<(::std::ostream& out, const values& vals);
::std::ostream& operator<<(::std::ostream& out, const offsets& offs);
::std::ostream& operator<<(::std::ostream& out, const value_mapping& mapping);
::std::ostream& operator<<(::std::ostream& out, const value_mappings& mappings);
} /* namespace line */
} /* namespace gpiod */
#endif /* __LIBGPIOD_CXX_LINE_HPP__ */
gpiod::line::offset::~offset
~offset()=default
gpiod::line::offset::offset
offset(const offset &other)=default
Copy constructor.
gpiod::line::offset::offset
offset(offset &&other)=default
Move constructor.
gpiod::line::offset::operator=
offset & operator=(offset &&other) noexcept=default
Move assignment operator.
gpiod::line::offset::offset
offset(unsigned int off=0)
Constructor with implicit conversion from unsigned int.
Definition line.hpp:36
gpiod::line::offset::operator=
offset & operator=(const offset &other)=default
Assignment operator.
gpiod::line
Namespace containing various type definitions for GPIO lines.
Definition line.hpp:24
gpiod::line::offsets
::std::vector< offset > offsets
Vector of line offsets.
Definition line.hpp:163
gpiod::line::value_mappings
::std::vector< value_mapping > value_mappings
Vector of offset->value mappings. Each mapping is defined as a pair of an unsigned and signed integer...
Definition line.hpp:179
gpiod::line::edge
edge
Edge detection settings.
Definition line.hpp:106
gpiod::line::edge::FALLING
@ FALLING
Definition line.hpp:111
gpiod::line::edge::BOTH
@ BOTH
Definition line.hpp:113
gpiod::line::edge::RISING
@ RISING
Definition line.hpp:109
gpiod::line::edge::NONE
@ NONE
Definition line.hpp:107
gpiod::line::direction
direction
Direction settings.
Definition line.hpp:93
gpiod::line::direction::OUTPUT
@ OUTPUT
Definition line.hpp:98
gpiod::line::direction::INPUT
@ INPUT
Definition line.hpp:96
gpiod::line::direction::AS_IS
@ AS_IS
Definition line.hpp:94
gpiod::line::value_mapping
::std::pair< offset, value > value_mapping
Represents a mapping of a line offset to line logical state.
Definition line.hpp:173
gpiod::line::values
::std::vector< value > values
Vector of line values.
Definition line.hpp:168
gpiod::line::clock
clock
Event clock settings.
Definition line.hpp:151
gpiod::line::clock::MONOTONIC
@ MONOTONIC
Definition line.hpp:152
gpiod::line::clock::REALTIME
@ REALTIME
Definition line.hpp:154
gpiod::line::clock::HTE
@ HTE
Definition line.hpp:156
gpiod::line::operator<<
::std::ostream & operator<<(::std::ostream &out, value val)
Stream insertion operator for logical line values.
gpiod::line::drive
drive
Drive settings.
Definition line.hpp:138
gpiod::line::drive::PUSH_PULL
@ PUSH_PULL
Definition line.hpp:139
gpiod::line::drive::OPEN_SOURCE
@ OPEN_SOURCE
Definition line.hpp:143
gpiod::line::drive::OPEN_DRAIN
@ OPEN_DRAIN
Definition line.hpp:141
gpiod::line::bias
bias
Internal bias settings.
Definition line.hpp:121
gpiod::line::bias::DISABLED
@ DISABLED
Definition line.hpp:126
gpiod::line::bias::PULL_UP
@ PULL_UP
Definition line.hpp:128
gpiod::line::bias::PULL_DOWN
@ PULL_DOWN
Definition line.hpp:130
gpiod::line::bias::UNKNOWN
@ UNKNOWN
Definition line.hpp:124
gpiod::line::value
value
Logical line states.
Definition line.hpp:82
gpiod::line::value::ACTIVE
@ ACTIVE
Definition line.hpp:85
gpiod::line::value::INACTIVE
@ INACTIVE
Definition line.hpp:83
gpiod
Definition chip-info.hpp:18