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

44 Commits

Author SHA1 Message Date
Marian Buschsieweke
be0d276caa
Merge pull request #20529 from Teufelchen1/deprecate/phydat_str
sys/phydat: Remove deprecated print function
2024-04-04 11:24:04 +00:00
Teufelchen1
96e748d959 sys/phydat: Remove deprecated print function
Co-authored-by: Marian Buschsieweke <maribu@users.noreply.github.com>
2024-04-03 15:29:19 +02:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
643c239b27
sys/phydat: move dependency resolution in its own Makefile.dep 2023-06-15 10:24:52 +02:00
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
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
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
Leandro Lanzieri
dd3ef01ed6
sys/phydat: add module to Kconfig 2020-11-25 12:00:13 +01:00
Bas Stottelaar
80d9da90df sys/*: add missing include of assert.h 2020-10-22 11:13:09 +02: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
Hauke Petersen
7764754686 phydat: fixes to phydat_str.c
- add some missing unit strings to phydat_unit_to_str
- fixed doxygen group and file description
2020-05-20 15:23:21 +02:00
Gunar Schorcht
558322bc6f sys/phydat: add ohm as unit 2020-03-12 08:42:59 +01:00
Gunar Schorcht
1eabcb9566 sys/phydat: improvements of formatting in dump 2020-02-29 12:36:55 +01:00
Gunar Schorcht
b1228beb68 sys/phydat: add data and time in dump 2020-02-28 16:27:34 +01:00
Gunar Schorcht
4e77c7eb7b sys/phydat: add unit permille in dump 2020-02-28 15:29:06 +01:00
Michel Rottleuthner
36fca364f8 sys/phydat: add unit for count per cubic meter 2020-02-20 14:26:55 +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
Hauke Petersen
a7c3aad8ea sys/phydat: adapt to fmt_s16_dfp changes 2018-04-06 12:10:18 +02:00
Joakim Nohlgård
2125a438b4 sys/phydat: Align numbers, remove index if dim == 1 2018-03-23 14:51:08 +01:00
Joakim Nohlgård
3e2214d29c sys/phydat: Fix Doxygen group for phydat_str.c 2018-03-22 15:21:01 +01: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
fa8690e584 sys/phydat: Add space between value and unit 2018-02-28 08:34:34 +01:00
6698bfd35a
Merge pull request #8595 from bergzand/pr/saul-ppm
SAUL/phydat: parts per million support
2018-02-27 08:12:18 +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
df16e7d5af
phydat: Add parts per million unit 2018-02-23 11:39:09 +01:00
smlng
e4382ae5c5 sys,phydat: fix scale_2_str for multi and non dimensional units 2017-08-25 14:38:55 +02:00
smlng
7f012f9af8 sys,phydat: add missing unit strings (m^2, m^3) 2017-06-27 11:03:07 +02:00
smlng
1cbbece41d sys,phydat: add prefix hecto 2017-06-27 10:06:45 +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
786895a378 sys: added module for handling physical data 2015-11-30 20:33:53 +01:00