From b3bcccc55f64c0a24030fd45c7041c5892853d13 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Wed, 6 Dec 2023 12:33:32 +0200 Subject: [MTX-5095][GP-2116] add DigitalIO, add pulse generation. It has 1ms accuracity on MTCAP3, tested in range 0-100% CPU loads using stress-ng --- src/Device/Device.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/Device') diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp index e7e295b..2b56895 100644 --- a/src/Device/Device.cpp +++ b/src/Device/Device.cpp @@ -489,6 +489,7 @@ void Device::printUsage(std::string program) { printf(" : is an expected full path. i.e. /dev/spidevX.X\n"); printf(" -i, --input : input file for upgrade\n"); printf(" : files are stored in /usr/lib/mts-flash-binaries\n"); + printf(" -u, --duration : optional field for operation. it defines in milliseconds\n"); printf("Usage:\n"); printf(" Load : mts-io-sysfs -l -p -i \n"); printf(" Check : mts-io-sysfs -c -p \n"); @@ -765,16 +766,12 @@ void Device::store(std::string name, std::string value) { if (gr.request()) { retval = gpiod_line_request_set_value(gr.request(),gr.offset(),lv); - if(retval != -1) { - storeOutputStateToNonvolatile(name, value); - exitHandler(0); - } - else + if(retval == -1) { simpleError("Could not set GPIO value",errno,111); + } } } } - std::ofstream fileToWrite(SYSFS_PLATFORM + name); if (fileToWrite.is_open()) { fileToWrite << value; @@ -783,13 +780,12 @@ void Device::store(std::string name, std::string value) { name.c_str(),strerror(errno)); exitHandler(98); } - storeOutputStateToNonvolatile(name, value); fileToWrite.close(); - exitHandler(0); + } else { + printError("Can't open %s%s: %s", SYSFS_PLATFORM, + name.c_str(),strerror(errno)); + exitHandler(99); } - printError("Can't open %s%s: %s", SYSFS_PLATFORM, - name.c_str(),strerror(errno)); - exitHandler(99); } void Device::storeTrigger(std::string name, std::string value) { -- cgit v1.2.3