diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-05-25 15:27:18 +0930 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2019-04-08 13:48:50 +0930 |
commit | e5c40feae02560f56790457be1c2e289ccd0ce6f (patch) | |
tree | 668e342a0f5799623bc5235da61d623048944aa9 | |
parent | 30726a0c584e77677f64d5f06f8588b1b9881532 (diff) | |
download | phosphor-led-sysfs-e5c40feae02560f56790457be1c2e289ccd0ce6f.tar.gz phosphor-led-sysfs-e5c40feae02560f56790457be1c2e289ccd0ce6f.zip |
physical: 'frequency' is really periodicity
Change-Id: I1007d2a7104fa07351c89c52a860cde83b2d509c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r-- | physical.cpp | 16 | ||||
-rw-r--r-- | physical.hpp | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/physical.cpp b/physical.cpp index 3290661..0de2a53 100644 --- a/physical.cpp +++ b/physical.cpp @@ -41,8 +41,8 @@ void Physical::setInitialState() auto delayOff = led.getDelayOff(); // Calculate frequency and then percentage ON - frequency = delayOn + delayOff; - auto factor = frequency / 100; + periodMs = delayOn + delayOff; + auto factor = periodMs / 100; auto dutyOn = delayOn / factor; // Update. @@ -50,10 +50,10 @@ void Physical::setInitialState() } else { - // This is hardcoded for now. This will be changed to this->frequency() - // when frequency is implemented. + // This is hardcoded for now. This will be changed to this->period() + // when configurable periodicity is implemented. // TODO - frequency = 1000; + periodMs = 1000; // LED is either ON or OFF auto brightness = led.getBrightness(); @@ -137,11 +137,11 @@ void Physical::blinkOperation() // Write DutyON. Value in percentage 1_millisecond. // so 50% input becomes 500. Driver wants string input - auto percentage = frequency / 100; - led.setDelayOn(dutyOn * percentage); + auto factor = periodMs / 100; + led.setDelayOn(dutyOn * factor); // Write DutyOFF. Value in milli seconds so 50% input becomes 500. - led.setDelayOff((100 - dutyOn) * percentage); + led.setDelayOff((100 - dutyOn) * factor); return; } diff --git a/physical.hpp b/physical.hpp index 3d99066..e588de2 100644 --- a/physical.hpp +++ b/physical.hpp @@ -69,10 +69,10 @@ class Physical : public sdbusplus::server::object::object< */ SysfsLed& led; - /** @brief Frequency range that the LED can operate on. - * Will be removed when frequency is put into interface + /** @brief The period that the LED will operate on, in milliseconds + * Will be removed when periodicity is put into interface */ - uint32_t frequency; + uint32_t periodMs; /** @brief reads sysfs and then setsup the parameteres accordingly * |