Class Opt3001
A Texas Instruments OPT3001 ambient light sensor. Every call goes straight to the pamoja C ABI, which decodes exactly what the manufacturer's datasheet specifies.
public static class Opt3001
- Inheritance
-
Opt3001
- Inherited Members
Methods
ConfigBits(PamojaOpt3001Config)
Assembles the 16-bit OPT3001 configuration register value.
public static ushort ConfigBits(PamojaOpt3001Config config)
Parameters
configPamojaOpt3001ConfigThe config.
Returns
- ushort
The value the C ABI computes.
ConfigFromBits(ushort)
Parses a 16-bit OPT3001 configuration register value.
public static PamojaOpt3001Config ConfigFromBits(ushort bits)
Parameters
bitsushortThe bits.
Returns
- PamojaOpt3001Config
The decoded value.
Exceptions
- PamojaException
The device data is not valid.
ConversionMillis(bool)
Returns the conversion time an OPT3001 setting selects.
public static ushort ConversionMillis(bool longConversion)
Parameters
longConversionboolThe long conversion.
Returns
- ushort
The value the C ABI computes.
FaultCount(byte)
Returns how many consecutive faults an OPT3001 fault-count code requires.
public static byte FaultCount(byte code)
Parameters
codebyteThe code.
Returns
- byte
The value the C ABI computes.
FullScaleMilliLux(byte)
Returns the full scale an OPT3001 range number covers.
public static uint? FullScaleMilliLux(byte rangeNumber)
Parameters
rangeNumberbyteThe range number.
Returns
- uint?
The value, or null where the part defines none.
IsAutomaticRange(byte)
Reports whether an OPT3001 range number sets the full scale automatically.
public static bool IsAutomaticRange(byte rangeNumber)
Parameters
rangeNumberbyteThe range number.
Returns
- bool
The value the C ABI computes.
LsbMilliLux(byte)
Returns the illuminance one count carries at an OPT3001 exponent.
public static uint? LsbMilliLux(byte exponent)
Parameters
exponentbyteThe exponent.
Returns
- uint?
The value, or null where the part defines none.
Lux(ushort)
Converts a raw OPT3001 result register to lux.
public static float Lux(ushort raw)
Parameters
rawushortThe raw.
Returns
- float
The value the C ABI computes.
MilliLux(ushort)
Converts a raw OPT3001 result register to milli-lux.
public static uint MilliLux(ushort raw)
Parameters
rawushortThe raw.
Returns
- uint
The value the C ABI computes.
RawFromMilliLux(uint)
Builds the OPT3001 result register that decodes to an illuminance.
public static ushort RawFromMilliLux(uint milliLux)
Parameters
milliLuxuintThe milli lux.
Returns
- ushort
The value the C ABI computes.
WordFromBytes(ReadOnlySpan<byte>)
Reads the two bytes an OPT3001 sends for a register, most significant first.
public static ushort WordFromBytes(ReadOnlySpan<byte> bytes)
Parameters
bytesReadOnlySpan<byte>The bytes.
Returns
- ushort
The decoded value.
Exceptions
- PamojaException
The device data is not valid.
WordToBytes(ushort)
Builds the two bytes an OPT3001 sends for a register, most significant first.
public static byte[] WordToBytes(ushort word)
Parameters
wordushortThe word.
Returns
- byte[]
The decoded value.
Exceptions
- PamojaException
The device data is not valid.