mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:48:54 +08:00
ak09916: minor cleanup
This commit is contained in:
@@ -34,7 +34,6 @@ px4_add_module(
|
||||
MODULE drivers__ak09916
|
||||
MAIN ak09916
|
||||
COMPILE_FLAGS
|
||||
-Wno-cast-align # TODO: fix and enable
|
||||
SRCS
|
||||
ak09916.cpp
|
||||
DEPENDS
|
||||
|
||||
@@ -40,26 +40,26 @@
|
||||
#include <px4_platform_common/time.h>
|
||||
#include <lib/perf/perf_counter.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <lib/conversion/rotation.h>
|
||||
#include <px4_platform_common/getopt.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
|
||||
#include "ak09916.hpp"
|
||||
|
||||
|
||||
extern "C" __EXPORT int ak09916_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
AK09916::AK09916(I2CSPIBusOption bus_option, const int bus, int bus_frequency, enum Rotation rotation) :
|
||||
I2C("AK09916", nullptr, bus, AK09916_I2C_ADDR, bus_frequency),
|
||||
I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus),
|
||||
_px4_mag(get_device_id(), ORB_PRIO_MAX, rotation),
|
||||
_mag_reads(perf_alloc(PC_COUNT, "ak09916_mag_reads")),
|
||||
_mag_errors(perf_alloc(PC_COUNT, "ak09916_mag_errors")),
|
||||
_mag_overruns(perf_alloc(PC_COUNT, "ak09916_mag_overruns")),
|
||||
_mag_overflows(perf_alloc(PC_COUNT, "ak09916_mag_overflows"))
|
||||
_px4_mag(get_device_id(), external() ? ORB_PRIO_VERY_HIGH : ORB_PRIO_DEFAULT, rotation),
|
||||
_mag_reads(perf_alloc(PC_COUNT, MODULE_NAME": mag_reads")),
|
||||
_mag_errors(perf_alloc(PC_COUNT, MODULE_NAME": mag_errors")),
|
||||
_mag_overruns(perf_alloc(PC_COUNT, MODULE_NAME": mag_overruns")),
|
||||
_mag_overflows(perf_alloc(PC_COUNT, MODULE_NAME": mag_overflows"))
|
||||
{
|
||||
set_device_type(DRV_MAG_DEVTYPE_AK09916);
|
||||
_px4_mag.set_device_type(DRV_MAG_DEVTYPE_AK09916);
|
||||
_px4_mag.set_external(external());
|
||||
|
||||
_px4_mag.set_scale(AK09916_MAG_RANGE_GA);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,4 @@ private:
|
||||
perf_counter_t _mag_errors;
|
||||
perf_counter_t _mag_overruns;
|
||||
perf_counter_t _mag_overflows;
|
||||
|
||||
AK09916(const AK09916 &) = delete;
|
||||
AK09916 operator=(const AK09916 &) = delete;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user