Difference: BMA423Driver (1 vs. 4)

Revision 42021-01-28 - UliRaich

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

The driver for BMA423 Triaxial Acceleration Sensor

Changed:
<
<
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.
>
>
The MicroPython layer in bma423 from https://github.com/OPHoperHPO/lilygo-ttgo-twatch-2020-micropython was not working because it uses deprecated calls to I2C in MicroPython.
 
Changed:
<
<
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.
>
>
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
Line: 12 to 12
  Daniel also supplies a few example programs, which are essentially ports of the Bosch examples ported from C to MicroPython
Changed:
<
<
The BMA42X driver uses the
>
>
The BMA42X driver provides the following methods:
 
  • BMA42X(i2c): create a BMA42X object. The i2c parameter must be a initialized SoftI2C object
  • debug(on_off): switch debugging on / off
Changed:
<
<
  • feature_enable
  • get_offset_comp
  • get_temperature(unit): unit may be
>
>
  • feature_enable(feature,on_off): feature: the feature to be enabled or disabled, on_off to switch the feature on or off. The features are listed below.
  • get_offset_comp(): Gets the status of the accel offset compensation
  • get_temperature(unit): gets the temperature in the requested units. Possible units: see below
 
  • init (called when the object is created)
Changed:
<
<
  • map_interrupt
  • read_accel_xyz
  • read_int_status
  • set accel_config
  • reset_step_counter
  • set accel_enable
  • set_any_mot_config
  • set_no_mot_config
  • set_command_reg
  • set_offset_comp
  • step_detector_enable
  • step_counter_output
  • step_counter_set_watermark
  • write_config_file
>
>
  • map_interrupt(int_line, interrupt_types): Map the interrupt to either pin1 or pin2
  • read_accel_xyz(): read the accel data for x,y,z from the sensor. The data are returned as a tuple (x,y,z)
  • read_int_status(): reads the hardware interrupt status from the sensor
  • set accel_config(accel_config): set the acceleration sensor config. See the accelerometer.py example in order to understand how to do this.
  • reset_step_counter(): reset the step counter
  • set accel_enable(on_off): enables or disables the accel in the sensor
  • set_any_mot_config(any_mot_config): set the configuration for any motion interrupts. See example motion_interrupt.py in order to understand how to do this.
  • set_no_mot_config(no_mot_config): set the configuration for no motion interrupts. See example motion_interrupt.py in order to understand how to do this.
  • set_command_reg(value): set the command register
    • 0xb6: triggers a soft reset
    • 0xb0: clears all data in the FiFo
    • 0xf0: resets the acceleration data path
  • set_offset_comp(on_off): enables the offset compensation for filtered and unfiltered accel data
  • step_detector_enable(on_off): enables or disables the step detector feature in the sensor
  • step_counter_output(): gets the number of counted steps of the step counter feature from the sensor
  • step_counter_set_watermark(value): sets the watermark level for step counter interrupt in the sensor
  • write_config_file(): write the binary configuration data to the sensor
 The driver also defines the following constants:

The registers:

Line: 55 to 58
 
  • DEG
  • FAHREN
  • KELVIN
Added:
>
>
Features
 
  • STEP_CNTR
  • STEP_ACT
Added:
>
>
  • WRIST_WEAR
 
  • SINGLE_TAP
Changed:
<
<
  • (DOUBLE_TAP
>
>
  • DOUBLE_TAP
 
Added:
>
>
Interrupts
 
  • INTR1_MAP
  • INTR2_MAP
  • STEP_CNTR_INT
  • ANY_MOT_INT
  • NO_MOT_INT
Changed:
<
<
Constants to enable axis
>
>
Enable axis
 
  • DIS_ALL_AXIS
  • X_AXIS_EN
  • Y_AXIS_EN

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

Revision 22021-01-27 - UliRaich

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

The driver for BMA423 Triaxial Acceleration Sensor

Added:
>
>
I use the bma423 API from Bosch with Daniel Thomson's upy interface:

https://github.com/daniel-thompson/bma42x-upy

The BMA42x driver uses the

  • debug(on_off): switch debugging on / off
  • feature_enable
  • get_offset_comp
  • get_temperature
  • init (called when the object is created)
  • map_interrupt
  • read_accel_xyz
  • read_int_status
  • set accel_config
  • reset_step_counter
  • set accel_enable
  • set_any_mot_config
  • set_no_mot_config
  • set_command_reg
  • set_offset_comp
  • step_detector_enable
  • step_counter_output
  • step_counter_set_watermark
  • write_config_file
 -- Uli Raich - 2021-01-27

Comments

Revision 12021-01-27 - UliRaich

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

The driver for BMA423 Triaxial Acceleration Sensor

-- Uli Raich - 2021-01-27

Comments

<--/commentPlugin-->
 
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