1 #include <gpioplus/chip.hpp> 2 #include <gpioplus/handle.hpp> 3 4 #include <exception> 5 #include <string> 6 main(int argc,char * argv[])7int main(int argc, char* argv[]) 8 { 9 if (argc != 3) 10 { 11 fprintf(stderr, "pulse [chip id] [line offset]\n"); 12 return 1; 13 } 14 15 try 16 { 17 unsigned chip_id = std::stoi(argv[1]); 18 uint32_t line_offset = std::stoi(argv[2]); 19 20 gpioplus::Chip chip(chip_id); 21 gpioplus::HandleFlags flags(chip.getLineInfo(line_offset).flags); 22 flags.output = true; 23 gpioplus::Handle handle(chip, {{line_offset, 0}}, flags, 24 "example/pulse"); 25 handle.setValues({1}); 26 handle.setValues({0}); 27 return 0; 28 } 29 catch (const std::exception& e) 30 { 31 fprintf(stderr, "Error: %s\n", e.what()); 32 } 33 return 1; 34 } 35