// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright 2017 Google Inc #include "sysfswrite.hpp" #include #include #include namespace pid_control { void SysFsWritePercent::write(double value) { double minimum = getMin(); double maximum = getMax(); double range = maximum - minimum; double offset = range * value; double ovalue = offset + minimum; std::ofstream ofs; ofs.open(_writePath); ofs << static_cast(ovalue); ofs.close(); return; } void SysFsWrite::write(double value) { std::ofstream ofs; ofs.open(_writePath); ofs << static_cast(value); ofs.close(); return; } } // namespace pid_control