GY-63_MS5611/libraries/TSL235R/TSL235R.h

56 lines
1.3 KiB
C
Raw Normal View History

2021-05-30 08:16:15 -04:00
#pragma once
//
// FILE: TSL235R.h
// AUTHOR: Rob Tillaart
2023-11-23 08:06:30 -05:00
// VERSION: 0.1.5
2023-02-18 09:26:18 -05:00
// DATE: 2020-05-29
2021-12-29 07:37:09 -05:00
// PURPOSE: library for the TSL235R light to frequency convertor
2023-02-18 09:26:18 -05:00
// URL: https://github.com/RobTillaart/TSL235R
2021-05-30 08:16:15 -04:00
2023-11-23 08:06:30 -05:00
#define TSL235R_LIB_VERSION (F("0.1.5"))
2021-05-30 08:16:15 -04:00
#include "Arduino.h"
2023-02-18 09:26:18 -05:00
#if not defined(TSL235_DEFAULT_VOLTAGE)
#define TSL235_DEFAULT_VOLTAGE 5.0
#endif
2021-05-30 08:16:15 -04:00
class TSL235R
{
public:
2023-02-18 09:26:18 -05:00
TSL235R(float voltage = TSL235_DEFAULT_VOLTAGE);
2021-05-30 08:16:15 -04:00
2023-02-18 09:26:18 -05:00
// Hz == pulses in one second.
// could be calculated from shorter/longer measurement.
float irradiance(uint32_t Hz);
float irradiance(uint32_t pulses, uint32_t milliseconds);
2021-06-04 09:58:39 -04:00
float irradiance_HS(uint32_t pulses, uint32_t microseconds);
2023-02-18 09:26:18 -05:00
float getFactor();
2021-05-30 08:16:15 -04:00
void setWavelength(uint16_t wavelength = 635);
2023-02-18 09:26:18 -05:00
uint16_t getWavelength();
float getWaveLengthFactor();
2021-05-30 08:16:15 -04:00
2023-02-18 09:26:18 -05:00
void setVoltage(float voltage = TSL235_DEFAULT_VOLTAGE);
float getVoltage();
float getVoltageFactor();
2021-05-30 08:16:15 -04:00
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 _voltageFactor = 1.0;
2023-02-18 09:26:18 -05:00
float _voltage;
float _factor;
2021-05-30 08:16:15 -04:00
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