BMI323. Config
(bmi323 v0.1.0)
Copy Markdown
Encoding and decoding of the BMI323 ACC_CONF (0x20) and GYR_CONF (0x21)
configuration words.
Both registers share the same bit layout:
|15|14 13 12| 11 |10 9 8| 7 | 6 5 4 | 3 2 1 0|
|re| mode | re | avg | bw | range | odr |Encoders return a 2-byte little-endian binary suitable for
BMI323.Registers.write_acc_conf/2 and BMI323.Registers.write_gyr_conf/2.
Invalid inputs raise ArgumentError.
Summary
Types
Accelerometer measurement range in g.
Number of samples averaged per output sample (low-power mode only).
Low-pass filter cut-off relative to the configured ODR. Has no effect in low-power mode or when the synchronous timing control mode of I3C is enabled.
Gyroscope measurement range in °/s.
Output data rate in Hz. Valid values: 0.78125, 1.5625, 3.125, 6.25, 12.5,
25, 50, 100, 200, 400, 800, 1600, 3200, 6400. Sub-12.5 Hz rates are valid
only in :low_power mode; rates ≥ 800 Hz require :high_performance mode.
Sensor power mode.
Functions
Decode an ACC_CONF binary into a map of its fields.
Decode a GYR_CONF binary into a map of its fields.
Encode an ACC_CONF value from keyword options.
Encode a GYR_CONF value from keyword options.
Types
@type accelerometer_range() :: 2 | 4 | 8 | 16
Accelerometer measurement range in g.
@type averaging() :: 1 | 2 | 4 | 8 | 16 | 32 | 64
Number of samples averaged per output sample (low-power mode only).
@type bandwidth() :: :odr_div_2 | :odr_div_4
Low-pass filter cut-off relative to the configured ODR. Has no effect in low-power mode or when the synchronous timing control mode of I3C is enabled.
@type gyroscope_range() :: 125 | 250 | 500 | 1000 | 2000
Gyroscope measurement range in °/s.
@type odr() :: number()
Output data rate in Hz. Valid values: 0.78125, 1.5625, 3.125, 6.25, 12.5,
25, 50, 100, 200, 400, 800, 1600, 3200, 6400. Sub-12.5 Hz rates are valid
only in :low_power mode; rates ≥ 800 Hz require :high_performance mode.
@type power_mode() :: :disabled | :low_power | :normal | :high_performance
Sensor power mode.
:disabled— sensor off (data registers and FIFO frames are invalid).:low_power— duty-cycled operation with on-chip averaging. ODR ≤ 400 Hz.:normal— continuous low-power operation. 12.5 Hz ≤ ODR ≤ 6400 Hz.:high_performance— continuous full-performance operation.
Functions
@spec decode_acc_conf(<<_::16>>) :: %{ mode: power_mode(), averaging: averaging(), bandwidth: bandwidth(), range: accelerometer_range(), odr: odr() }
Decode an ACC_CONF binary into a map of its fields.
@spec decode_gyr_conf(<<_::16>>) :: %{ mode: power_mode(), averaging: averaging(), bandwidth: bandwidth(), range: gyroscope_range(), odr: odr() }
Decode a GYR_CONF binary into a map of its fields.
@spec encode_acc_conf(keyword()) :: <<_::16>>
Encode an ACC_CONF value from keyword options.
Options
:mode—power_mode/0(required).:odr—odr/0(required).:range—accelerometer_range/0(default8).:bandwidth—bandwidth/0(default:odr_div_2).:averaging—averaging/0(default1).
@spec encode_gyr_conf(keyword()) :: <<_::16>>
Encode a GYR_CONF value from keyword options.
Options
:mode—power_mode/0(required).:odr—odr/0(required).:range—gyroscope_range/0(default2000).:bandwidth—bandwidth/0(default:odr_div_2).:averaging—averaging/0(default1).