HMC5883L Magnetometer

See Application::make_hmc5883l().

API Reference

class HMC5883LComponent : public PollingComponent, public I2CDevice

Public Functions

HMC5883LComponent(I2CComponent *parent, uint32_t update_interval = 15000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

Return
The setup priority of this component

void update()
HMC5883LFieldStrengthSensor *make_x_sensor(const std::string &name)
HMC5883LFieldStrengthSensor *make_y_sensor(const std::string &name)
HMC5883LFieldStrengthSensor *make_z_sensor(const std::string &name)
HMC5883LHeadingSensor *make_heading_sensor(const std::string &name)
void set_range(HMC5883LRange range)

Protected Types

enum ErrorCode

Values:

NONE = 0
COMMUNICATION_FAILED
ID_REGISTERS

Protected Attributes

HMC5883LRange range_ = {HMC5883L_RANGE_130_UT}
HMC5883LFieldStrengthSensor *x_sensor_
HMC5883LFieldStrengthSensor *y_sensor_
HMC5883LFieldStrengthSensor *z_sensor_
HMC5883LHeadingSensor *heading_sensor_
sensor::HMC5883LComponent::ErrorCode error_code_
enum sensor::HMC5883LRange

Values:

HMC5883L_RANGE_88_UT = 0b000
HMC5883L_RANGE_130_UT = 0b001
HMC5883L_RANGE_190_UT = 0b010
HMC5883L_RANGE_250_UT = 0b011
HMC5883L_RANGE_400_UT = 0b100
HMC5883L_RANGE_470_UT = 0b101
HMC5883L_RANGE_560_UT = 0b110
HMC5883L_RANGE_810_UT = 0b111
using sensor::HMC5883LFieldStrengthSensor = typedef EmptyPollingParentSensor<1, ICON_MAGNET, UNIT_UT>
using sensor::HMC5883LHeadingSensor = typedef EmptyPollingParentSensor<1, ICON_SCREEN_ROTATION, UNIT_DEGREES>