UNPKG

jvsveml6070

Version:

Node.js package for the Vishay VEML6070 UVA Light Sensor, written in TypeScript.

33 lines (32 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SensorValue = void 0; const module_1 = require("./module"); class SensorValue { /** * Creates a new `SensorValue` instance. * * @param rawValue - The raw value. * @param normalizedValue - The normalized value. * @param uvIndex - The `UvIndex` instance. */ constructor(rawValue, normalizedValue, uvIndex) { this.rawValue = rawValue; this.normalizedValue = normalizedValue; this.uvIndex = uvIndex; } /** * Creates a new `SensorValue` instance from a raw value. * * @param rSet - The RSET value (in kΩ). * @param integrationTime - The `IntegrationTime` instance. * @param rawValue - The raw value. * * @returns The `SensorValue` instance. */ static fromRawValue(rSet, integrationTime, rawValue) { const normalizedValue = rawValue / integrationTime.multiplier, uvIndex = module_1.UvIndex.fromSensorValue(rSet, normalizedValue); return new SensorValue(rawValue, normalizedValue, uvIndex); } } exports.SensorValue = SensorValue;