Rework library without unix sockets for now

This commit is contained in:
Konstantin Lampalzer 2022-05-21 23:29:55 +02:00
parent e9ae1a320a
commit 0bef6035ae
30 changed files with 987 additions and 136 deletions

View 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