najnesnaj / pinetime-zephyr

pinetime smartwatch nrf52 zephyr
Apache License 2.0
107 stars 20 forks source link

Hrs3300 sensor cleanup and shell sample #19

Closed nordic-krch closed 4 years ago

nordic-krch commented 4 years ago

Cleaned hrs3300 driver, added API for configuration. Sensor API does not fit that well and would look a bit artificial to use it thus hrs3300.h created for hrs3300 control.

Added shell commands for full control of the sensor:

rtt:~$ hrs3300
  hgain    hwt      pdrive   read     sample   dump     disable  enable

Configuration can be read, like:

rtt:~$ hrs3300 hwt
HWT:12.5ms

and set:

rtt:~$ hrs3300 hwt
  800ms   400ms   200ms   100ms   75ms    50ms    12_5ms  0ms
rtt:~$ hrs3300 hwt 200ms

With command read sensor data can be dumped which can be useful during algorithm development:

rtt:~$ hrs3300 read hrs 20
3169
3169
3169
3161
3161
3154
3154
3154
3153
3153
3153
3156
3156
3162
3162
3162
3163
3163
3163
3162
Sampling period 12

Added samples/shell, a sample which targets to have all pinetime shell commands enabled (currently battery and hrs3300).