xref: /openbmc/phosphor-pid-control/pid/pidloop.hpp (revision a076487aab0ee71ea32d53f798d5ca6b31677278)
1ce6a3f36SJames Feist #pragma once
2ce6a3f36SJames Feist 
3ce6a3f36SJames Feist #include "pid/zone.hpp"
4ce6a3f36SJames Feist 
5ce6a3f36SJames Feist #include <boost/asio/steady_timer.hpp>
6ce6a3f36SJames Feist 
7*a076487aSPatrick Venture namespace pid_control
8*a076487aSPatrick Venture {
9*a076487aSPatrick 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  *
15ce6a3f36SJames Feist  * @param[in] zone - ptr to the PIDZone 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  */
20ce6a3f36SJames Feist void pidControlLoop(PIDZone* zone, boost::asio::steady_timer& timer,
21ce6a3f36SJames Feist                     bool first = true, int ms100cnt = 0);
22*a076487aSPatrick Venture 
23*a076487aSPatrick Venture } // namespace pid_control
24