ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
qmc5883l.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7
8namespace esphome::qmc5883l {
9
16
21
28
30 SUB_SENSOR(x)
31 SUB_SENSOR(y)
32 SUB_SENSOR(z)
33 SUB_SENSOR(heading)
34 SUB_SENSOR(temperature)
35
36 public:
37 void setup() override;
38 void dump_config() override;
39 void update() override;
40 void loop() override;
41
42 void set_drdy_pin(GPIOPin *pin) { drdy_pin_ = pin; }
43 void set_datarate(QMC5883LDatarate datarate) { datarate_ = datarate; }
44 void set_range(QMC5883LRange range) { range_ = range; }
45 void set_oversampling(QMC5883LOversampling oversampling) { oversampling_ = oversampling; }
46
47 protected:
48 static void gpio_intr(QMC5883LComponent *arg);
49 void read_sensor_();
50
54 GPIOPin *drdy_pin_{nullptr};
55 bool drdy_use_isr_{false};
56 i2c::ErrorCode read_bytes_16_le_(uint8_t a_register, uint16_t *data, uint8_t len = 1);
58};
59
60} // namespace esphome::qmc5883l
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
Helper class to request loop() to be called as fast as possible.
Definition helpers.h:2329
This class simplifies creating components that periodically check a state.
Definition component.h:532
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
i2c::ErrorCode read_bytes_16_le_(uint8_t a_register, uint16_t *data, uint8_t len=1)
Definition qmc5883l.cpp:195
QMC5883LOversampling oversampling_
Definition qmc5883l.h:53
static void gpio_intr(QMC5883LComponent *arg)
Definition qmc5883l.cpp:27
HighFrequencyLoopRequester high_freq_
Definition qmc5883l.h:57
bool z
Definition msa3xx.h:1
Range range
Definition msa3xx.h:0
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
Definition i2c_bus.h:13
const void size_t len
Definition hal.h:68
uint16_t temperature
Definition sun_gtil2.cpp:12
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6