diff options
author | Serhii Voloshynov <serhii.voloshynov@globallogic.com> | 2023-12-06 12:33:32 +0200 |
---|---|---|
committer | Serhii Voloshynov <serhii.voloshynov@globallogic.com> | 2023-12-06 14:30:49 +0200 |
commit | b3bcccc55f64c0a24030fd45c7041c5892853d13 (patch) | |
tree | f8daaea88f9d7ced334f87852d0089f7fcccb7c1 /src/Device | |
parent | aa172072fd91a48cf0c14d20e6dd733d43b7c951 (diff) | |
download | mts-io-sysfs-b3bcccc55f64c0a24030fd45c7041c5892853d13.tar.gz mts-io-sysfs-b3bcccc55f64c0a24030fd45c7041c5892853d13.tar.bz2 mts-io-sysfs-b3bcccc55f64c0a24030fd45c7041c5892853d13.zip |
[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
Diffstat (limited to 'src/Device')
-rw-r--r-- | src/Device/Device.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
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 <store> operation. it defines in milliseconds\n"); printf("Usage:\n"); printf(" Load : mts-io-sysfs -l -p <path> -i <file>\n"); printf(" Check : mts-io-sysfs -c -p <path>\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) { |