Skip to content

Add support for related sensors (BMA42x) #7

@thecodechemist99

Description

@thecodechemist99

Goal

I’m working on a PineTime project and would like to add support for the BMA421 (I just realized my PineTime still has the older sensor) and maybe also BMA425 sensors (to be able to support newer models, too) to this driver.

Implementation

General

The configuration files for both sensors are available, e.g. from this project.

BMA425

I went through the BMA425 datasheet pretty thoroughly and the relevant parts seem to be identical on first glance.
The only difference I found so far to the driver (though the datasheet is identical to the BMA423’s in this regard?) is the AccelConfigBandwidth enum. The datasheet specifies the values as 0x00, 0x01, 0x02 and so on, while the driver sets them to 0x00, 0x10, 0x20 and so on.

BMA421

Unfortunately, I couldn’t find a publicly available full datasheet for this sensor, only a two-page overview. But a first test with the config file linked above and the different chip id (0x11) added to ChipId worked fine at least for initializing the sensor.

Integration with the existing driver

I think we should discuss the best way to integrate the additional hardware into the driver. These are my suggestions, feel free to comment on them and make different suggestions if you think they would work better. Also, please add anything you deem relevant that I might have overlooked.

Config Files

The additional config files can just be added to config.rs aside the existing one.

Feature Flags

I would add feature flags for the different models. These could be used to determine which config file to read, and for other possibly necessary, model-depending changes.
The bma423 flag can be set as a default.

Chip ID

The chip id for the BMA421 can just be added to the ChipId struct as an additional entry. The BMA423 and BMA425 apparently have the same id.

Restrictions

Right now I can only test the BMA421 implementation on hardware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions