Skip to content
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

Microseconds, Readme, Examples, several Fixes #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

tkuschel
Copy link

BME280_driver 3.5.0

I have found some bugs mainly in the description README.md file and want to describe each of them here:
First, I have tested the code and implemented my code with the following devices:

  • STM32WL55 nucleo board connected with I2C bus, a LoRaWAN thing, which I could share as FOSS when it is released with a new hardware.
  • Beagle Board Black with Debian 10.7 and connected to i2c-1 (/dev/i2c-1) and i2c-2 too.
    I have tested the library with defined BME280_FLOAT_ENABLE, also tested with BME280_64BIT_ENABLE and BME280_32BIT_ENABLE.

Very obviously the description on README.md is no longer up to date, also the inclusion of the write and read functions for the respective bus is faulty.
1.1 The user_delay_ms should be user_delay_us in microseconds due to the new delay function.
1.2 The default implementation of the compensation function is double precision floating point, i.e. BME280_FLOAT_ENABLE is set (former BME280_64BIT_ENABLE).
1.3 The function user_spi_write() and the function user_spi_read() has a parameter which is of type const uint8_t *reg_data (former it was only type of uint8_t *reg_data).

bme280c
The function bme280_cal_meas_delay() should deliver also a value in us (microseconds) instead of ms (milliseconds), that makes it more easier and overall consistent.
2.1 The change of the user function user_delay_ms to user_delay_us() which gets a period amount of wait in microseconds. So the function bme280_cal_meas_delay() becomes smaller, we get rid off the division through 1000 (constant BME280_MEAS_SCALING_FACTOR).
2.2 I deleted this constant BME280_MEAS_SCALING_FACTOR in the bme280_defs.h file.
As a positive side effect, the two examples (linux_userspace.c and bsd_userspace.c) do not need to be adjusted with microseconds either.

  1. Example linux_userspace.c
    3.1 I had trouble to compile this example on another machine, like the beagle bone black board. I updated the code, which needs the ioctl procedure, unfortunately I do not own a Raspbi.
    3.2 In the code, the id.dev_addr selection must be before and not after the call of the line ioctl() which already uses the device address (0x76 or 0x77) - former it was not defined, so I struggled with the distributed code.
    3.3 Added an error handling for malloc function, which IMHO is necessary. Added error handling for read and write functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant