Channel configuration the Si1133 sensor. More...
Channel configuration the Si1133 sensor.
The sensor sampling in the Si1133 is done via Analog to Digital "channels" that read from a given sensor (photodiode combination) and output a numeric value. The A/D process has some configuration parameters that affect the acquisition time, the power consumption and the quality of the result.
The A/D time is controlled by the internal 21 MHz clock. The sampling duration time is:
(1 << decimation) * (1 << hw_gain) * 512 / 21000000 s
where decimation
is a number between 0 and 3 and hw_gain" is between 0
and 11. The shortest A/D sampling time is therefore 24.4 us while the longest
is 400 ms. However, each sample is performed twice internally to cancel ADC
offset and there are processing and sampling start times specified in the
datasheet that increase the total sampling time. Increasing the sampling time
doesn't make the output value be larger.
The @p hw_gain and @p decimation parameters are configured from a single
@p sample_time_log parameter in this struct, between 0 and 14, preferring the
"normal" decimation when possible.
An additional software sampling and averaging is possible by selecting a
"sw_gain"
value between 0 and 7. This will cause each A/D measurement to be repeated for a total of (1 << sw_gain) and accumulated in software in the 24-bit output. The output value will be affected by the sw_gain since it is a sum of samples and not an average.
#include <si1133.h>
Data Fields | |
uint8_t | sample_time_log |
Log2 of sampling time, 0 to 14. | |
uint8_t | sw_gain |
Software gain, 0 to 7. | |
si1133_sensor_t | sensor |
Sensor to sample. | |
uint8_t si1133_channel_t::sample_time_log |
si1133_sensor_t si1133_channel_t::sensor |