The previous servo driver didn't provide any benefit over using PWM
directly, as users controlled the servo in terms of PWM duty cycles.
This changes the interface to provide a high level interface that
abstracts the gory PWM details.
In addition, a SAUL layer and auto-initialization is provided.
Co-authored-by: benpicco <benpicco@googlemail.com>
This makes life easier when calling e.g. `saul_reg_write()` with data
stored in flash.
As now the signatures for reading and writing differ (in that `const`
qualifier only), `saul_notsup()` is split into `saul_write_notsup()`
and `saul_read_notsup()`. However, one is implemented as a symbol alias
of the other, so that ROM consumption remains unchanged.
The Silicon Labs Si705x sensors (Si7050/1/3/4/5) are very similar to the
Si7021 sensors featuring only a temperature sensor and no humidity
sensor. The only difference between the Si705x is the temperature
accuracy of the reading, ranging from +/- 0.1 C in the Si7051 to +/- 1 C
in the Si7050.
This patch adds support for this family of sensors extending the
functionality of the existing si70xx driver. Following the style of
other modules, this implements a pseudomodule per supported chip, adding
si7050, si7051, si7053, si7054 and si7055 pseudomodules.
As a minor change this patch also implements the missing
si70xx_get_serial, si70xx_get_id and si70xx_get_revision functions that
were declared in the si70xx.h header but implemented as private
functions. The si70xx_get_id() may be relevant for the application to
know at run time exactly which version of the hardware is installed.
The updated test running with a Si7051 shows the following output, which
seems consistent with the room temperature conditions during the test.
```
make SI70XX_VARIANT=si7051 -C tests/driver_si70xx/ all flash
```
```
SI70XX temperature and humidity sensor test application
Initializing sensor...
[OK]
Found SI7051 sensor, revision 32
temperature: 24.71 C
temperature: 24.69 C
```
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>