Skip to content

Update BME68x driver to target U0#33

Merged
nkanderson merged 16 commits intomainfrom
bme68x_targetu0
May 20, 2025
Merged

Update BME68x driver to target U0#33
nkanderson merged 16 commits intomainfrom
bme68x_targetu0

Conversation

@nkanderson
Copy link
Collaborator

The initial goal with this PR was going to be to incorporate only the fixes for the BME68x driver that @anthlee396 and @PlayerZ3R0 made related to the humidity and gas resistance values. As I started working through it though, it seemed to make more sense to move forward with the existing work to remove non-U0 targets rather than simply use the multi-target approach still in place on the main branch. As a result, this PR incorporates work from #31 and #32.

The first set of commits from @reecewayt are entirely from #31, so if any reviewers of this PR have already reviewed that one, you can skip or skim over those commits. The remaining commits are largely a collection of small changes to update the BME68x driver to target the U0 and incorporate the fixes mentioned above. This includes small cmake config changes from #32. Commit 41f7a14 is the largest, and comes directly from the changes to the CubeMX-generated code from #32.

It may be easiest to review the BME68x-specific changes commit-by-commit, as they are small and have descriptive commit messages, so they should be pretty self-explanatory. I'm happy to walk through this though with anyone who would like a real-time review.

reecewayt and others added 16 commits April 9, 2025 17:26
Not sure how this got added, but we have *.cmake in .gitignore since these files have environment-specific config.
The driver includes the HAL for the target stm32 family instead of using i2c.h from the application, so that it can remain independent from the application code. This allows for reconfiguration of the application, or consolidation of application files without impacting driver code.
Includes the define for the driver to not include floating point code. This may be the preferred approach over having the define in the driver cmake config, in which case, that define should be removed and docs should be updated.
Also updates existing read function to be a direct I2C read option
Uses new code for the write function while maintaining the previous write function as an option for direct writes to a sensor register.
Moves the define to disable floating point from the driver cmake config to the application level. This is a more appropriate location, since the application should decide whether or not it is using floating point.
@nkanderson nkanderson changed the title Bme68x targetu0 Update BME68x driver to target U0 May 11, 2025
* @param[in] i2c_handle Pointer to the stm32 I2C peripheral handle
* @return 0 if successful, non-zero otherwise
*/
int8_t bme_read_direct(uint8_t reg_addr, uint8_t *reg_data, uint32_t length, void *intf_ptr);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case this wasn't totally clear from the comments, these "direct" variant read and write functions follow the I2C transaction descriptions from the datasheet, so they may be useful for I2C interactions with the sensor that do not go through the Bosch-provided code and the bme device struct. As Nitin and Anthony discovered though, there are certain cases where they conflict with the implementation in bme68x.c, so they should not be used as the read and write function pointers on the bme device struct.

Copy link

@thisisnotanELF thisisnotanELF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks!

@nkanderson nkanderson merged commit 5c25b5e into main May 20, 2025
@nkanderson nkanderson deleted the bme68x_targetu0 branch May 20, 2025 15:21
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.

3 participants