1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

32 Commits

Author SHA1 Message Date
Marian Buschsieweke
29cfeb752e
sys/phydat: use flash_utils 2023-02-27 12:31:03 +01:00
Marian Buschsieweke
3c287c058d
sys/phydat: Fix unit confusion
Previously, `UNIT_G` was used for g-force with the correct symbol `g`,
`UNIT_GR` for gram (as in kilogram) with the incorrect symbol `G` (which
would be correct for Gauss), and `UNIT_GS` for Gauss with symbol `Gs`
(which is an uncommon but correct symbol).

To avoid confusion between G-Force, Gauss, and Gram the units have been
renamed to `UNIT_G_FORCE`, `UNIT_GRAM`, and `UNIT_GAUSS`. In addition,
gram now uses the correct symbol `g` and Gauss uses `G`.
2023-02-23 16:44:24 +01:00
bors[bot]
855dc07b20
Merge #19080
19080: sys/phydat: add functions for Unix time conversion to phydat r=benpicco a=silkeh




Co-authored-by: Silke Hofstra <silke@slxh.eu>
2023-01-21 21:45:41 +00:00
Silke Hofstra
26653dd446 sys/phydat: add functions for Unix time conversion to phydat
Add functionality for calculating Unix timestamps to phydat.
This allows one to convert dates received from RTCs and the like
to Unix timestamps.
2023-01-21 11:01:42 +01:00
Karl Fessel
af8589059e sys/includes: replace kernel_defines.h 2022-11-22 13:39:35 +01:00
Lars Pfau
7a94b36430 sys/phydat: fix phydat_to_json dim precondition 2022-05-19 07:29:51 +02:00
chrysn
206bea0a1d phydat: Add Tesla unit
While this is equivalent to the existing Gs (1 T = 10^-4 Gs), this is
the SI (and thus preferred) unit.
2022-01-25 13:46:08 +01:00
Silke Hofstra
5e9b531d33 sys/phydat: clarify use of phydat::scale in phydat_fit 2021-03-04 21:30:18 +01:00
Hauke Petersen
9ad65786dd sys/phydat: added phydat_to_json converter 2020-05-20 15:29:24 +02:00
Hauke Petersen
3e4229cd31 phydat: add verbose unit_to_str function 2020-05-20 15:29:24 +02:00
Gunar Schorcht
558322bc6f sys/phydat: add ohm as unit 2020-03-12 08:42:59 +01:00
Michel Rottleuthner
36fca364f8 sys/phydat: add unit for count per cubic meter 2020-02-20 14:26:55 +01:00
61db4d9724 sys/include: fix typos 2019-11-23 22:39:37 +01:00
fabian18
7e8cce875a drivers/ina3221: Added SAUL integration 2019-11-05 12:37:41 +01:00
Leandro Lanzieri
563a053bc1
Merge pull request #10983 from skullbox305/driver_ph_oem
drivers/ph_oem: support for Atlas Scientific pH OEM sensor
2019-09-09 10:18:49 +02:00
Igor Knippenberg
61d0970939 drivers/saul: Added pH
- added device class SAUL_SENSE_PH in saul.h
- added stringification SAUL_SENSE_PH in saul_str.c
2019-09-05 12:47:10 +02:00
Benjamin Valentin
e8dc1119b8 sys: make use of ARRAY_SIZE macro 2019-08-06 19:43:54 +02:00
Leandro Lanzieri
afeb5c1e04 sys/phydat: Add capacitance unit (F) 2019-02-15 13:37:45 +01:00
Michel Rottleuthner
61dc1920d3 sys/phydat: add unit for mass concentration (g/m^3) 2019-01-30 13:15:17 +01:00
Marian Buschsieweke
cc0e6dc779
sys/phydat: Added unit Coulomb 2019-01-28 13:33:16 +01:00
Marian Buschsieweke
a04001d781
sys/phydat: Added unit decibel-milliwatts 2018-11-06 11:07:01 +01:00
Marian Buschsieweke
fe46cae00d
sys/phydat: New phydat_fit API
The current phydat_fit implementation the following limitations:
- The API is way more complicated to use than needed
- It doesn't perform any rounding
- It uses `long` in a place where actual width (or better range) of the type
  is pretty important.

This commit addresses these limitations and uses lookup-tables to reduce the
number of divisions required.

Before this commit code using it looked like this:
``` C
long values[] = { 100000, 2000000, 30000000 };
phydat_t dat = { .scale = 42, .unit = UNIT_V };
phydat_fit(&dat, values[0], 0, phydat_fit(&dat, values[1], 1, phydat_fit(&dat, values[2], 2, 0)));
```

Now it can be used like this:
``` C
int32_t values[] = { 100000, 2000000, 30000000 };
phydat_t dat = { .unit = UNIT_V, .scale = 42 };
phydat_fit(&dat, values, 3);
```
2018-10-24 13:05:51 +02:00
d4bfb0f0a3 sys/phydat: add counts unit 2018-10-15 11:44:04 +02:00
25b90317f3 sys/phydat: add ppb unit support 2018-06-11 15:46:46 +02:00
Joakim Nohlgård
63f49f22d8 sys/phydat: Add phydat_fit
Fits larger values into the 16 bit integers used by phydat and update
scale accordingly.
2018-03-22 15:21:01 +01:00
Joakim Nohlgård
7f89435dc7 sys/phydat: Introduce PHYDAT_MIN, PHYDAT_MAX 2018-02-28 08:33:01 +01:00
Joakim Nohlgård
56f44729d7 sys/phydat: rename phydat_scale_to_str -> phydat_prefix_from_scale
Correct some outdated documentation and make the name represent what the
function does today.
2018-02-26 15:41:36 +01:00
0fcc7d3834 cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
e2e3704973 sys/phydat: adding illuminance unit (Lux) 2016-06-06 11:04:11 +02:00
Hauke Petersen
2a4b7cbc91 sys/phydat: dump function can handle fixed floats 2016-03-29 15:23:04 +02:00
Hauke Petersen
6134dc80fd sys/phydat: fixed typos in documentation 2015-12-01 14:34:59 +01:00
Hauke Petersen
786895a378 sys: added module for handling physical data 2015-11-30 20:33:53 +01:00