31#ifdef ARDUINO_T_BEAM_S3_SUPREME
32#include <XPowersAXP2101.tpp>
47#if defined(ARDUINO_T_BEAM_S3_SUPREME)
49 power.
begin(Wire1, AXP2101_SLAVE_ADDRESS, 42, 41);
53 power.setALDO1Voltage(3300);
55 power.setALDO2Voltage(3300);
74 uint8_t address = QMC6310U_SLAVE_ADDRESS;
79 Serial.println(
"Failed to find QMC6310 - check your wiring!");
85 float data_rate_hz = 200.0f;
101 down_sample_ratio)) {
102 Serial.println(
"Magnetometer configured successfully.");
104 Serial.println(
"Magnetometer configuration failed.");
109 Serial.print(
"Manufacturer: "); Serial.println(info.
manufacturer);
110 Serial.print(
"Model: "); Serial.println(info.
model);
111 Serial.print(
"I2C Address: 0x"); Serial.println(info.
i2c_address, HEX);
112 Serial.print(
"Version: "); Serial.println(info.
version);
113 Serial.print(
"UID: 0x"); Serial.println(info.
uid);
117 Serial.print(
"DataRate: "); Serial.println(cfg.
sample_rate);
118 Serial.print(
"FullScaleRange: "); Serial.println(cfg.
range);
119 Serial.print(
"Mode: "); Serial.println((uint8_t)cfg.
mode);
127 Serial.print(
" Magnetic Declination: ");
128 Serial.print(declination_deg, 2);
131 Serial.print(
" Sensitivity: ");
133 Serial.println(
" Gauss/LSB");
137 Serial.println(
"Read data now...");
152 Serial.print(
"Mag:");
153 Serial.print(
" X:"); Serial.print(
x);
154 Serial.print(
" Y:"); Serial.print(
y);
155 Serial.print(
" Z:"); Serial.print(z);
158 Serial.print(
" Metadata:");
160 Serial.print(data.
raw.
x);
162 Serial.print(data.
raw.
y);
164 Serial.print(data.
raw.
z);
166 Serial.print(
" Heading (rad): ");
168 Serial.print(
" rad");
170 Serial.print(
" Heading (deg): ");
176 Serial.print(
" Magnetic Strength: ");
177 Serial.print(strength, 2);
178 Serial.println(
" μT");
181 Serial.println(
"\tWarning: Data Overflow occurred!");
OperationMode
Enumeration of sensor operation modes.
MagFullScaleRange
Enumeration defining full-scale range settings for the sensor.
MagDownSampleRatio
Enumeration defining down-sample ratios for the sensor.
@ DSR_1
1x down-sample ratio
MagOverSampleRatio
Enumeration defining over-sample ratios for the sensor.
@ OSR_1
1x over-sample ratio
bool begin(SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
Initialize the sensor using custom callback interface.
virtual void setDeclination(float declination_deg)
Set the magnetic declination correction value.
virtual SensorConfig getConfig() const
Get current sensor configuration.
float getSensitivity() const
Get sensor sensitivity.
SensorInfo getSensorInfo() const
Get sensor information.
bool configMagnetometer(OperationMode mode, MagFullScaleRange range, float odr, MagOverSampleRatio osr, MagDownSampleRatio dsr) override
Configures the magnetometer with multiple parameters.
bool readData(MagnetometerData &data) override
Reads the magnetic field data from the sensor.
static const char * typeToString(SensorType type)
Convert sensor type enumeration to string representation.
float dmsToDecimalDegrees(int degrees, int minutes, float seconds=0.0f)
Convert degrees-minutes-seconds to decimal degrees.
float calculateMagneticStrength(const MagnetometerData &data)
Calculate total magnetic field strength.
float gaussToMicroTesla(float gauss)
Converts Gauss to microTesla.
SensorQMC6310 magnetometer
Structure representing magnetometer data.
float heading_degrees
heading angle (degrees)
float heading
heading angle (radians)
SensorVector magnetic_field
magnetic field strength (Gauss)
bool overflow
data overflow flag
int16_t x
X-axis raw value.
int16_t y
Y-axis raw value.
int16_t z
Z-axis raw value.
Structure representing sensor configuration parameters.
float sample_rate
Sample rate in Hz.
float range
Measurement range.
OperationMode mode
Operation mode.
Structure containing sensor identification information.
uint8_t version
Hardware/firmware version.
uint8_t i2c_address
Default I2C address.
uint32_t uid
Unique identifier.
SensorType type
Sensor type.
const char * manufacturer
Manufacturer name.
const char * model
Model name/identifier.