Rework library without unix sockets for now
This commit is contained in:
parent
e9ae1a320a
commit
0bef6035ae
30 changed files with 987 additions and 136 deletions
37
server_v2/include/IRSensors.hpp
Normal file
37
server_v2/include/IRSensors.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef COMPLIB_SERVER_IRSENSORS_HPP
|
||||
#define COMPLIB_SERVER_IRSENSORS_HPP
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include "include/Cache.hpp"
|
||||
#include "include/Robot.hpp"
|
||||
|
||||
class IRSensors {
|
||||
public:
|
||||
static IRSensors &getInstance() {
|
||||
static IRSensors instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
IRSensors(IRSensors const &) = delete;
|
||||
|
||||
void operator=(IRSensors const &) = delete;
|
||||
|
||||
static void enable();
|
||||
|
||||
static void disable();
|
||||
|
||||
std::array<uint16_t, ROBOT_IR_SENSOR_COUNT> read();
|
||||
|
||||
private:
|
||||
|
||||
IRSensors() = default;
|
||||
|
||||
Cache cache{ROBOT_IR_RATE_HZ};
|
||||
|
||||
std::array<uint16_t, ROBOT_IR_SENSOR_COUNT> cached_values = {0};
|
||||
};
|
||||
|
||||
|
||||
#endif //COMPLIB_SERVER_IRSENSORS_HPP
|
Reference in a new issue