xref: /openbmc/phosphor-pid-control/pid/pidloop.hpp (revision 5301aae3507da459b318e11f16ced54a32024bbc)
1ce6a3f36SJames Feist #pragma once
2ce6a3f36SJames Feist 
37a98c19aSPatrick Venture #include "pid/zone_interface.hpp"
4ce6a3f36SJames Feist 
5ce6a3f36SJames Feist #include <boost/asio/steady_timer.hpp>
6ce6a3f36SJames Feist 
7a076487aSPatrick Venture namespace pid_control
8a076487aSPatrick Venture {
9a076487aSPatrick Venture 
10ce6a3f36SJames Feist /**
11ce6a3f36SJames Feist  * Main pid control loop for a given zone.
12ce6a3f36SJames Feist  * This function calls itself indefinitely in an async loop to calculate
13ce6a3f36SJames Feist  * fan outputs based on thermal inputs.
14ce6a3f36SJames Feist  *
157a98c19aSPatrick Venture  * @param[in] zone - ptr to the ZoneInterface implementation for this loop.
16ce6a3f36SJames Feist  * @param[in] timer - boost timer used for async callback.
17ce6a3f36SJames Feist  * @param[in] first - boolean to denote if initialization needs to be run.
18ce6a3f36SJames Feist  * @param[in] ms100cnt - loop timer counter.
19ce6a3f36SJames Feist  */
20*5301aae3SJohnathan Mantey void pidControlLoop(std::shared_ptr<ZoneInterface> zone,
21*5301aae3SJohnathan Mantey                     std::shared_ptr<boost::asio::steady_timer> timer,
22ce6a3f36SJames Feist                     bool first = true, int ms100cnt = 0);
23a076487aSPatrick Venture 
24a076487aSPatrick Venture } // namespace pid_control
25