1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-25 12:39:18 +03:00
Files
libgpiod/bindings/cxx/examples/get_chip_info.cpp
Bartosz Golaszewski 753c33142f bindings: cxx: examples: consistently use () for functions taking no args
While () and (void) are synonymous in C++, we use () everywhere else so
stick to that pattern in examples.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-27 10:48:09 +02:00

28 lines
623 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-FileCopyrightText: 2023 Kent Gibson <warthog618@gmail.com>
/* Minimal example of reading the info for a chip. */
#include <cstdlib>
#include <filesystem>
#include <gpiod.hpp>
#include <iostream>
namespace {
/* Example configuration - customize to suit your situation */
const ::std::filesystem::path chip_path("/dev/gpiochip0");
} /* namespace */
int main()
{
::gpiod::chip chip(chip_path);
auto info = chip.get_info();
::std::cout << info.name() << " [" << info.label() << "] ("
<< info.num_lines() << " lines)" << ::std::endl;
return EXIT_SUCCESS;
}