15 namespace duds {
namespace hardware {
namespace devices {
namespace instruments {
22 namespace FXOS8700CQ_internal {
84 using namespace FXOS8700CQ_internal;
89 com(
std::
move(i2ccom)), datarate(0) {
95 com->converse(firstcon);
113 (std::uint8_t)(0x40);
116 com->converse(firstcon);
124 std::this_thread::sleep_for(std::chrono::milliseconds(2));
172 std::map<float, int>::const_iterator dv = DataRateVals.lower_bound(f);
173 if (dv == DataRateVals.cend()) {
193 std::uint8_t tmpregs[4] = {
207 (std::uint8_t)(
RegMagConfig1) << tmpregs[0] << tmpregs[1] << tmpregs[2];
291 std::uint8_t tmpreg = 0xC1 | (
drval << 3);
318 std::int8_t modestat;
320 std::this_thread::sleep_for(std::chrono::milliseconds(32));
324 }
while (modestat & 3);
334 if ((status & 7) == 7) {
348 accl.
x = duds::general::SignExtend<14>(
accl.
x);
349 accl.
y = duds::general::SignExtend<14>(
accl.
y);
350 accl.
z = duds::general::SignExtend<14>(
accl.
z);
void start()
Tells the device to start sampling.
void configure(float freq, Settings settings)
Configures the device.
void clear()
Makes the conversation empty.
The various settings for the device packed into an integer to avoid passing a lot of parameters...
bool sample()
Reads sampled data from the device.
boost::error_info< struct Info_i2cdevaddr, int > I2cDeviceAddr
Provides the device (slave) address along with an error.
ConversationVector & addInputVector(std::size_t len)
Creates a new ConversationVector for fixed length input and initializes it with the given length...
unsigned int accelLowNoise
Use the low-noise mode of the accelerometer.
unsigned int highPassLowCutoff
Adjusts the cut-off frequency of the high-pass filter to be lower.
unsigned int accelerometer
Flag to use the accelerometer.
Magnitude maxMagnitude
The maximum magnetude for the accelerometer.
boost::error_info< struct Info_UpdateRate, float > RequestedUpdateRate
bool bigEndian() const
True if this part is flagged as having data in big-endian form.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
void suspend()
Suspends operation by putting the device into a low-power mode that discontinues sampling.
OversampleMode oversampleSleepMode
The oversample mode to use when in the sleep state.
The device did not respond to its address (NACK).
SYSMOD, the system operating mode and FIFO error status.
std::int8_t drval
The data rate value given to the device.
duds::hardware::interface::Conversation input
The conversation used to read in samples from the device.
Selects the +/-8g accelerometer range.
unsigned int magnetometer
Flag to use the magnetometer.
duds::hardware::interface::Conversation bufq
Settings cfg
The current various configuration options.
FXOS8700CQ(std::unique_ptr< duds::hardware::interface::I2c > &i2ccom)
Attempts to identify the device, then suspends the device's operation.
static const std::map< float, int > DataRateVals
unsigned int oversampleRatio
Affects how many samples are taken by the magnetometer to produce a single output sample...
static std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t > conv
String converter; UTF-8 to/from UTF-32.
The requested maximum magnitude is either unsupported or an invalid value.
std::unique_ptr< duds::hardware::interface::I2c > com
The I2C communication interface.
float datarate
The currently configured sample rate.
The configuration requested that neither the accelerometer or magnetometer be used.
An attempt was made to use a device that seems to exist, but the responding device is not the type th...
ConversationVector & addOutputVector()
Creates a new ConversationVector for output and returns it for modification.
unsigned int highPassFilter
Enables the high-pass filter.
~FXOS8700CQ()
Calls suspend().
RawSample accl
The values supplied by the device.
#define DUDS_THROW_EXCEPTION(x)
Works like BOOST_THROW_EXCEPTION, but includes a stack trace if DUDS_ERRORS_VERBOSE is defined...
The requested data rate is unsupported.
OversampleMode oversampleMode
The oversample mode to use when in the active non-sleep state.
Represents a two-way conversation with a device.