DUDS
Distributed Update of Data from Something
TSL2591.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2017 Jeff Jackowski
9  */
10 #ifndef TSL2591_HPP
11 #define TSL2591_HPP
12 
16 #include <duds/data/Quantity.hpp>
17 
18 namespace duds { namespace hardware { namespace devices { namespace instruments {
19 
32 
40 class TSL2591 : boost::noncopyable {
44  std::unique_ptr<duds::hardware::interface::I2c> com;
61  double scale;
65  std::uint16_t broad, ir;
66 public:
73  TSL2591(std::unique_ptr<duds::hardware::interface::I2c> &c);
77  ~TSL2591();
95  void init(int gain, int integration);
99  void suspend();
104  void resume();
109  void sample();
117  duds::data::Quantity brightness() const;
121  std::uint16_t brightnessCount() const {
122  return broad;
123  }
131  duds::data::Quantity brightnessIr() const;
135  std::uint16_t brightnessIrCount() const {
136  return ir;
137  }
138 };
139 
140 } } } }
141 
142 #endif // #ifndef TSL2591_HPP
A container for a value and a unit to better describe the value.
Definition: Quantity.hpp:37
An invalid integration time was specified.
Definition: TSL2591.hpp:31
std::uint16_t brightnessIrCount() const
The value reported by the device for the infrared brightness.
Definition: TSL2591.hpp:135
A quick try at supporting TSL2591 brightness sensor; will change significantly in the future...
Definition: TSL2591.hpp:40
duds::hardware::interface::Conversation input
The conversation used to query the brightness values.
Definition: TSL2591.hpp:54
Base class for all TSL2591 specific errors.
Definition: TSL2591.hpp:23
An invalid gain value was specified.
Definition: TSL2591.hpp:27
std::unique_ptr< duds::hardware::interface::I2c > com
The I2C communication interface.
Definition: TSL2591.hpp:44
std::uint16_t brightnessCount() const
The value reported by the device for the broad spectrum brightness.
Definition: TSL2591.hpp:121
double scale
A scalar value used to partially convert the counts supplied by the device into a value in Watts per ...
Definition: TSL2591.hpp:61
Header for Conversarion; includes ConversationVector.hpp and ConversationExternal.hpp.
The base type for errors from devices.
duds::hardware::interface::Conversation initialize
The conversation used to initialize the device.
Definition: TSL2591.hpp:49
Represents a two-way conversation with a device.