![]() |
Qwiic_MMC5983MA_Py
2.0.0
Python for SFE Qwiic MMC5983MA
|
Classes | |
class | MemoryShadow |
Public Member Functions | |
def | __init__ (self, address=None, i2c_driver=None) |
Constructor. More... | |
def | is_connected (self) |
Determines if this device is connected. More... | |
def | begin (self) |
Initializes this device with default parameters. More... | |
def | is_bit_set (self, register_address, bit_mask) |
Checks if a bit is set in a register. More... | |
def | set_register_bit (self, register_address, bit_mask) |
Sets a bit in a register. More... | |
def | set_shadow_bit (self, register_address, bit_mask, do_write=True) |
Sets a bit in the shadow register and optionally writes the value to the device. More... | |
def | clear_shadow_bit (self, register_address, bit_mask, do_write=True) |
Clears a bit in the shadow register and optionally writes the value to the device. More... | |
def | is_shadow_bit_set (self, register_address, bit_mask) |
Checks if a bit is set in the shadow register. More... | |
def | get_temperature (self) |
Gets the temperature in degrees Celsius. More... | |
def | soft_reset (self) |
Performs a software reset. More... | |
def | enable_interrupt (self) |
Enables interrupts. More... | |
def | disable_interrupt (self) |
Disables interrupts. More... | |
def | is_interrupt_enabled (self) |
Checks if interrupts are enabled. More... | |
def | enable_3_wire_spi (self) |
Enables 3-wire SPI. More... | |
def | disable_3_wire_spi (self) |
Disables 3-wire SPI. More... | |
def | is_3_wire_spi_enabled (self) |
Checks if 3-wire SPI is enabled. More... | |
def | perform_set_operation (self) |
Performs a SET operation. More... | |
def | perform_reset_operation (self) |
Performs a RESET operation. More... | |
def | enable_automatic_set_reset (self) |
Enables automatic SET/RESET operations, which needs to be done in conjuction with enable_periodic_set() and set_periodic_set_samples() More... | |
def | disable_automatic_set_reset (self) |
Disables automatic SET/RESET operations. More... | |
def | is_automatic_set_reset_enabled (self) |
Checks if automatic SET/RESET operations are enabled. More... | |
def | enable_x_channel (self) |
Enables the X channel. More... | |
def | disable_x_channel (self) |
Disables the X channel. More... | |
def | is_x_channel_enabled (self) |
Checks if the X channel is enabled. More... | |
def | enable_yz_channels (self) |
Enables the Y and Z channels. More... | |
def | disable_yz_channels (self) |
Disables the Y and Z channels. More... | |
def | are_yz_channels_enabled (self) |
Checks if the Y and Z channels are enabled. More... | |
def | set_filter_bandwidth (self, bandwidth) |
Sets the filter bandwidth. More... | |
def | get_filter_bandwidth (self) |
Gets the filter bandwidth. More... | |
def | enable_continuous_mode (self) |
Enables continuous mode. More... | |
def | disable_continuous_mode (self) |
Disables continuous mode. More... | |
def | is_continuous_mode_enabled (self) |
Checks if continuous mode is enabled. More... | |
def | set_continuous_mode_frequency (self, frequency) |
Sets the continuous mode frequency. More... | |
def | get_continuous_mode_frequency (self) |
Gets the continuous mode frequency. More... | |
def | enable_periodic_set (self) |
Enables periodic SET operations, which needs to be done in conjuction with enable_automatic_set_reset() and set_periodic_set_samples() More... | |
def | disable_periodic_set (self) |
Disables periodic SET operations. More... | |
def | is_periodic_set_enabled (self) |
Checks if periodic SET operations are enabled. More... | |
def | set_periodic_set_samples (self, number_of_samples) |
Sets the number of samples between each SET operation when periodic SET operations are enabled. More... | |
def | get_periodic_set_samples (self) |
Gets the number of samples between each SET operation when periodic SET operations are enabled. More... | |
def | apply_extra_current_pos_to_neg (self) |
Applies extra current "forward" through the coils to change the magnetic field strength. More... | |
def | remove_extra_current_pos_to_neg (self) |
Removes extra current "forward" through the coils. More... | |
def | is_extra_current_applied_pos_to_neg (self) |
Checks if extra current is applied "forward" through the coils. More... | |
def | apply_extra_current_neg_to_pos (self) |
Applies extra current "reverse" through the coils to change the magnetic field strength. More... | |
def | remove_extra_current_neg_to_pos (self) |
Removes extra current "reverse" through the coils. More... | |
def | is_extra_current_applied_neg_to_pos (self) |
Checks if extra current is applied "reverse" through the coils. More... | |
def | clear_meas_done_interrupt (self, meas_mask=MEAS_T_DONE|MEAS_M_DONE) |
Clears the measurement done interrupt. More... | |
def | get_measurement_x (self) |
Gets the raw x-axis measurement. More... | |
def | get_measurement_y (self) |
Gets the raw y-axis measurement. More... | |
def | get_measurement_z (self) |
Gets the raw z-axis measurement. More... | |
def | get_measurement_xyz (self) |
Gets the raw x, y, and z-axis measurements. More... | |
def | read_fields_xyz (self) |
Internal function to get the raw x, y, and z-axis measurements, should not be called directly. More... | |
def | calibrate_offsets (self) |
Calibrates the offsets for all axes. More... | |
def | get_offsets (self) |
Gets the raw offsets for all axes. More... | |
def | get_measurement_x_gauss (self, offset=None, gain=8) |
Gets the x-axis measurement in gauss. More... | |
def | get_measurement_y_gauss (self, offset=None, gain=8) |
Gets the y-axis measurement in gauss. More... | |
def | get_measurement_z_gauss (self, offset=None, gain=8) |
Gets the z-axis measurement in gauss. More... | |
def | get_measurement_xyz_gauss (self, offsets=None, gains=[8] *3) |
Gets the x, y, and z-axis measurements in gauss. More... | |
Public Attributes | |
address | |
x_offset | |
y_offset | |
z_offset | |
memory_shadow | |
Static Public Attributes | |
device_name = _DEFAULT_NAME | |
available_addresses = _AVAILABLE_I2C_ADDRESS | |
int | X_OUT_0_REG = 0x0 |
int | X_OUT_1_REG = 0x01 |
int | Y_OUT_0_REG = 0x02 |
int | Y_OUT_1_REG = 0x03 |
int | Z_OUT_0_REG = 0x04 |
int | Z_OUT_1_REG = 0x05 |
int | XYZ_OUT_2_REG = 0x06 |
int | T_OUT_REG = 0x07 |
int | STATUS_REG = 0x08 |
int | INT_CTRL_0_REG = 0x09 |
int | INT_CTRL_1_REG = 0x0a |
int | INT_CTRL_2_REG = 0x0b |
int | INT_CTRL_3_REG = 0x0c |
int | PROD_ID_REG = 0x2f |
int | DUMMY = 0x0 |
int | I2C_ADDR = 0x30 |
int | PROD_ID = 0x30 |
tuple | MEAS_M_DONE = (1 << 0) |
tuple | MEAS_T_DONE = (1 << 1) |
tuple | OTP_READ_DONE = (1 << 4) |
tuple | TM_M = (1 << 0) |
tuple | TM_T = (1 << 1) |
tuple | INT_MEAS_DONE_EN = (1 << 2) |
tuple | SET_OPERATION = (1 << 3) |
tuple | RESET_OPERATION = (1 << 4) |
tuple | AUTO_SR_EN = (1 << 5) |
tuple | OTP_READ = (1 << 6) |
tuple | BW0 = (1 << 0) |
tuple | BW1 = (1 << 1) |
tuple | X_INHIBIT = (1 << 2) |
tuple | YZ_INHIBIT = (3 << 3) |
tuple | SW_RST = (1 << 7) |
tuple | CM_FREQ_0 = (1 << 0) |
tuple | CM_FREQ_1 = (1 << 1) |
tuple | CM_FREQ_2 = (1 << 2) |
tuple | CMM_EN = (1 << 3) |
tuple | PRD_SET_0 = (1 << 4) |
tuple | PRD_SET_1 = (1 << 5) |
tuple | PRD_SET_2 = (1 << 6) |
tuple | EN_PRD_SET = (1 << 7) |
tuple | ST_ENP = (1 << 1) |
tuple | ST_ENM = (1 << 2) |
tuple | SPI_3W = (1 << 6) |
tuple | X2_MASK = (3 << 6) |
tuple | Y2_MASK = (3 << 4) |
tuple | Z2_MASK = (3 << 2) |
int | XYZ_0_SHIFT = 10 |
int | XYZ_1_SHIFT = 2 |
Properties | |
connected = property(is_connected) | |
def qwiic_mmc5983ma.QwiicMMC5983MA.__init__ | ( | self, | |
address = None , |
|||
i2c_driver = None |
|||
) |
Constructor.
int,optional | address: The I2C address to use for the device If not provided, the default address is used |
I2CDriver,optional | i2c_driver: An existing i2c driver object If not provided, a driver object is created |
def qwiic_mmc5983ma.QwiicMMC5983MA.apply_extra_current_neg_to_pos | ( | self | ) |
Applies extra current "reverse" through the coils to change the magnetic field strength.
This can be used to check if the sensor has been saturated.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.apply_extra_current_pos_to_neg | ( | self | ) |
Applies extra current "forward" through the coils to change the magnetic field strength.
This can be used to check if the sensor has been saturated.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.are_yz_channels_enabled | ( | self | ) |
Checks if the Y and Z channels are enabled.
True
if enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.begin | ( | self | ) |
Initializes this device with default parameters.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.calibrate_offsets | ( | self | ) |
Calibrates the offsets for all axes.
This will also degauss the sensor if it was previously exposed to a strong magnetic field.
def qwiic_mmc5983ma.QwiicMMC5983MA.clear_meas_done_interrupt | ( | self, | |
meas_mask = MEAS_T_DONE | MEAS_M_DONE |
|||
) |
Clears the measurement done interrupt.
int,optional | meas_mask: Measurement mask, defaults to MEAS_T_DONE | MEAS_M_DONE |
def qwiic_mmc5983ma.QwiicMMC5983MA.clear_shadow_bit | ( | self, | |
register_address, | |||
bit_mask, | |||
do_write = True |
|||
) |
Clears a bit in the shadow register and optionally writes the value to the device.
int | register_address: Register address |
int | bit_mask: Bit mask |
bool,optional | do_write: Whether to write the value to the device, defaults to True |
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_3_wire_spi | ( | self | ) |
Disables 3-wire SPI.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_automatic_set_reset | ( | self | ) |
Disables automatic SET/RESET operations.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_continuous_mode | ( | self | ) |
Disables continuous mode.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_interrupt | ( | self | ) |
Disables interrupts.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_periodic_set | ( | self | ) |
Disables periodic SET operations.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_x_channel | ( | self | ) |
Disables the X channel.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.disable_yz_channels | ( | self | ) |
Disables the Y and Z channels.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_3_wire_spi | ( | self | ) |
Enables 3-wire SPI.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_automatic_set_reset | ( | self | ) |
Enables automatic SET/RESET operations, which needs to be done in conjuction with enable_periodic_set() and set_periodic_set_samples()
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_continuous_mode | ( | self | ) |
Enables continuous mode.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_interrupt | ( | self | ) |
Enables interrupts.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_periodic_set | ( | self | ) |
Enables periodic SET operations, which needs to be done in conjuction with enable_automatic_set_reset() and set_periodic_set_samples()
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_x_channel | ( | self | ) |
Enables the X channel.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.enable_yz_channels | ( | self | ) |
Enables the Y and Z channels.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.get_continuous_mode_frequency | ( | self | ) |
Gets the continuous mode frequency.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_filter_bandwidth | ( | self | ) |
Gets the filter bandwidth.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_x | ( | self | ) |
Gets the raw x-axis measurement.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_x_gauss | ( | self, | |
offset = None , |
|||
gain = 8 |
|||
) |
Gets the x-axis measurement in gauss.
int,optional | offset: Offset to apply to the measurement, defaults to None, which will instead use stored offset |
float,optional | gain: Gain to apply to the measurement, defaults to 8 (full scale range of the MMC5983MA) |
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_xyz | ( | self | ) |
Gets the raw x, y, and z-axis measurements.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_xyz_gauss | ( | self, | |
offsets = None , |
|||
gains = [8] * 3 |
|||
) |
Gets the x, y, and z-axis measurements in gauss.
tuple(int,int,int),optional | offsets: Offsets to apply to the measurements, defaults to None, which will instead use stored offsets |
list(float),optional | gains: Gains to apply to the measurements, defaults to 8 (full scale range of the MMC5983MA) |
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_y | ( | self | ) |
Gets the raw y-axis measurement.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_y_gauss | ( | self, | |
offset = None , |
|||
gain = 8 |
|||
) |
Gets the y-axis measurement in gauss.
int,optional | offset: Offset to apply to the measurement, defaults to None, which will instead use stored offset |
float,optional | gain: Gain to apply to the measurement, defaults to 8 (full scale range of the MMC5983MA) |
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_z | ( | self | ) |
Gets the raw z-axis measurement.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_measurement_z_gauss | ( | self, | |
offset = None , |
|||
gain = 8 |
|||
) |
Gets the z-axis measurement in gauss.
int,optional | offset: Offset to apply to the measurement, defaults to None, which will instead use stored offset |
float,optional | gain: Gain to apply to the measurement, defaults to 8 (full scale range of the MMC5983MA) |
def qwiic_mmc5983ma.QwiicMMC5983MA.get_offsets | ( | self | ) |
Gets the raw offsets for all axes.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_periodic_set_samples | ( | self | ) |
Gets the number of samples between each SET operation when periodic SET operations are enabled.
def qwiic_mmc5983ma.QwiicMMC5983MA.get_temperature | ( | self | ) |
Gets the temperature in degrees Celsius.
def qwiic_mmc5983ma.QwiicMMC5983MA.is_3_wire_spi_enabled | ( | self | ) |
Checks if 3-wire SPI is enabled.
True
if 3-wire SPI is enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_automatic_set_reset_enabled | ( | self | ) |
Checks if automatic SET/RESET operations are enabled.
True
if enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_bit_set | ( | self, | |
register_address, | |||
bit_mask | |||
) |
Checks if a bit is set in a register.
int | register_address: Register address |
int | bit_mask: Bit mask |
True
if bit is set, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_connected | ( | self | ) |
Determines if this device is connected.
True
if connected, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_continuous_mode_enabled | ( | self | ) |
Checks if continuous mode is enabled.
True
if enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_extra_current_applied_neg_to_pos | ( | self | ) |
Checks if extra current is applied "reverse" through the coils.
True
if extra current is applied, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_extra_current_applied_pos_to_neg | ( | self | ) |
Checks if extra current is applied "forward" through the coils.
True
if extra current is applied, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_interrupt_enabled | ( | self | ) |
Checks if interrupts are enabled.
True
if interrupts are enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_periodic_set_enabled | ( | self | ) |
Checks if periodic SET operations are enabled.
True
if enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_shadow_bit_set | ( | self, | |
register_address, | |||
bit_mask | |||
) |
Checks if a bit is set in the shadow register.
int | register_address: Register address |
int | bit_mask: Bit mask |
True
if bit is set, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.is_x_channel_enabled | ( | self | ) |
Checks if the X channel is enabled.
True
if enabled, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.perform_reset_operation | ( | self | ) |
Performs a RESET operation.
This resets the internal magnetization using coils built into the MMC5983MA, which can be used to degauss the sensor after it has been exposed to a strong magnetic field, or to compute the offset of each axis in conjuction with the SET operation.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.perform_set_operation | ( | self | ) |
Performs a SET operation.
This sets the internal magnetization using coils built into the MMC5983MA, which can be used to degauss the sensor after it has been exposed to a strong magnetic field, or to compute the offset of each axis in conjuction with the RESET operation.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.read_fields_xyz | ( | self | ) |
Internal function to get the raw x, y, and z-axis measurements, should not be called directly.
def qwiic_mmc5983ma.QwiicMMC5983MA.remove_extra_current_neg_to_pos | ( | self | ) |
Removes extra current "reverse" through the coils.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.remove_extra_current_pos_to_neg | ( | self | ) |
Removes extra current "forward" through the coils.
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.set_continuous_mode_frequency | ( | self, | |
frequency | |||
) |
Sets the continuous mode frequency.
int | frequency: Frequency in Hz, can be 1, 10, 20, 50, 100, 200, or
|
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.set_filter_bandwidth | ( | self, | |
bandwidth | |||
) |
Sets the filter bandwidth.
int | bandwidth: Bandwidth in Hz, can be 100, 200, 400, or 800 |
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.set_periodic_set_samples | ( | self, | |
number_of_samples | |||
) |
Sets the number of samples between each SET operation when periodic SET operations are enabled.
int | number_of_samples: Number of samples, can be 1, 25, 75, 100, 250, 500, 1000, or 2000 |
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.set_register_bit | ( | self, | |
register_address, | |||
bit_mask | |||
) |
Sets a bit in a register.
int | register_address: Register address |
int | bit_mask: Bit mask |
def qwiic_mmc5983ma.QwiicMMC5983MA.set_shadow_bit | ( | self, | |
register_address, | |||
bit_mask, | |||
do_write = True |
|||
) |
Sets a bit in the shadow register and optionally writes the value to the device.
int | register_address: Register address |
int | bit_mask: Bit mask |
bool,optional | do_write: Whether to write the value to the device, defaults to True |
True
if successful, otherwise False
def qwiic_mmc5983ma.QwiicMMC5983MA.soft_reset | ( | self | ) |
Performs a software reset.
True
if successful, otherwise False
qwiic_mmc5983ma.QwiicMMC5983MA.address |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
qwiic_mmc5983ma.QwiicMMC5983MA.memory_shadow |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
qwiic_mmc5983ma.QwiicMMC5983MA.x_offset |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
qwiic_mmc5983ma.QwiicMMC5983MA.y_offset |
|
static |
|
static |
|
static |
|
static |
qwiic_mmc5983ma.QwiicMMC5983MA.z_offset |
|
static |
|
static |
|
static |