Difference: BMA423Driver (2 vs. 3)

Revision 32021-01-27 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="TheT-watch2020Hardware"

The driver for BMA423 Triaxial Acceleration Sensor

Changed:
<
<
I use the bma423 API from Bosch with Daniel Thomson's upy interface:
>
>
I found that MicroPython layer in bma423 from https://github.com/OPHoperHPO/lilygo-ttgo-twatch-2020-micropython because it uses deprecated calls to I2C in MicroPython.

However, I found that Daniel Thomson has also written a MicroPython interface to the BMA423 API from Bosch SensorTec, which was easier to adapt to the t-watch.

  https://github.com/daniel-thompson/bma42x-upy
Changed:
<
<
The BMA42x driver uses the
>
>
I had to make only a few modifications: Daniel uses a BMA421 while the t-watch uses a BMA423. I therefore had to replace all occurrences of "bma421" in bma42x.c by "bma423". In addition the t-watch uses the secondary I2C address 0x19 for the chip (the primary address is 0x18) and I therefore had to replace ic2_addr in the device descriptor to BMA4_I2C_ADDR_SECONDARY.

Daniel also supplies a few example programs, which are essentially ports of the Bosch examples ported from C to MicroPython

The BMA42X driver uses the

  • BMA42X(i2c): create a BMA42X object. The i2c parameter must be a initialized SoftI2C object
 
  • debug(on_off): switch debugging on / off
  • feature_enable
  • get_offset_comp
Changed:
<
<
  • get_temperature
>
>
  • get_temperature(unit): unit may be
 
  • init (called when the object is created)
  • map_interrupt
  • read_accel_xyz
Line: 26 to 33
 
  • step_counter_output
  • step_counter_set_watermark
  • write_config_file
Added:
>
>
The driver also defines the following constants:

The registers:

  • ACCEL_CONFIG_ADDR
  • POWER_CONF_ADDR
  • POWER_CTRL_ADDR
  • NV_CONFIG_ADDR
Configuration values:
  • ACCEL_RANGE_2G
  • ACCEL_RANGE_4G
  • ACCEL_RANGE_8G
  • ACCEL_RANGE_16G
  • ACCEL_NORMAL_AVG4
  • (OUTPUT_DATA_RATE_50HZ
  • OUTPUT_DATA_RATE_100HZ
  • CIC_AVG_MODE
  • CONTINUOUS_MODE
Temperature parameters:
  • SCALE_TEMP
  • DEG
  • FAHREN
  • KELVIN
  • STEP_CNTR
  • STEP_ACT
  • SINGLE_TAP
  • (DOUBLE_TAP

  • INTR1_MAP
  • INTR2_MAP
  • STEP_CNTR_INT
  • ANY_MOT_INT
  • NO_MOT_INT
Constants to enable axis
  • DIS_ALL_AXIS
  • X_AXIS_EN
  • Y_AXIS_EN
  • Z_AXIS_EN
  • EN_ALL_AXIS
  -- Uli Raich - 2021-01-27
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback