GPIO line info
-
class line_info
Contains an immutable snapshot of the line’s state at the time when the object of this class was instantiated.
Public Functions
-
line_info &operator=(const line_info &other) noexcept
Copy assignment operator.
- Parameters:
other – Object to copy.
- Returns:
Reference to self.
-
line_info &operator=(line_info &&other) noexcept
Move assignment operator.
- Parameters:
other – Object to move.
- Returns:
Reference to self.
-
line::offset offset() const noexcept
Get the hardware offset of the line.
- Returns:
Offset of the line within the parent chip.
-
::std::string name() const noexcept
Get the GPIO line name.
- Returns:
Name of the GPIO line as it is represented in the kernel. This routine returns an empty string if the line is unnamed.
-
bool used() const noexcept
Check if the line is currently in use.
The user space can’t know exactly why a line is busy. It may have been requested by another process or hogged by the kernel. It only matters that the line is used and we can’t request it.
- Returns:
True if the line is in use, false otherwise.
-
::std::string consumer() const noexcept
Read the GPIO line consumer name.
- Returns:
Name of the GPIO consumer name as it is represented in the kernel. This routine returns an empty string if the line is not used.
-
line::direction direction() const
Read the GPIO line direction setting.
- Returns:
Returns DIRECTION_INPUT or DIRECTION_OUTPUT.
-
line::edge edge_detection() const
Read the current edge detection setting of this line.
- Returns:
Returns EDGE_NONE, EDGE_RISING, EDGE_FALLING or EDGE_BOTH.
-
line::bias bias() const
Read the GPIO line bias setting.
- Returns:
Returns BIAS_PULL_UP, BIAS_PULL_DOWN, BIAS_DISABLE or BIAS_UNKNOWN.
-
line::drive drive() const
Read the GPIO line drive setting.
- Returns:
Returns DRIVE_PUSH_PULL, DRIVE_OPEN_DRAIN or DRIVE_OPEN_SOURCE.
-
bool active_low() const noexcept
Check if the signal of this line is inverted.
- Returns:
True if this line is “active-low”, false otherwise.
-
bool debounced() const noexcept
Check if this line is debounced (either by hardware or by the kernel software debouncer).
- Returns:
True if the line is debounced, false otherwise.
-
::std::chrono::microseconds debounce_period() const noexcept
Read the current debounce period in microseconds.
- Returns:
Current debounce period in microseconds, 0 if the line is not debounced.
-
line_info &operator=(const line_info &other) noexcept