From e5c40feae02560f56790457be1c2e289ccd0ce6f Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Fri, 25 May 2018 15:27:18 +0930 Subject: physical: 'frequency' is really periodicity Change-Id: I1007d2a7104fa07351c89c52a860cde83b2d509c Signed-off-by: Andrew Jeffery --- physical.cpp | 16 ++++++++-------- 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 * -- cgit v1.2.1