This repository has been archived on 2025-06-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
compLIB/server_v2/include/IRSensors.hpp
2022-05-21 23:31:23 +02:00

37 lines
665 B
C++

#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