xref: /openbmc/gpioplus/example/pulse.cpp (revision 8a87555f)
1 #include <gpioplus/chip.hpp>
2 #include <gpioplus/handle.hpp>
3 #include <string>
4 
5 int main(int argc, char* argv[])
6 {
7     if (argc != 3)
8     {
9         fprintf(stderr, "pulse [chip id] [line offset]\n");
10         return 1;
11     }
12 
13     unsigned chip_id = std::stoi(argv[1]);
14     uint32_t line_offset = std::stoi(argv[2]);
15 
16     gpioplus::Chip chip(chip_id);
17     gpioplus::HandleFlags flags(chip.getLineInfo(line_offset).flags);
18     flags.output = true;
19     gpioplus::Handle handle(chip, {{line_offset, 0}}, flags, "example/pulse");
20     handle.setValues({1});
21     handle.setValues({0});
22 
23     return 0;
24 }
25