2021-05-30 08:16:15 -04:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: TSL235R.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2022-11-26 11:40:57 -05:00
|
|
|
// VERSION: 0.1.3
|
2021-12-29 07:37:09 -05:00
|
|
|
// PURPOSE: library for the TSL235R light to frequency convertor
|
2021-05-30 08:16:15 -04:00
|
|
|
|
|
|
|
|
2022-11-26 11:40:57 -05:00
|
|
|
#define TSL235R_LIB_VERSION (F("0.1.3"))
|
2021-05-30 08:16:15 -04:00
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
|
|
|
|
class TSL235R
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
TSL235R(float voltage = 5.0);
|
|
|
|
|
2022-11-26 11:40:57 -05:00
|
|
|
float irradiance(uint32_t Hz); // Hz == pulses in one second.
|
|
|
|
float irradiance(uint32_t pulses, uint32_t milliseconds); // obsolete?
|
2021-06-04 09:58:39 -04:00
|
|
|
float irradiance_HS(uint32_t pulses, uint32_t microseconds);
|
2021-05-30 08:16:15 -04:00
|
|
|
float getFactor() { return _factor; };
|
|
|
|
|
|
|
|
void setWavelength(uint16_t wavelength = 635);
|
|
|
|
uint16_t getWavelength() { return _waveLength; }
|
|
|
|
float getWaveLengthFactor() { return _waveLengthFactor; }
|
|
|
|
|
|
|
|
void setVoltage(float voltage = 5.0);
|
|
|
|
float getVoltage() { return _voltage; };
|
|
|
|
float getVoltageFactor() { return _voltageFactor; };
|
|
|
|
|
2021-12-29 07:37:09 -05:00
|
|
|
|
2021-05-30 08:16:15 -04:00
|
|
|
private:
|
|
|
|
uint16_t _waveLength = 635;
|
|
|
|
float _waveLengthFactor = 1.0;
|
|
|
|
float _voltage = 5.0;
|
|
|
|
float _voltageFactor = 1.0;
|
|
|
|
float _factor = 1.2;
|
|
|
|
|
|
|
|
void calculateFactor();
|
2022-11-26 11:40:57 -05:00
|
|
|
float calculateWaveLengthFactor(uint16_t _waveLength);
|
2021-12-29 07:37:09 -05:00
|
|
|
float multiMap(float value, float * _in, float * _out, uint8_t size);
|
2021-05-30 08:16:15 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-11-26 11:40:57 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-29 07:37:09 -05:00
|
|
|
|