![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
First draft HMC5883 magnetometer sensor using physical quantities, outputting via serial port using std::cout on mbed os 5
hmc5883.h
- Committer:
- skyscraper
- Date:
- 2020-03-24
- Revision:
- 2:9ffb2f18756b
- Child:
- 3:2834be4e10ef
File content as of revision 2:9ffb2f18756b:
#include <quan/out/magnetic_flux_density.hpp> #include <quan/three_d/out/vect.hpp> //true if the hmc5883 is detected bool mag_detected(); // only 1,2,4,8 available // else returns false and does nothing bool mag_set_samples_average(int n_samples); // set data rate specified as a rational //data rate 0.75 <3,4>, 1.5 <3,2>, 3 <3>,7.5 <15,2>, 15 <15>(Default) // , 30 <30>, 75 <75> //N.B. wont link if other values specified template <int N, int D=1> bool mag_set_data_rate(); // set +- range // sets the nearest greater equal +-range to abs(range_in) // N.B so wont necessarily set exact range input // TODO: get_range // returns false if range is too big bool mag_set_range(quan::magnetic_flux_density::uT const & range_in); quan::magnetic_flux_density::uT mag_get_range(); // probably remove and decide how to do this behind the scenes // in concert with mag_set_data_rate bool mag_set_continuous_measurement_mode(); bool mag_set_single_measurement_mode(); bool mag_do_single_measurement( quan::three_d::vect<quan::magnetic_flux_density::uT>& result ); // TODO prefer mag enable / disable() ? bool mag_set_idle_mode(); // TODO callback? bool mag_data_ready(); // TODO ignore this make private bool mag_data_locked(); bool mag_read(quan::three_d::vect<quan::magnetic_flux_density::uT> & v);