blob: f169943cdebbefd1ca47d9904ad505da9913fd41 [file] [log] [blame]
Marc Olberding1e17db52025-08-27 12:25:28 -07001// SPDX-License-Identifier: Apache-2.0
Patrick Williams4a943522025-10-09 20:34:38 -04002// SPDX-FileCopyrightText: Copyright OpenBMC Authors
Marc Olberding1e17db52025-08-27 12:25:28 -07003
4#pragma once
5
6#include <gpiod.hpp>
7
8#include <chrono>
9#include <string>
10
11namespace gpio
12{
13void set(const char* line_name, int value,
14 std::chrono::milliseconds find_timeout = std::chrono::milliseconds{1});
15
16void set_raw(unsigned int chip_num, unsigned bit_num, int value);
17
18int get(const char* line_name);
19
20enum class EventResult
21{
22 Error,
23 Asserted,
24 Timeout
25};
26
27struct Event
28{
29 Event(const char* line_name_in, int value_in);
30 EventResult wait();
31
32 gpiod::line line;
33 std::string line_name;
34 int value;
35};
36
37int find_chip_idx_from_dir(std::string_view device_path);
38
39} // namespace gpio