10 namespace Treehopper {
namespace Libraries {
namespace Sensors {
namespace Inertial {
60 class StatusRegAuxRegister :
public Register 64 int oneAxisDataAvailable;
65 int twoAxisDataAvailable;
66 int threeAxisDataAvailable;
68 int oneAxisDataOverrun;
69 int twoAxisDataOverrun;
72 long getValue() {
return ((oneAxisDataAvailable & 0x1) << 0) | ((twoAxisDataAvailable & 0x1) << 1) | ((threeAxisDataAvailable & 0x1) << 2) | ((dataAvailable & 0x1) << 3) | ((oneAxisDataOverrun & 0x1) << 4) | ((twoAxisDataOverrun & 0x1) << 5) | ((dataOverrun & 0x1) << 6); }
73 void setValue(
long val)
75 oneAxisDataAvailable = (int)((val >> 0) & 0x1);
76 twoAxisDataAvailable = (int)((val >> 1) & 0x1);
77 threeAxisDataAvailable = (int)((val >> 2) & 0x1);
78 dataAvailable = (int)((val >> 3) & 0x1);
79 oneAxisDataOverrun = (int)((val >> 4) & 0x1);
80 twoAxisDataOverrun = (int)((val >> 5) & 0x1);
81 dataOverrun = (int)((val >> 6) & 0x1);
85 class OutAdc1Register :
public Register 91 long getValue() {
return ((value & 0x3FF) << 6); }
92 void setValue(
long val)
94 value = (int)((val >> 6) & 0x3FF);
98 class OutAdc2Register :
public Register 104 long getValue() {
return ((value & 0x3FF) << 6); }
105 void setValue(
long val)
107 value = (int)((val >> 6) & 0x3FF);
111 class OutAdc3Register :
public Register 117 long getValue() {
return ((value & 0x3FF) << 6); }
118 void setValue(
long val)
120 value = (int)((val >> 6) & 0x3FF);
124 class WhoAmIRegister :
public Register 130 long getValue() {
return ((value & 0xFF) << 0); }
131 void setValue(
long val)
133 value = (int)((val >> 0) & 0xFF);
137 class Ctrl0Register :
public Register 143 void setSdoPuDisc(
SdoPuDiscs enumVal) { sdoPuDisc = (int)enumVal; }
145 long getValue() {
return ((sdoPuDisc & 0xFF) << 0); }
146 void setValue(
long val)
148 sdoPuDisc = (int)((val >> 0) & 0xFF);
152 class TempCfgRegRegister :
public Register 159 long getValue() {
return ((adcEn & 0x1) << 7) | ((tempEn & 0x1) << 6); }
160 void setValue(
long val)
162 adcEn = (int)((val >> 7) & 0x1);
163 tempEn = (int)((val >> 6) & 0x1);
167 class Ctrl2Register :
public Register 171 int highPassAoiInt1Enable;
172 int highPassAoiInt2Enable;
173 int highPassClickEnable;
174 int filterDataPassThru;
175 int highPassFilterCutoffFrequency;
176 int highPassFilterModeSelection;
180 long getValue() {
return ((highPassAoiInt1Enable & 0x1) << 0) | ((highPassAoiInt2Enable & 0x1) << 1) | ((highPassClickEnable & 0x1) << 2) | ((filterDataPassThru & 0x1) << 3) | ((highPassFilterCutoffFrequency & 0x3) << 4) | ((highPassFilterModeSelection & 0x3) << 6); }
181 void setValue(
long val)
183 highPassAoiInt1Enable = (int)((val >> 0) & 0x1);
184 highPassAoiInt2Enable = (int)((val >> 1) & 0x1);
185 highPassClickEnable = (int)((val >> 2) & 0x1);
186 filterDataPassThru = (int)((val >> 3) & 0x1);
187 highPassFilterCutoffFrequency = (int)((val >> 4) & 0x3);
188 highPassFilterModeSelection = (int)((val >> 6) & 0x3);
192 class Ctrl3Register :
public Register 204 long getValue() {
return ((overrun & 0x1) << 1) | ((fifoWatermark & 0x1) << 2) | ((da321 & 0x1) << 3) | ((zyxda & 0x1) << 4) | ((ia2 & 0x1) << 5) | ((ia1 & 0x1) << 6) | ((click & 0x1) << 7); }
205 void setValue(
long val)
207 overrun = (int)((val >> 1) & 0x1);
208 fifoWatermark = (int)((val >> 2) & 0x1);
209 da321 = (int)((val >> 3) & 0x1);
210 zyxda = (int)((val >> 4) & 0x1);
211 ia2 = (int)((val >> 5) & 0x1);
212 ia1 = (int)((val >> 6) & 0x1);
213 click = (int)((val >> 7) & 0x1);
217 class Ctrl4Register :
public Register 221 int spiInterfaceMode;
223 int highResolutionOutput;
224 int fullScaleSelection;
228 void setFullScaleSelection(
FullScaleSelections enumVal) { fullScaleSelection = (int)enumVal; }
230 long getValue() {
return ((spiInterfaceMode & 0x1) << 0) | ((selfTestEnable & 0x3) << 1) | ((highResolutionOutput & 0x1) << 3) | ((fullScaleSelection & 0x3) << 4) | ((bigEndian & 0x1) << 6) | ((blockDataUpdate & 0x1) << 7); }
231 void setValue(
long val)
233 spiInterfaceMode = (int)((val >> 0) & 0x1);
234 selfTestEnable = (int)((val >> 1) & 0x3);
235 highResolutionOutput = (int)((val >> 3) & 0x1);
236 fullScaleSelection = (int)((val >> 4) & 0x3);
237 bigEndian = (int)((val >> 6) & 0x1);
238 blockDataUpdate = (int)((val >> 7) & 0x1);
242 class Ctrl5Register :
public Register 251 int rebootMemoryContent;
253 long getValue() {
return ((enable4DInt2 & 0x1) << 0) | ((latchInt2 & 0x1) << 1) | ((enable4DInt1 & 0x1) << 2) | ((latchInt1 & 0x1) << 3) | ((fifoEnable & 0x1) << 4) | ((rebootMemoryContent & 0x1) << 5); }
254 void setValue(
long val)
256 enable4DInt2 = (int)((val >> 0) & 0x1);
257 latchInt2 = (int)((val >> 1) & 0x1);
258 enable4DInt1 = (int)((val >> 2) & 0x1);
259 latchInt1 = (int)((val >> 3) & 0x1);
260 fifoEnable = (int)((val >> 4) & 0x1);
261 rebootMemoryContent = (int)((val >> 5) & 0x1);
265 class Ctrl6Register :
public Register 276 long getValue() {
return ((intPolarity & 0x1) << 1) | ((act & 0x1) << 3) | ((boot & 0x1) << 4) | ((ia2 & 0x1) << 5) | ((ia1 & 0x1) << 6) | ((click & 0x1) << 7); }
277 void setValue(
long val)
279 intPolarity = (int)((val >> 1) & 0x1);
280 act = (int)((val >> 3) & 0x1);
281 boot = (int)((val >> 4) & 0x1);
282 ia2 = (int)((val >> 5) & 0x1);
283 ia1 = (int)((val >> 6) & 0x1);
284 click = (int)((val >> 7) & 0x1);
288 class ReferenceRegister :
public Register 294 long getValue() {
return ((value & 0xFF) << 0); }
295 void setValue(
long val)
297 value = (int)((val >> 0) & 0xFF);
301 class StatusRegister :
public Register 314 long getValue() {
return ((xda & 0x1) << 0) | ((yda & 0x1) << 1) | ((zda & 0x1) << 2) | ((zyxda & 0x1) << 3) | ((x_or & 0x1) << 4) | ((y_or & 0x1) << 5) | ((z_or & 0x1) << 6) | ((zyx_or & 0x1) << 7); }
315 void setValue(
long val)
317 xda = (int)((val >> 0) & 0x1);
318 yda = (int)((val >> 1) & 0x1);
319 zda = (int)((val >> 2) & 0x1);
320 zyxda = (int)((val >> 3) & 0x1);
321 x_or = (int)((val >> 4) & 0x1);
322 y_or = (int)((val >> 5) & 0x1);
323 z_or = (int)((val >> 6) & 0x1);
324 zyx_or = (int)((val >> 7) & 0x1);
328 class FifoCtrlRegister :
public Register 333 int triggerSelection;
336 void setFifoMode(
FifoModes enumVal) { fifoMode = (int)enumVal; }
338 long getValue() {
return ((fifoThreshold & 0x1F) << 0) | ((triggerSelection & 0x1) << 5) | ((fifoMode & 0x3) << 6); }
339 void setValue(
long val)
341 fifoThreshold = (int)((val >> 0) & 0x1F);
342 triggerSelection = (int)((val >> 5) & 0x1);
343 fifoMode = (int)((val >> 6) & 0x3);
347 class FifoSrcRegister :
public Register 356 long getValue() {
return ((fss & 0x1F) << 0) | ((emtpy & 0x1) << 5) | ((overrunFifo & 0x1) << 6) | ((watermark & 0x1) << 7); }
357 void setValue(
long val)
359 fss = (int)((val >> 0) & 0x1F);
360 emtpy = (int)((val >> 5) & 0x1);
361 overrunFifo = (int)((val >> 6) & 0x1);
362 watermark = (int)((val >> 7) & 0x1);
366 class Int1CfgRegister :
public Register 371 int enableXHighEvent;
373 int enableYHighEvent;
375 int enableZHighEvent;
377 int andOrInterruptEvents;
379 long getValue() {
return ((enableXLowEvent & 0x1) << 0) | ((enableXHighEvent & 0x1) << 1) | ((enableYLowEvent & 0x1) << 2) | ((enableYHighEvent & 0x1) << 3) | ((enableZLowEvent & 0x1) << 4) | ((enableZHighEvent & 0x1) << 5) | ((enable6D & 0x1) << 6) | ((andOrInterruptEvents & 0x1) << 7); }
380 void setValue(
long val)
382 enableXLowEvent = (int)((val >> 0) & 0x1);
383 enableXHighEvent = (int)((val >> 1) & 0x1);
384 enableYLowEvent = (int)((val >> 2) & 0x1);
385 enableYHighEvent = (int)((val >> 3) & 0x1);
386 enableZLowEvent = (int)((val >> 4) & 0x1);
387 enableZHighEvent = (int)((val >> 5) & 0x1);
388 enable6D = (int)((val >> 6) & 0x1);
389 andOrInterruptEvents = (int)((val >> 7) & 0x1);
393 class Int1SrcRegister :
public Register 405 long getValue() {
return ((xLow & 0x1) << 0) | ((xHigh & 0x1) << 1) | ((yLow & 0x1) << 2) | ((yHigh & 0x1) << 3) | ((zLow & 0x1) << 4) | ((zHigh & 0x1) << 5) | ((interruptActive & 0x1) << 6); }
406 void setValue(
long val)
408 xLow = (int)((val >> 0) & 0x1);
409 xHigh = (int)((val >> 1) & 0x1);
410 yLow = (int)((val >> 2) & 0x1);
411 yHigh = (int)((val >> 3) & 0x1);
412 zLow = (int)((val >> 4) & 0x1);
413 zHigh = (int)((val >> 5) & 0x1);
414 interruptActive = (int)((val >> 6) & 0x1);
418 class Int1ThresholdRegister :
public Register 424 long getValue() {
return ((value & 0x7F) << 0); }
425 void setValue(
long val)
427 value = (int)((val >> 0) & 0x7F);
431 class Int1DurationRegister :
public Register 437 long getValue() {
return ((value & 0x7F) << 0); }
438 void setValue(
long val)
440 value = (int)((val >> 0) & 0x7F);
444 class Int2CfgRegister :
public Register 449 int enableXHighEvent;
451 int enableYHighEvent;
453 int enableZHighEvent;
455 int andOrInterruptEvents;
457 long getValue() {
return ((enableXLowEvent & 0x1) << 0) | ((enableXHighEvent & 0x1) << 1) | ((enableYLowEvent & 0x1) << 2) | ((enableYHighEvent & 0x1) << 3) | ((enableZLowEvent & 0x1) << 4) | ((enableZHighEvent & 0x1) << 5) | ((enable6D & 0x1) << 6) | ((andOrInterruptEvents & 0x1) << 7); }
458 void setValue(
long val)
460 enableXLowEvent = (int)((val >> 0) & 0x1);
461 enableXHighEvent = (int)((val >> 1) & 0x1);
462 enableYLowEvent = (int)((val >> 2) & 0x1);
463 enableYHighEvent = (int)((val >> 3) & 0x1);
464 enableZLowEvent = (int)((val >> 4) & 0x1);
465 enableZHighEvent = (int)((val >> 5) & 0x1);
466 enable6D = (int)((val >> 6) & 0x1);
467 andOrInterruptEvents = (int)((val >> 7) & 0x1);
471 class Int2SrcRegister :
public Register 483 long getValue() {
return ((xLow & 0x1) << 0) | ((xHigh & 0x1) << 1) | ((yLow & 0x1) << 2) | ((yHigh & 0x1) << 3) | ((zLow & 0x1) << 4) | ((zHigh & 0x1) << 5) | ((interruptActive & 0x1) << 6); }
484 void setValue(
long val)
486 xLow = (int)((val >> 0) & 0x1);
487 xHigh = (int)((val >> 1) & 0x1);
488 yLow = (int)((val >> 2) & 0x1);
489 yHigh = (int)((val >> 3) & 0x1);
490 zLow = (int)((val >> 4) & 0x1);
491 zHigh = (int)((val >> 5) & 0x1);
492 interruptActive = (int)((val >> 6) & 0x1);
496 class Int2ThresholdRegister :
public Register 502 long getValue() {
return ((value & 0x7F) << 0); }
503 void setValue(
long val)
505 value = (int)((val >> 0) & 0x7F);
509 class Int2DurationRegister :
public Register 515 long getValue() {
return ((value & 0x7F) << 0); }
516 void setValue(
long val)
518 value = (int)((val >> 0) & 0x7F);
522 class ClickSourceRegister :
public Register 530 int singleClickEnable;
531 int doubleClickEnable;
534 long getValue() {
return ((x & 0x1) << 0) | ((y & 0x1) << 1) | ((z & 0x1) << 2) | ((sign & 0x1) << 3) | ((singleClickEnable & 0x1) << 4) | ((doubleClickEnable & 0x1) << 5) | ((interruptActive & 0x1) << 6); }
535 void setValue(
long val)
537 x = (int)((val >> 0) & 0x1);
538 y = (int)((val >> 1) & 0x1);
539 z = (int)((val >> 2) & 0x1);
540 sign = (int)((val >> 3) & 0x1);
541 singleClickEnable = (int)((val >> 4) & 0x1);
542 doubleClickEnable = (int)((val >> 5) & 0x1);
543 interruptActive = (int)((val >> 6) & 0x1);
547 class ClickThresholdRegister :
public Register 554 long getValue() {
return ((threshold & 0x7F) << 0) | ((lirClick & 0x1) << 7); }
555 void setValue(
long val)
557 threshold = (int)((val >> 0) & 0x7F);
558 lirClick = (int)((val >> 7) & 0x1);
562 class TimeLimitRegister :
public Register 568 long getValue() {
return ((value & 0x7F) << 0); }
569 void setValue(
long val)
571 value = (int)((val >> 0) & 0x7F);
575 class TimeLatencyRegister :
public Register 581 long getValue() {
return ((value & 0x7FFF) << 0); }
582 void setValue(
long val)
584 value = (int)((val >> 0) & 0x7FFF);
588 class TimeWindowRegister :
public Register 594 long getValue() {
return ((value & 0xFF) << 0); }
595 void setValue(
long val)
597 value = (int)((val >> 0) & 0xFF);
601 class ActivationThresholdRegister :
public Register 607 long getValue() {
return ((value & 0x7F) << 0); }
608 void setValue(
long val)
610 value = (int)((val >> 0) & 0x7F);
614 class ActivationDurationRegister :
public Register 620 long getValue() {
return ((value & 0xFF) << 0); }
621 void setValue(
long val)
623 value = (int)((val >> 0) & 0xFF);
627 class Ctrl1Register :
public Register 637 void setOutputDataRate(
OutputDataRates enumVal) { outputDataRate = (int)enumVal; }
639 long getValue() {
return ((xAxisEnable & 0x1) << 0) | ((yAxisEnable & 0x1) << 1) | ((zAxisEnable & 0x1) << 2) | ((lowPowerEnable & 0x1) << 3) | ((outputDataRate & 0xF) << 4); }
640 void setValue(
long val)
642 xAxisEnable = (int)((val >> 0) & 0x1);
643 yAxisEnable = (int)((val >> 1) & 0x1);
644 zAxisEnable = (int)((val >> 2) & 0x1);
645 lowPowerEnable = (int)((val >> 3) & 0x1);
646 outputDataRate = (int)((val >> 4) & 0xF);
650 class OutXRegister :
public Register 656 long getValue() {
return ((value & 0x3FF) << 6); }
657 void setValue(
long val)
659 value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
663 class OutYRegister :
public Register 669 long getValue() {
return ((value & 0x3FF) << 6); }
670 void setValue(
long val)
672 value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
676 class OutZRegister :
public Register 682 long getValue() {
return ((value & 0x3FF) << 6); }
683 void setValue(
long val)
685 value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
689 StatusRegAuxRegister statusRegAux;
690 OutAdc1Register outAdc1;
691 OutAdc2Register outAdc2;
692 OutAdc3Register outAdc3;
693 WhoAmIRegister whoAmI;
695 TempCfgRegRegister tempCfgReg;
701 ReferenceRegister reference;
702 StatusRegister status;
703 FifoCtrlRegister fifoCtrl;
704 FifoSrcRegister fifoSrc;
705 Int1CfgRegister int1Cfg;
706 Int1SrcRegister int1Src;
707 Int1ThresholdRegister int1Threshold;
708 Int1DurationRegister int1Duration;
709 Int2CfgRegister int2Cfg;
710 Int2SrcRegister int2Src;
711 Int2ThresholdRegister int2Threshold;
712 Int2DurationRegister int2Duration;
713 ClickSourceRegister clickSource;
714 ClickThresholdRegister clickThreshold;
715 TimeLimitRegister timeLimit;
716 TimeLatencyRegister timeLatency;
717 TimeWindowRegister timeWindow;
718 ActivationThresholdRegister activationThreshold;
719 ActivationDurationRegister activationDuration;
725 Lis3dhRegisters(SMBusDevice& device) :
RegisterManager(device, true), statusRegAux(*this), outAdc1(*this), outAdc2(*this), outAdc3(*this), whoAmI(*this), ctrl0(*this), tempCfgReg(*this), ctrl2(*this), ctrl3(*this), ctrl4(*this), ctrl5(*this), ctrl6(*this), reference(*this), status(*this), fifoCtrl(*this), fifoSrc(*this), int1Cfg(*this), int1Src(*this), int1Threshold(*this), int1Duration(*this), int2Cfg(*this), int2Src(*this), int2Threshold(*this), int2Duration(*this), clickSource(*this), clickThreshold(*this), timeLimit(*this), timeLatency(*this), timeWindow(*this), activationThreshold(*this), activationDuration(*this), ctrl1(*this), outX(*this), outY(*this), outZ(*this)
727 registers.push_back(&statusRegAux);
728 registers.push_back(&outAdc1);
729 registers.push_back(&outAdc2);
730 registers.push_back(&outAdc3);
731 registers.push_back(&whoAmI);
732 registers.push_back(&ctrl0);
733 registers.push_back(&tempCfgReg);
734 registers.push_back(&ctrl2);
735 registers.push_back(&ctrl3);
736 registers.push_back(&ctrl4);
737 registers.push_back(&ctrl5);
738 registers.push_back(&ctrl6);
739 registers.push_back(&reference);
740 registers.push_back(&status);
741 registers.push_back(&fifoCtrl);
742 registers.push_back(&fifoSrc);
743 registers.push_back(&int1Cfg);
744 registers.push_back(&int1Src);
745 registers.push_back(&int1Threshold);
746 registers.push_back(&int1Duration);
747 registers.push_back(&int2Cfg);
748 registers.push_back(&int2Src);
749 registers.push_back(&int2Threshold);
750 registers.push_back(&int2Duration);
751 registers.push_back(&clickSource);
752 registers.push_back(&clickThreshold);
753 registers.push_back(&timeLimit);
754 registers.push_back(&timeLatency);
755 registers.push_back(&timeWindow);
756 registers.push_back(&activationThreshold);
757 registers.push_back(&activationDuration);
758 registers.push_back(&ctrl1);
759 registers.push_back(&outX);
760 registers.push_back(&outY);
761 registers.push_back(&outZ);
FullScaleSelections
Definition: Lis3dhRegisters.h:26
Definition: Register.h:11
Definition: RegisterManager.h:10
FifoModes
Definition: L3gd20Registers.h:20
SdoPuDiscs
Definition: Lis3dhRegisters.h:12
OutputDataRates
Definition: Lis3dhRegisters.h:42
HighPassFilterModeSelections
Definition: Lis3dhRegisters.h:18