The SI1133 from Silicon Labs is a UV Index Sensor and Ambient Light
Sensor in a small 2x2 mm DFN package. The sensor can measure
independently ultra violet (UV) light, infra red (IR) light and
ambient light, however the ambient light is also influenced by the
IR light requiring compensation from the IR readings.
The SI1133 is quite different from other Silicon Labs chips in RIOT OS
and therefore needs its own driver. In particular, the SI1133 has 7
different photodiode configurations to read but only 6 channels to
read them in parallel so only some channels can be read each time.
This patch implements a new driver allowing to read the data directly
and a saul interface for the three kinds of light source. There are
many configuration options including interrupts and continous modes
that are left out of this initial driver.
Booleans make sense for dimmers when accessed from a Sith application
that deals in absolutes.
Percent values are also a widespread interpretation of brightness
levels, and are thus supported as well.
The bit arithmetic makes sure that the arithmetic operation value / 100
* saul_pwm_resolution is done efficiently (by expression as a
multiplication followed by shifting) and accurately (by maximizing the
number of usable bits) while still being flexible both with respect to
integer sizes and to changes of saul_pwm_resolution.
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
In analogy to the existing GPIO mappings, this provides (write-only)
SAUL entries for PWM'd LEDs in a single-LED (as SAUL_ACT_DIMMER) and an
RGB (as SAUL_ACT_RGB_LED) mode.
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
- Changed declaration of SAUL classes (while keeping the format)
- Termed "class of SAUL classes" category of SAUL classes in the doc to
avoid confusion. (E.g. a SAUL class will now be in category sensor or
actuator.)
- Separate enums for SAUL category and intra-category ID. Numbers will now
but auto-assigned by the compiler
- Use constant look-up tables for stringification (one table per SAUL category).
==> This saves 512B in .data section of AVR
A memset was used to clear two of the SAUL values in phydat_t::val
The change is to replace that by the following
res->val[1] = 0;
res->val[2] = 0;
which makes the code more obvious.