Synopsis
CTL_STATUS_t ctl_accelerometer_set_range(CTL_ACCELEROMETER_t *self,
                                         int range);
Description

ctl_accelerometer_set_range sets the range of the accelerometer self to operate between plus and minus range g. The accelerometer selects the range which is closest to range, but may exceed it if range g is not a setting offered by the accelerometer.

After successfully executing ctl_accelerometer_set_range, the range, gain, and bias members are updated to reflect the new setting. Note that these members are typical and are uncalibrated. You may wish to run a calibration after setting the range to reflect the particular gain and bias coefficients for your sensor.

Return Value

ctl_accelerometer_set_range returns a standard status code.

Thread Safety

ctl_accelerometer_set_range is thread-safe if the method set_range is thread-safe. Typically, for SPI and I2C transports, you ensure thread safety by associating a mutex with the bus used by the transport.