mirror of
https://github.com/google/mozc-devices.git
synced 2025-11-09 01:03:26 +03:00
Co-authored-by: Takashi Toyoshima <toyoshim@google.com> Co-authored-by: Shun Ikejima <ikejima@google.com>
33 lines
820 B
C++
33 lines
820 B
C++
// Copyright 2025 Google Inc.
|
|
// Use of this source code is governed by an Apache License that can be found
|
|
// in the LICENSE file.
|
|
|
|
#ifndef COMMON_PHOTO_SENSOR_H_
|
|
#define COMMON_PHOTO_SENSOR_H_
|
|
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
class PhotoSensor final {
|
|
public:
|
|
PhotoSensor(int8_t bit0,
|
|
int8_t bit1 = kNotUsed,
|
|
int8_t bit2 = kNotUsed,
|
|
int8_t bit3 = kNotUsed,
|
|
int8_t bit4 = kNotUsed,
|
|
int8_t bit5 = kNotUsed);
|
|
PhotoSensor(const PhotoSensor&) = delete;
|
|
PhotoSensor& operator=(const PhotoSensor&) = delete;
|
|
~PhotoSensor() = default;
|
|
|
|
uint8_t Read();
|
|
|
|
private:
|
|
static constexpr int8_t kNotUsed = -1;
|
|
static constexpr size_t kMaxWidth = 6;
|
|
|
|
std::array<int8_t, kMaxWidth> bits;
|
|
};
|
|
|
|
#endif // COMMON_PHOTO_SENSOR_H_
|