PIDUINO
Loading...
Searching...
No Matches
gpio2.h
1/* Copyright © 2018-2025 Pascal JEAN, All rights reserved.
2 This file is part of the Piduino Library.
3
4 The Piduino Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 The Piduino Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with the Piduino Library; if not, see <http://www.gnu.org/licenses/>.
16*/
17#pragma once
18
19// based on https://gist.github.com/8c8678c65b884c62aca328a5bf57f4f5.git
20
21#include <string>
22#include <chrono>
23#include <thread>
24#include <stdexcept>
25#include <system_error>
26#include <iostream>
27
28#include <cstring>
29#include <cerrno>
30#include <cstdint>
31
32#include <unistd.h>
33#include <fcntl.h>
34#include <sys/ioctl.h>
35#include <sys/types.h>
36#include <sys/stat.h>
37#include <sys/poll.h>
38#include <linux/gpio.h>
39
40#include <piduino/global.h>
41
49namespace Gpio2 {
50
51 class Line;
52
53 #ifdef __DOXYGEN__
59#define GPIO_MAX_NAME_SIZE 32
67#define GPIO_V2_LINES_MAX 64
68
73#define GPIO_V2_LINE_NUM_ATTRS_MAX 10
79 enum gpio_v2_line_attr_id {
80 GPIO_V2_LINE_ATTR_ID_FLAGS = 1,
81 GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2,
82 GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3,
83 };
84
88 enum gpio_v2_line_flag {
89 GPIO_V2_LINE_FLAG_USED = _BITULL (0),
90 GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL (1),
91 GPIO_V2_LINE_FLAG_INPUT = _BITULL (2),
92 GPIO_V2_LINE_FLAG_OUTPUT = _BITULL (3),
93 GPIO_V2_LINE_FLAG_EDGE_RISING = _BITULL (4),
94 GPIO_V2_LINE_FLAG_EDGE_FALLING = _BITULL (5),
95 GPIO_V2_LINE_FLAG_OPEN_DRAIN = _BITULL (6),
96 GPIO_V2_LINE_FLAG_OPEN_SOURCE = _BITULL (7),
97 GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL (8),
98 GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL (9),
99 GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL (10),
100 GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL (11),
101 GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE = _BITULL (12),
102 };
103
107 enum gpio_v2_line_event_id {
108 GPIO_V2_LINE_EVENT_RISING_EDGE = 1,
109 GPIO_V2_LINE_EVENT_FALLING_EDGE = 2,
110 };
111 #endif
112
116 struct ChipInfo : public ::gpiochip_info {
121 memset (this, 0, sizeof (*this));
122 }
123
124 #ifdef __DOXYGEN__
125 char name[GPIO_MAX_NAME_SIZE];
126 char label[GPIO_MAX_NAME_SIZE];
127 __u32 lines;
128 #endif
129 };
130
139 memset (this, 0, sizeof (*this));
140 }
141
146 LineAttribute (uint32_t id) {
147 memset (this, 0, sizeof (*this));
148 this->id = id;
149 }
150 #ifdef __DOXYGEN__
151 __u32 id;
152 __u32 padding;
153 union {
163 __aligned_u64 flags;
172 __aligned_u64 values;
179 __u32 debounce_period_us;
180 };
181 #endif
182 };
183
198 memset (this, 0, sizeof (*this));
199 }
200
205 LineInfo (uint32_t offset) {
206 memset (this, 0, sizeof (*this));
207 this->offset = offset;
208 }
209
215 void printAttributes (std::ostream &os = std::cout) const;
216
223 friend std::ostream &operator<< (std::ostream &os, const LineInfo &info);
224
225 #ifdef __DOXYGEN__
233 char name[GPIO_MAX_NAME_SIZE];
241 char consumer[GPIO_MAX_NAME_SIZE];
248 __u32 offset;
252 __u32 num_attrs;
259 __aligned_u64 flags;
263 struct LineAttribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
267 __u32 padding[4];
268 #endif
269 };
270
279 memset (this, 0, sizeof (*this));
280 }
281
287 memset (this, 0, sizeof (*this));
288 this->attr = attr;
289 }
290
291 #ifdef __DOXYGEN__
295 struct LineAttribute attr;
303 __aligned_u64 mask;
304 #endif
305 };
306
307
316 clear();
317 }
318
323 LineConfig (std::uint64_t flags) {
324 clear();
325 this->flags = flags;
326 }
327
331 void clear() {
332 memset (this, 0, sizeof (*this));
333 }
334
335 #ifdef __DOXYGEN__
345 __aligned_u64 flags;
349 __u32 num_attrs;
353 __u32 padding[5];
362 struct LineConfigAttribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
363 #endif
364 };
365
374 memset (this, 0, sizeof (*this));
375 num_lines = 0;
376 event_buffer_size = 0;
377 fd = -1;
378 }
379
384 LineRequest (const std::string &consumer) {
385 memset (this, 0, sizeof (*this));
386 strncpy (this->consumer, consumer.c_str(), GPIO_MAX_NAME_SIZE - 1);
387 num_lines = 0;
388 event_buffer_size = 0;
389 fd = -1;
390 }
391
392 #ifdef __DOXYGEN__
399 __u32 offsets[GPIO_V2_LINES_MAX];
406 char consumer[GPIO_MAX_NAME_SIZE];
410 struct LineConfig config;
418 __u32 num_lines;
429 __u32 event_buffer_size;
433 __u32 padding[5];
440 __s32 fd;
441 #endif
442 };
443
452 memset (this, 0, sizeof (*this));
453 }
454
460 LineValues (std::uint64_t bits, std::uint64_t mask) {
461 memset (this, 0, sizeof (*this));
462 this->bits = bits;
463 this->mask = mask;
464 }
465
466 #ifdef __DOXYGEN__
472 __aligned_u64 bits;
479 __aligned_u64 mask;
480 #endif
481 };
482
502
503 memset (this, 0, sizeof (*this));
504 }
505
506 #ifdef __DOXYGEN__
510 __aligned_u64 timestamp_ns;
514 __u32 id;
518 __u32 offset;
524 __u32 seqno;
530 __u32 line_seqno;
534 __u32 padding[6];
535 #endif
536 };
537
547 class Chip {
548 public:
553 Chip (const std::string &consumer = std::string()) : m_consumer (consumer), m_fd (-1), m_last_error (0), m_last_result (0) {}
554
560
561 // Ensure the chip is closed when the object is destroyed.
562 close();
563 }
564
569 std::string consumer() const {
570 return m_consumer;
571 }
572
580 template<class ParamType>
581 bool ioCtl (unsigned long cmd, ParamType *param) {
582
583 m_last_result = ::ioctl (m_fd, cmd, param);
584 if (m_last_result == -1) {
585
586 m_last_error = errno;
587 return false;
588 }
589 m_last_error = 0;
590 return true;
591 }
592
597 int errorCode() const {
598
599 return m_last_error;
600 }
601
606 int result() const {
607
608 return m_last_result;
609 }
610
615 const char *errorMessage() const {
616
617 return strerror (errorCode());
618 }
619
625 bool open (const char *dev) {
626
627 m_dev = dev;
628 m_fd = ::open (dev, O_RDONLY);
629 if (!isOpen()) {
630
631 m_last_error = errno;
632 return false;
633 }
634 m_last_error = 0;
635 return true;
636 }
637
643 bool open (const std::string &dev) {
644
645 return open (dev.c_str());
646 }
647
653 bool open (uint32_t chip_no) {
654
655 // Open the GPIO chip device using the chip number.
656 return open (devPath (chip_no));
657 }
658
663 bool isOpen() const {
664
665 return m_fd != -1;
666 }
667
672 std::string dev() const {
673
674 return m_dev;
675 }
676
681 bool close() {
682
683 if (isOpen()) {
684 // Close the file descriptor and reset it
685 // to -1 to indicate that the device is closed.
687 m_fd = -1;
688 if (m_last_result == -1) {
689
690 m_last_error = errno;
691 return false;
692 }
693 m_last_error = 0;
694 }
695 return true;
696 }
697
702 bool fillInfo() {
703
704 if (isOpen()) {
705
706 return ioCtl (GPIO_GET_CHIPINFO_IOCTL, &m_dev_info);
707 }
708 return false;
709 }
710
715 std::string name() const {
716
717 return m_dev_info.name;
718 }
719
724 std::string label() const {
725
726 return m_dev_info.label;
727 }
728
733 uint32_t lines() const {
734
735 return m_dev_info.lines;
736 }
737
744 bool lineInfo (uint32_t offset, LineInfo *info) {
745
746 memset (info, 0, sizeof (*info));
747 info->offset = offset;
748 return ioCtl (GPIO_V2_GET_LINEINFO_IOCTL, info);
749 }
750
757 static std::string devPath (uint32_t chip_no) {
758
759 return "/dev/gpiochip" + std::to_string (chip_no);
760 }
761
762 private:
763 std::string m_dev;
764 std::string m_consumer;
766 int m_fd;
769 };
770
780 class Line {
781 public:
787 Line (std::shared_ptr<Chip> dev, uint32_t offset) : Line (dev, 1, &offset) {}
788
795 Line (std::shared_ptr<Chip> dev, uint32_t num_lines, const uint32_t *offsets) : m_chip (dev), m_req (dev->consumer()), m_last_error (0), m_last_result (0) {
796
797 m_req.num_lines = num_lines;
798 m_req.fd = -1;
799 memcpy (m_req.offsets, offsets, num_lines * sizeof (uint32_t));
800 }
801
807 Line (std::shared_ptr<Chip> dev, const LineRequest &request) : m_chip (dev), m_req (request), m_last_error (0), m_last_result (0) {
808
809 strncpy (m_req.consumer, dev->consumer().c_str(), sizeof (m_req.consumer));
810 }
811
816
817 close();
818 }
819
820 Line (const Line &) = delete;
821 Line (Line &&) = delete;
822 Line &operator= (const Line &) = delete;
823 Line &operator= (Line &&) = delete;
824
829 int errorCode() const {
830
831 return m_last_error;
832 }
833
838 int result() const {
839
840 return m_last_result;
841 }
842
847 const char *errorMessage() const {
848
849 return strerror (errorCode());
850 }
851
856 const LineRequest &request() const {
857
858 return m_req;
859 }
860
865 uint32_t numLines() const {
866
867 return m_req.num_lines;
868 }
869
876 uint32_t offset (uint32_t line_no = 0) const {
877
878 if (line_no >= m_req.num_lines) {
879
880 throw std::out_of_range ("Line number out of range");
881 }
882 return m_req.offsets[line_no];
883 }
884
889 const LineConfig &config() const {
890
891 return reinterpret_cast<const LineConfig &> (m_req.config);
892 }
893
909 bool getInfo (LineInfo *info, uint32_t num_lines = 1) {
910
911 if (num_lines > m_req.num_lines) {
912 num_lines = m_req.num_lines;
913 }
914
915 for (uint32_t i = 0; i < num_lines; ++i) {
916
917 if (!m_chip->lineInfo (m_req.offsets[i], &info[i])) {
918
919 m_last_error = m_chip->errorCode();
920 m_last_result = m_chip->result();
921 return false;
922 }
923 else {
924
925 m_last_error = 0;
926 m_last_result = 0;
927 }
928 }
929 return true;
930 }
931
937 bool open (uint64_t flags) {
938
939 if (m_chip->isOpen() && !isOpen()) {
940
941 m_req.config.flags = flags;
942 if (!m_chip->ioCtl (GPIO_V2_GET_LINE_IOCTL, &m_req)) {
943
944 m_last_error = m_chip->errorCode();
945 m_last_result = m_chip->result();
946 }
947 else {
948
949 m_last_error = 0;
950 m_last_result = 0;
951 }
952 }
953 return isOpen();
954 }
955
961 bool open (const LineConfig &config) {
962
963 if (m_chip->isOpen() && !isOpen()) {
964
965 m_req.config = config;
966 if (!m_chip->ioCtl (GPIO_V2_GET_LINE_IOCTL, &m_req)) {
967
968 m_last_error = m_chip->errorCode();
969 m_last_result = m_chip->result();
970 }
971 else {
972
973 m_last_error = 0;
974 m_last_result = 0;
975 }
976 }
977 return isOpen();
978 }
979
986
987 m_req.config = config;
988 if (isOpen()) {
989
990 m_last_result = ::ioctl (m_req.fd, GPIO_V2_LINE_SET_CONFIG_IOCTL, &config);
991 if (m_last_result == -1) {
992
993 m_last_error = errno;
994 }
995 else {
996
997 std::this_thread::sleep_for (std::chrono::microseconds (1)); // Allow time for the configuration to take effect
998 m_last_error = 0;
999 }
1000 return (m_last_result >= 0);
1001 }
1002 return false;
1003 }
1004
1009 bool isOpen() const {
1010
1011 return m_req.fd >= 0;
1012 }
1013
1018 bool close() {
1019
1020 if (isOpen()) {
1022 m_req.fd = -1;
1023 if (m_last_result == -1) {
1024
1025 m_last_error = errno;
1026 }
1027 else {
1028
1029 m_last_error = 0;
1030 }
1031 return m_last_result == 0;
1032 }
1033 return false;
1034 }
1035
1052 bool getValues (LineValues &values) const {
1053
1054 if (isOpen()) {
1055
1056 m_last_result = ::ioctl (m_req.fd, GPIO_V2_LINE_GET_VALUES_IOCTL, &values);
1057 if (m_last_result == -1) {
1058
1059 m_last_error = errno;
1060 }
1061 else {
1062
1063 m_last_error = 0;
1064 }
1065 return (m_last_result != -1);
1066 }
1067 return false;
1068 }
1069
1088 bool getValue (int line_no = 0) const {
1089
1090 if (isOpen()) {
1091 LineValues values (0, 1ULL << line_no);
1092
1093 if (getValues (values)) {
1094
1095 return ( (values.bits & values.mask) != 0);
1096 }
1097 else {
1098
1099 throw std::system_error (errno, std::system_category(), EXCEPTION_MSG ("Failed to get line values"));
1100 }
1101 }
1102 return false;
1103 }
1104
1118 bool setValue (bool value, int line_no = 0) {
1119
1120 if (isOpen()) {
1121 uint64_t line_mask = 1ULL << line_no;
1122 LineValues values (value ? line_mask : 0, line_mask);
1123
1124 return setValues (values);
1125 }
1126 return false;
1127 }
1128
1142 bool setValues (const LineValues &values) {
1143
1144 if (isOpen()) {
1145
1146 m_last_result = ::ioctl (m_req.fd, GPIO_V2_LINE_SET_VALUES_IOCTL, &values);
1147 if (m_last_result == -1) {
1148
1149 m_last_error = errno;
1150 }
1151 else {
1152
1153 m_last_error = 0;
1154 }
1155 return (m_last_result != -1);
1156 }
1157 return false;
1158 }
1159
1165 bool setDebounce (uint32_t debounce_ms) {
1166
1167 if (debounce_ms != debounce()) {
1168 LineConfig cfg = * (reinterpret_cast<LineConfig *> (&m_req.config));
1169 auto &debounce = cfg.attrs[0];
1170
1171 if (debounce_ms > 0) {
1172
1173 debounce.attr.id = GPIO_V2_LINE_ATTR_ID_DEBOUNCE;
1174 debounce.attr.debounce_period_us = debounce_ms * 1000;
1175 debounce.mask |= 1ULL << 0;
1176 cfg.num_attrs = 1;
1177 }
1178 else {
1179
1180 debounce.attr.id = GPIO_V2_LINE_ATTR_ID_DEBOUNCE;
1181 debounce.attr.debounce_period_us = 0;
1182 debounce.mask = 0;
1183 cfg.num_attrs = 0;
1184 }
1185
1186 return setConfig (cfg);
1187 }
1188 return true;
1189 }
1190
1195 uint32_t debounce() const {
1196
1197 return m_req.config.attrs[0].attr.debounce_period_us / 1000;
1198 }
1199
1207 bool waitForEvent (LineEvent &event, int timeout_ms = -1) {
1208
1209 if (isOpen()) {
1210
1211 pollfd pfd[1];
1212 pfd[0].fd = m_req.fd;
1213 pfd[0].events = POLLIN | POLLPRI;
1214
1215 m_last_result = ::poll (pfd, 1, timeout_ms);
1216 if (m_last_result > 0) {
1217
1218 m_last_result = ::read (m_req.fd, &event, sizeof (event));
1219 if (m_last_result == sizeof (event)) {
1220
1221 m_last_error = 0;
1222 return true;
1223 }
1224 }
1225 m_last_error = errno;
1226 }
1227 return false;
1228 }
1229
1230 private:
1231 std::shared_ptr<Chip> m_chip;
1233 mutable int m_last_error;
1234 mutable int m_last_result;
1235 };
1236
1237}
Represents a GPIO chip and provides methods to interact with it.
Definition gpio2.h:547
bool open(const char *dev)
Opens the GPIO chip device.
Definition gpio2.h:625
int m_last_result
Definition gpio2.h:768
~Chip()
Destructor for the Chip class.
Definition gpio2.h:559
int m_last_error
Definition gpio2.h:767
int errorCode() const
Gets the last error code from the IOCTL operation.
Definition gpio2.h:597
std::string m_dev
Definition gpio2.h:763
std::string name() const
Gets the name of the GPIO chip.
Definition gpio2.h:715
const char * errorMessage() const
Gets the error message corresponding to the last error code.
Definition gpio2.h:615
bool isOpen() const
Checks if the GPIO chip device is open.
Definition gpio2.h:663
std::string m_consumer
Definition gpio2.h:764
bool close()
Closes the GPIO chip device.
Definition gpio2.h:681
bool open(const std::string &dev)
Opens the GPIO chip device using a string.
Definition gpio2.h:643
std::string consumer() const
Gets the consumer label of the GPIO chip.
Definition gpio2.h:569
std::string dev() const
Gets the path to the GPIO chip device.
Definition gpio2.h:672
ChipInfo m_dev_info
Definition gpio2.h:765
std::string label() const
Gets the label of the GPIO chip.
Definition gpio2.h:724
bool fillInfo()
Fills the chip information structure with data from the device.
Definition gpio2.h:702
static std::string devPath(uint32_t chip_no)
Gets the path to a GPIO chip device based on its chip number.
Definition gpio2.h:757
Chip(const std::string &consumer=std::string())
Constructor for the Chip class.
Definition gpio2.h:553
uint32_t lines() const
Gets the number of lines available on the GPIO chip.
Definition gpio2.h:733
int result() const
Gets the result of the last IOCTL operation.
Definition gpio2.h:606
bool ioCtl(unsigned long cmd, ParamType *param)
Performs an IOCTL operation on the GPIO chip.
Definition gpio2.h:581
int m_fd
Definition gpio2.h:766
bool lineInfo(uint32_t offset, LineInfo *info)
Retrieves information about a specific GPIO line.
Definition gpio2.h:744
bool open(uint32_t chip_no)
Opens the GPIO chip device using a chip number.
Definition gpio2.h:653
Represents a GPIO line and provides methods to interact with it.
Definition gpio2.h:780
bool setValues(const LineValues &values)
Sets the values of the GPIO line(s).
Definition gpio2.h:1142
bool open(uint64_t flags)
Opens the GPIO line with the specified flags.
Definition gpio2.h:937
bool setConfig(const LineConfig &config)
Sets the configuration for the GPIO line.
Definition gpio2.h:985
Line(const Line &)=delete
const LineRequest & request() const
Gets the current line request configuration.
Definition gpio2.h:856
int result() const
Gets the result of the last IOCTL operation.
Definition gpio2.h:838
~Line()
Destructor for the Line class. Closes the line if it is open.
Definition gpio2.h:815
bool close()
Closes the GPIO line.
Definition gpio2.h:1018
const LineConfig & config() const
Gets the current line configuration.
Definition gpio2.h:889
LineRequest m_req
Definition gpio2.h:1232
bool setDebounce(uint32_t debounce_ms)
Sets the debounce period for the GPIO line.
Definition gpio2.h:1165
uint32_t offset(uint32_t line_no=0) const
Gets the offset of a specific line in the request.
Definition gpio2.h:876
uint32_t debounce() const
Gets the debounce period for the GPIO line.
Definition gpio2.h:1195
int errorCode() const
Gets the last error code from the IOCTL operation.
Definition gpio2.h:829
uint32_t numLines() const
Gets the number of lines in the request.
Definition gpio2.h:865
Line(Line &&)=delete
bool waitForEvent(LineEvent &event, int timeout_ms=-1)
Waits for an event on the GPIO line.
Definition gpio2.h:1207
int m_last_error
Definition gpio2.h:1233
std::shared_ptr< Chip > m_chip
Definition gpio2.h:1231
Line & operator=(const Line &)=delete
bool getValues(LineValues &values) const
Gets the values of the GPIO line(s).
Definition gpio2.h:1052
int m_last_result
Definition gpio2.h:1234
Line(std::shared_ptr< Chip > dev, const LineRequest &request)
Constructor for the Line class with a LineRequest object.
Definition gpio2.h:807
bool setValue(bool value, int line_no=0)
Sets the value of a specific GPIO line.
Definition gpio2.h:1118
bool open(const LineConfig &config)
Opens the GPIO line with the specified configuration.
Definition gpio2.h:961
bool getInfo(LineInfo *info, uint32_t num_lines=1)
Retrieves information about GPIO lines.
Definition gpio2.h:909
bool getValue(int line_no=0) const
Gets the value of a specific GPIO line.
Definition gpio2.h:1088
Line(std::shared_ptr< Chip > dev, uint32_t num_lines, const uint32_t *offsets)
Constructor for the Line class with multiple lines.
Definition gpio2.h:795
Line(std::shared_ptr< Chip > dev, uint32_t offset)
Constructor for the Line class.
Definition gpio2.h:787
const char * errorMessage() const
Gets the error message corresponding to the last error code.
Definition gpio2.h:847
bool isOpen() const
Checks if the GPIO line is open.
Definition gpio2.h:1009
Namespace containing classes and types for GPIO device interaction. Use the kernel GPIO interface ver...
Information about a certain GPIO chip.
Definition gpio2.h:116
ChipInfo()
Default constructor initializes the ChipInfo structure.
Definition gpio2.h:120
a configurable attribute of a line
Definition gpio2.h:134
LineAttribute(uint32_t id)
Constructor initializes the LineAttribute structure with a specific id.
Definition gpio2.h:146
LineAttribute()
Default constructor initializes the LineAttribute structure.
Definition gpio2.h:138
a configuration attribute associated with one or more of the requested lines.
Definition gpio2.h:274
LineConfigAttribute(const LineAttribute &attr)
Constructor initializes the LineConfigAttribute structure with a specific attribute.
Definition gpio2.h:286
LineConfigAttribute()
Default constructor initializes the LineConfigAttribute structure.
Definition gpio2.h:278
Configuration for GPIO lines.
Definition gpio2.h:311
LineConfig(std::uint64_t flags)
Constructor initializes the LineConfig structure with specific flags.
Definition gpio2.h:323
void clear()
Clear the LineConfig structure by zeroing all fields.
Definition gpio2.h:331
LineConfig()
Default constructor initializes the LineConfig structure.
Definition gpio2.h:315
The actual event being pushed to userspace.
Definition gpio2.h:497
LineEvent()
Default constructor initializes the LineEvent structure.
Definition gpio2.h:501
Information about a certain GPIO line.
Definition gpio2.h:193
LineInfo(uint32_t offset)
Constructor initializes the LineInfo structure with a specific offset.
Definition gpio2.h:205
void printAttributes(std::ostream &os=std::cout) const
Print the attributes of this GPIO line to the specified output stream.
friend std::ostream & operator<<(std::ostream &os, const LineInfo &info)
Overloaded output operator to print the LineInfo object.
LineInfo()
Default constructor initializes the LineInfo structure.
Definition gpio2.h:197
Information about a request for GPIO lines.
Definition gpio2.h:369
LineRequest(const std::string &consumer)
Constructor initializes the LineRequest structure with specific consumer label.
Definition gpio2.h:384
LineRequest()
Default constructor initializes the LineRequest structure.
Definition gpio2.h:373
Values of GPIO lines.
Definition gpio2.h:447
LineValues()
Default constructor initializes the LineValues structure.
Definition gpio2.h:451
LineValues(std::uint64_t bits, std::uint64_t mask)
Constructor initializes the LineValues structure with specific bits and mask.
Definition gpio2.h:460