-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lpsxxx: float arithmetics #17486
Labels
Area: drivers
Area: Device drivers
Type: question
The issue poses a question regarding usage of RIOT
Comments
IIRC, the previous version of the calculation was not working with new variants of the driver. It was initially written for lps331ap, then there was lps25hb and more recently lps22hb/hh/etc. |
aabadie
added
Type: question
The issue poses a question regarding usage of RIOT
Area: drivers
Area: Device drivers
labels
Jan 7, 2022
maribu
added a commit
to maribu/RIOT
that referenced
this issue
May 17, 2023
This was referenced May 17, 2023
smburdick
pushed a commit
to smburdick/RIOT
that referenced
this issue
May 19, 2023
* nanocoap_sock: remove nanocoap_get() The function has been deprecated in favor of nanocoap_sock_get() * cpu/stm32/periph_dac: support for RCC_APB1ENR1_DAC1EN * cpu/stm32/periph_dac: support for internal V_REF+ For boards that have not connected the V_REF+ pin to an external reference voltage, the VREFBUF peripheral can be used as V_REF+ if supported by setting `VREFBUF_ENABLE=1`. * cpu/stm32/periph_dac: support of DAC mode register If the DAC peripheral has a mode register (DAC_MCR), it is set to normal mode with buffer enabled and connected to external pin and on-chip peripherals. This allows to measure the current value of a DAC channel or to use the DAC channel also for other on-chip peripherals. * cpu/stm32/periph_adc: support STM32L496AG * cpu/stm32/periph_adc: determine number of ADC from CMSIS header Instead of defining the number of ADC devices for each MCU model, the number of ADC devices is determined from ADCx definitions in CMSIS header. * cpu/stm32/periph_adc: defines are valid for all L4 MCUs * cpu/stm32/periph_adc: fix ADC clock disable for L4 The ADC clock disable is fixed using a counter. The counter is incremented in `prep` and decremented in `done`. The ADC clock is disabled if the counter becomes 0. * cpu/stm32/periph_adc: support for internal V_REF+ For boards that have not connected the V_REF+ pin to an external reference voltage, the VREFBUF peripheral can be used as V_REF+ if supported by setting `VREFBUF_ENABLE=1`. * cpu/stm32/periph_adc: use L4 lines instead of L4 models The ASCR register is available and has to be set for all STM32L471xx, STM32L475xx, STM32L476xx, STM32L485xx and STM32L486xx MCUs. Instead of using the CPU model for conditional compilation, the CPU line is used to support all MCU of that lines. * cpu/stm32/periph_adc: fix SQR1 setting for L4 The setting of SQR1 is fixed. Setting the SQR1 did only work before because the ADC_SRQ_L is set to 0 for a sequence length of 1. * doc/doxygen/src/flashing.md: work around Doxygen bug Doxygen fails to render inline code in headers correctly in the version the CI uses. So, work around the issue by not typestetting `stm32flash` as inline code but as regular text. * updates * compiles, but not linking due to missing kyber references * makefiles/app_dirs.inc.mk: add tests/cpu subdirectory * tests: move cpu related applications to tests/cpu * tests/build_system/external_board_dirs: fix broken symlink * tests: move nimble_* tests to tests/pkg * tests: move lwip* tests to tests/pkg * doc: Remove ANSI * tests/sys: move missing sys related tests * tests/candev: move to tests/drivers * makefiles/app_dirs.inc.mk: add tests/net subdirectory * tests: move net related applications to tests/net * tests/net/gnrc_rpl: fix path to zep_dispatch * tests/drivers/nrf802154: build for nrf52840dk by default There's no sense in having nrf52dk by default since its MCU, nrf52832, doesn't have support for 802.15.4 radio * tests/drivers: fix broken symlinks and paths * tests/net/gcoap_fileserver: fix path to zep_dispatch * tests/net/gnrc_sixlowpan_frag_sfr_congure_impl: fix path to zep_dispatch * update project structure * tests/sys/usbus_cdc_ecm: fix wrong path in make command * tests/README.md: Add directory overview * treewide: fix path to shell related tests in doc * sys/test_utils: fix path to rmutex test in doc * treewide: fix path to external_board_dirs test in doc * .murdock: fix path to test applications * CODEOWNERS: fix path to test applications * compile_like_murdock.py: fix path to test applications * treewide: fix path to ztimer test applications * doc: fix path to build system related test applications * pkg: fix remaining broken paths to tests * sys: fix remaining broken paths to tests * tests: fix remaining broken paths to tests * drivers/pcf857x: fix path to saul test application * bootloaders/riotboot: fix path to cortexm ldscript test * boards/b-u585i-iot02a: fix path to malloc test in doc * cpu/stm32: cpu/sam0_common: rename internal i2c _start function * pkg: add support for CMSIS via a package * cpu/cortexm_common: use cmsis package instead of internal vendor headers * tests/pkg_cmsis-dsp: adapt to use new common cmsis package * tests/pkg_cmsis-nn: adapt to use new common cmsis package * cpu/cortexm_common: remove CMSIS vendor code * pkg/cmsis-dsp: drop package * pkg/cmsis-nn: drop package * tests/pkg_cmsis-*: extend whitelisted boards * cpu/efm32: add CMSIS DSP include for arm_math.h * tests/driver_lpd8808: tests/driver_apa102: rename STEP constant * tests/float: rename STEP constant * cpu/efm32: fix dependency to cmsis-dsp module * pkg/gecko_sdk: disable cast-align globally * gnrc/gnrc_netif_hdr_print: printout timestamp if enabled Signed-off-by: chudov <chudov@gmail.com> * cpu/stm32/periph_adc: fix CKMODE setting for L4 Setting the `ADC_CCR_CKMODE` did only work for the reset state. It is now cleared before it is set. Instead of using the `ADC_CCR_CKMODE_x` bits to set the mode, the mode defines are used. * cpu/stm32/periph_adc: support V_REFINT as ADC channel on L4 * boards/msb-430: add documentation * sys: drop broken and legacy Mac OS handling This drops special handling for Mac OS (X) `native`, which is not supported anymore anyway and causing issues when building for non-`native` targets on Mac OS. * dist/tools/insufficient_memory: handle address space wraps When a region wraps around the address space, the application typically is way too large to fit into the 16 bit address space of 16 bit or 8 bit platforms. Hence, classify this as "too big" in the tools. * cpu/msp430fxyz: clean up clock initialization Provide a common clock initialization driver rather than leaving clock initialization to the boards code. A declarative description of the board's clock configuration using a struct does still allow to fine-tune settings. In addition, a board is still allowed to just provide a custom `void clock_init(void)` if there really is the need to do crazy things. * sys/shell: Add coreclk command to shell_cmd_sys The coreclk shell command now prints the CPU frequency in Hz, which can be useful for boards with RC generated CPU frequency (e.g. RP2040, FE310, or MPS430Fx1xx MCUs allow this) which may quite a bit off the target frequency. * dist/tools/insufficient_memory: fix collection of app folders There is actually a make target to list the applications in the repo. Let's just use that. * boards/olimex-msp430-h1611: new board * more importing of code, switching to dynamic linking for now * build-system: Allow out of tree BUILD_DIR - Replace all users of `$(RIOTBASE)/build` with the already present `$(BUILD_DIR)` variable - Replace all users of `$(BUILD_DIR)/pkg` with the already present `$(PKGDIRBASE)` variable - Create a `CACHEDIR.TAG` file in the `$(BUILD_DIR)` * examples/wasm/wasm_sample: revert prebuild WASM Running `make` in the wasm example modifies the `hello_prebuild.wasm` example, making it easy to sneak in unwanted changes. This reverts such an instance and modifies the Makefile to only recreate/update `hello_prebuild.wasm` with: make hello_prebuild.wasm * doc/mainpage: point to supported board on main website The wiki page is fairly outdated * doc/mainpage: fix punctuation * tests/sys/shell_coreclk: add test application for shell_cmd_coreclk * boards/adafruit-clue: use shared usb_board_reset.mk for flashing * make/usb_board_reset: define {preflash,term}-delay when necessary * drivers/lpsxxx: avoid float arithmetics Fixes RIOT-OS#17486 * drivers/at86rf2xx: rx timestamp generation for ATmegaRFR2 Signed-off-by: chudov <chudov@gmail.com> * pkg/tensorflow-lite: remove deprecated package Use tflite-micro instead * sys/hashes: remove deprecated ase cmac hashing * deleting kyber --------- Signed-off-by: chudov <chudov@gmail.com> Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com> Co-authored-by: Gunar Schorcht <gunar@schorcht.net> Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr> Co-authored-by: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Co-authored-by: Koen Zandberg <koen@bergzand.net> Co-authored-by: chudov <chudov@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: drivers
Area: Device drivers
Type: question
The issue poses a question regarding usage of RIOT
What is the need for using floats in lpsxxx driver? Currently, we have TEMP_BASE defined as
#define TEMP_BASE (42.5f)
#define TEMP_DIVIDER (480U)
and the calculation using it as follows (temp and val are int16_t):
Basically all the same calculations can be done without floats, just like this in a previous version of the driver:
Also, as many of RIOT's target platforms do not have an FPU, the driver design guide recommends to avoid using floats: https://doc.riot-os.org/driver-guide.html . It definitely seems unnecessary here.
Another strange "optimization" in this driver was replacing division in pressure reading with bit shift. Any decent optimizing compiler would replace division by a power of two by a shift, but the macros and code specifying an implicit division are often considered more readable.
The text was updated successfully, but these errors were encountered: