blob: 5979f962b3d5b76999ae7c22c25e1718c4c3c80e [file] [log] [blame]
Brian Silverman425492b2015-12-30 15:23:55 -08001#ifndef FRC971_WPILIB_PDP_FETCHER_H_
2#define FRC971_WPILIB_PDP_FETCHER_H_
3
4#include <memory>
5#include <atomic>
6
Brian Silverman425492b2015-12-30 15:23:55 -08007#include "PowerDistributionPanel.h"
8
9namespace frc971 {
10namespace wpilib {
11
12// Handles fetching values from the PDP. This is slow, so it has to happen in a
13// separate thread.
14class PDPFetcher {
15 public:
Brian Silverman425492b2015-12-30 15:23:55 -080016 void Quit() { run_ = false; }
17
Brian Silverman425492b2015-12-30 15:23:55 -080018 // To be called by a ::std::thread.
19 void operator()();
20
21 private:
Brian Silverman425492b2015-12-30 15:23:55 -080022 ::std::atomic<bool> run_{true};
23};
24
25} // namespace wpilib
26} // namespace frc971
27
28#endif // FRC971_WPILIB_PDP_FETCHER_H_