API Reference
adafruit_qmc5883p
CircuitPython driver for the Adafruit QMC5883P - Triple Axis Magnetometer - STEMMA QT
Author(s): Liz Clark
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
- class adafruit_qmc5883p.QMC5883P(i2c_bus: busio.I2C, address: int = _DEFAULT_ADDR)
Driver for the QMC5883P 3-axis magnetometer.
- Parameters:
- property data_rate: int
The output data rate in Hz.
Options are: - ODR_10HZ (0x00): 10 Hz - ODR_50HZ (0x01): 50 Hz - ODR_100HZ (0x02): 100 Hz - ODR_200HZ (0x03): 200 Hz
- data_ready
Check if new magnetic data is ready.
- property downsample_ratio: int
The downsample ratio.
Options are: - DSR_1 (0x00): Downsample ratio = 1 - DSR_2 (0x01): Downsample ratio = 2 - DSR_4 (0x02): Downsample ratio = 4 - DSR_8 (0x03): Downsample ratio = 8
- property magnetic: Tuple[float, float, float]
The magnetic field measured in microteslas (uT).
- Returns:
A 3-tuple of X, Y, Z axis values in microteslas
- property magnetic_raw: Tuple[int, int, int]
The raw magnetic field sensor values as signed 16-bit integers.
- Returns:
A 3-tuple of X, Y, Z axis raw values
- property mode: int
The operating mode of the sensor.
Options are: - MODE_SUSPEND (0x00): Suspend mode - MODE_NORMAL (0x01): Normal mode - MODE_SINGLE (0x02): Single measurement mode - MODE_CONTINUOUS (0x03): Continuous mode
- overflow
Check if data overflow has occurred.
- property oversample_ratio: int
The over sample ratio.
Options are: - OSR_8 (0x00): Over sample ratio = 8 - OSR_4 (0x01): Over sample ratio = 4 - OSR_2 (0x02): Over sample ratio = 2 - OSR_1 (0x03): Over sample ratio = 1
- property range: int
The magnetic field range.
Options are: - RANGE_30G (0x00): ±30 Gauss range - RANGE_12G (0x01): ±12 Gauss range - RANGE_8G (0x02): ±8 Gauss range - RANGE_2G (0x03): ±2 Gauss range