---+ The driver for BMA423 Triaxial Acceleration Sensor I found that !MicroPython layer in bma423 from [[https://github.com/OPHoperHPO/lilygo-ttgo-twatch-2020-micropython][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 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 "<i>bma421"</i> in bma42x.c by "<i>bma423". </i>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 * get_temperature(unit): unit may be * 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 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 -- %USERSIG{UliRaich - 2021-01-27}% ---++ Comments %COMMENT%
This topic: IoT_Course_English
>
WebHome
>
TheT-watch2020Hardware
>
BMA423Driver
Topic revision: r3 - 2021-01-27 - UliRaich
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback