Treehopper C++ API
Lis3dhRegisters.h
Go to the documentation of this file.
1 #pragma once
3 #include "SMBusDevice.h"
6 #include "Libraries/Register.h"
7 
8 using namespace Treehopper::Libraries;
9 
10 namespace Treehopper { namespace Libraries { namespace Sensors { namespace Inertial {
11 
12  enum class SdoPuDiscs
13  {
16  };
17 
19  {
20  NormalMode = 0,
21  ReferenceSignal = 1,
22  Normal = 2,
24  };
25 
27  {
28  Scale_2G = 0,
29  Scale_4G = 1,
30  Scale_8G = 2,
31  Scale_16G = 3
32  };
33 
34  enum class FifoModes
35  {
36  Bypass = 0,
37  Fifo = 1,
38  Stream = 2,
39  StreamToFifo = 3
40  };
41 
42  enum class OutputDataRates
43  {
44  PowerDown = 0,
45  Hz_1 = 1,
46  Hz_10 = 2,
47  Hz_25 = 3,
48  Hz_50 = 4,
49  Hz_100 = 5,
50  Hz_200 = 6,
51  Hz_400 = 7,
52  Hz_1600 = 8,
53  Hz_1344_5376 = 9
54  };
55 
56 
57  class Lis3dhRegisters : public RegisterManager
58  {
59  public:
60  class StatusRegAuxRegister : public Register
61  {
62  public:
63  StatusRegAuxRegister(RegisterManager& regManager) : Register(regManager,0x07, 1, false) { }
64  int oneAxisDataAvailable;
65  int twoAxisDataAvailable;
66  int threeAxisDataAvailable;
67  int dataAvailable;
68  int oneAxisDataOverrun;
69  int twoAxisDataOverrun;
70  int dataOverrun;
71 
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)
74  {
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);
82  }
83  };
84 
85  class OutAdc1Register : public Register
86  {
87  public:
88  OutAdc1Register(RegisterManager& regManager) : Register(regManager,0x08, 2, false) { }
89  int value;
90 
91  long getValue() { return ((value & 0x3FF) << 6); }
92  void setValue(long val)
93  {
94  value = (int)((val >> 6) & 0x3FF);
95  }
96  };
97 
98  class OutAdc2Register : public Register
99  {
100  public:
101  OutAdc2Register(RegisterManager& regManager) : Register(regManager,0x0A, 2, false) { }
102  int value;
103 
104  long getValue() { return ((value & 0x3FF) << 6); }
105  void setValue(long val)
106  {
107  value = (int)((val >> 6) & 0x3FF);
108  }
109  };
110 
111  class OutAdc3Register : public Register
112  {
113  public:
114  OutAdc3Register(RegisterManager& regManager) : Register(regManager,0x0C, 2, false) { }
115  int value;
116 
117  long getValue() { return ((value & 0x3FF) << 6); }
118  void setValue(long val)
119  {
120  value = (int)((val >> 6) & 0x3FF);
121  }
122  };
123 
124  class WhoAmIRegister : public Register
125  {
126  public:
127  WhoAmIRegister(RegisterManager& regManager) : Register(regManager,0x0f, 1, false) { }
128  int value;
129 
130  long getValue() { return ((value & 0xFF) << 0); }
131  void setValue(long val)
132  {
133  value = (int)((val >> 0) & 0xFF);
134  }
135  };
136 
137  class Ctrl0Register : public Register
138  {
139  public:
140  Ctrl0Register(RegisterManager& regManager) : Register(regManager,0x1E, 1, false) { }
141  int sdoPuDisc;
142  SdoPuDiscs getSdoPuDisc() { return (SdoPuDiscs)sdoPuDisc; }
143  void setSdoPuDisc(SdoPuDiscs enumVal) { sdoPuDisc = (int)enumVal; }
144 
145  long getValue() { return ((sdoPuDisc & 0xFF) << 0); }
146  void setValue(long val)
147  {
148  sdoPuDisc = (int)((val >> 0) & 0xFF);
149  }
150  };
151 
152  class TempCfgRegRegister : public Register
153  {
154  public:
155  TempCfgRegRegister(RegisterManager& regManager) : Register(regManager,0x1F, 1, false) { }
156  int adcEn;
157  int tempEn;
158 
159  long getValue() { return ((adcEn & 0x1) << 7) | ((tempEn & 0x1) << 6); }
160  void setValue(long val)
161  {
162  adcEn = (int)((val >> 7) & 0x1);
163  tempEn = (int)((val >> 6) & 0x1);
164  }
165  };
166 
167  class Ctrl2Register : public Register
168  {
169  public:
170  Ctrl2Register(RegisterManager& regManager) : Register(regManager,0x21, 1, false) { }
171  int highPassAoiInt1Enable;
172  int highPassAoiInt2Enable;
173  int highPassClickEnable;
174  int filterDataPassThru;
175  int highPassFilterCutoffFrequency;
176  int highPassFilterModeSelection;
177  HighPassFilterModeSelections getHighPassFilterModeSelection() { return (HighPassFilterModeSelections)highPassFilterModeSelection; }
178  void setHighPassFilterModeSelection(HighPassFilterModeSelections enumVal) { highPassFilterModeSelection = (int)enumVal; }
179 
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)
182  {
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);
189  }
190  };
191 
192  class Ctrl3Register : public Register
193  {
194  public:
195  Ctrl3Register(RegisterManager& regManager) : Register(regManager,0x22, 1, false) { }
196  int overrun;
197  int fifoWatermark;
198  int da321;
199  int zyxda;
200  int ia2;
201  int ia1;
202  int click;
203 
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)
206  {
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);
214  }
215  };
216 
217  class Ctrl4Register : public Register
218  {
219  public:
220  Ctrl4Register(RegisterManager& regManager) : Register(regManager,0x23, 1, false) { }
221  int spiInterfaceMode;
222  int selfTestEnable;
223  int highResolutionOutput;
224  int fullScaleSelection;
225  int bigEndian;
226  int blockDataUpdate;
227  FullScaleSelections getFullScaleSelection() { return (FullScaleSelections)fullScaleSelection; }
228  void setFullScaleSelection(FullScaleSelections enumVal) { fullScaleSelection = (int)enumVal; }
229 
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)
232  {
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);
239  }
240  };
241 
242  class Ctrl5Register : public Register
243  {
244  public:
245  Ctrl5Register(RegisterManager& regManager) : Register(regManager,0x24, 1, false) { }
246  int enable4DInt2;
247  int latchInt2;
248  int enable4DInt1;
249  int latchInt1;
250  int fifoEnable;
251  int rebootMemoryContent;
252 
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)
255  {
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);
262  }
263  };
264 
265  class Ctrl6Register : public Register
266  {
267  public:
268  Ctrl6Register(RegisterManager& regManager) : Register(regManager,0x25, 1, false) { }
269  int intPolarity;
270  int act;
271  int boot;
272  int ia2;
273  int ia1;
274  int click;
275 
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)
278  {
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);
285  }
286  };
287 
288  class ReferenceRegister : public Register
289  {
290  public:
291  ReferenceRegister(RegisterManager& regManager) : Register(regManager,0x26, 1, false) { }
292  int value;
293 
294  long getValue() { return ((value & 0xFF) << 0); }
295  void setValue(long val)
296  {
297  value = (int)((val >> 0) & 0xFF);
298  }
299  };
300 
301  class StatusRegister : public Register
302  {
303  public:
304  StatusRegister(RegisterManager& regManager) : Register(regManager,0x27, 1, false) { }
305  int xda;
306  int yda;
307  int zda;
308  int zyxda;
309  int x_or;
310  int y_or;
311  int z_or;
312  int zyx_or;
313 
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)
316  {
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);
325  }
326  };
327 
328  class FifoCtrlRegister : public Register
329  {
330  public:
331  FifoCtrlRegister(RegisterManager& regManager) : Register(regManager,0x2E, 1, false) { }
332  int fifoThreshold;
333  int triggerSelection;
334  int fifoMode;
335  FifoModes getFifoMode() { return (FifoModes)fifoMode; }
336  void setFifoMode(FifoModes enumVal) { fifoMode = (int)enumVal; }
337 
338  long getValue() { return ((fifoThreshold & 0x1F) << 0) | ((triggerSelection & 0x1) << 5) | ((fifoMode & 0x3) << 6); }
339  void setValue(long val)
340  {
341  fifoThreshold = (int)((val >> 0) & 0x1F);
342  triggerSelection = (int)((val >> 5) & 0x1);
343  fifoMode = (int)((val >> 6) & 0x3);
344  }
345  };
346 
347  class FifoSrcRegister : public Register
348  {
349  public:
350  FifoSrcRegister(RegisterManager& regManager) : Register(regManager,0x2F, 1, false) { }
351  int fss;
352  int emtpy;
353  int overrunFifo;
354  int watermark;
355 
356  long getValue() { return ((fss & 0x1F) << 0) | ((emtpy & 0x1) << 5) | ((overrunFifo & 0x1) << 6) | ((watermark & 0x1) << 7); }
357  void setValue(long val)
358  {
359  fss = (int)((val >> 0) & 0x1F);
360  emtpy = (int)((val >> 5) & 0x1);
361  overrunFifo = (int)((val >> 6) & 0x1);
362  watermark = (int)((val >> 7) & 0x1);
363  }
364  };
365 
366  class Int1CfgRegister : public Register
367  {
368  public:
369  Int1CfgRegister(RegisterManager& regManager) : Register(regManager,0x30, 1, false) { }
370  int enableXLowEvent;
371  int enableXHighEvent;
372  int enableYLowEvent;
373  int enableYHighEvent;
374  int enableZLowEvent;
375  int enableZHighEvent;
376  int enable6D;
377  int andOrInterruptEvents;
378 
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)
381  {
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);
390  }
391  };
392 
393  class Int1SrcRegister : public Register
394  {
395  public:
396  Int1SrcRegister(RegisterManager& regManager) : Register(regManager,0x31, 1, false) { }
397  int xLow;
398  int xHigh;
399  int yLow;
400  int yHigh;
401  int zLow;
402  int zHigh;
403  int interruptActive;
404 
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)
407  {
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);
415  }
416  };
417 
418  class Int1ThresholdRegister : public Register
419  {
420  public:
421  Int1ThresholdRegister(RegisterManager& regManager) : Register(regManager,0x32, 1, false) { }
422  int value;
423 
424  long getValue() { return ((value & 0x7F) << 0); }
425  void setValue(long val)
426  {
427  value = (int)((val >> 0) & 0x7F);
428  }
429  };
430 
431  class Int1DurationRegister : public Register
432  {
433  public:
434  Int1DurationRegister(RegisterManager& regManager) : Register(regManager,0x33, 1, false) { }
435  int value;
436 
437  long getValue() { return ((value & 0x7F) << 0); }
438  void setValue(long val)
439  {
440  value = (int)((val >> 0) & 0x7F);
441  }
442  };
443 
444  class Int2CfgRegister : public Register
445  {
446  public:
447  Int2CfgRegister(RegisterManager& regManager) : Register(regManager,0x34, 1, false) { }
448  int enableXLowEvent;
449  int enableXHighEvent;
450  int enableYLowEvent;
451  int enableYHighEvent;
452  int enableZLowEvent;
453  int enableZHighEvent;
454  int enable6D;
455  int andOrInterruptEvents;
456 
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)
459  {
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);
468  }
469  };
470 
471  class Int2SrcRegister : public Register
472  {
473  public:
474  Int2SrcRegister(RegisterManager& regManager) : Register(regManager,0x35, 1, false) { }
475  int xLow;
476  int xHigh;
477  int yLow;
478  int yHigh;
479  int zLow;
480  int zHigh;
481  int interruptActive;
482 
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)
485  {
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);
493  }
494  };
495 
496  class Int2ThresholdRegister : public Register
497  {
498  public:
499  Int2ThresholdRegister(RegisterManager& regManager) : Register(regManager,0x36, 1, false) { }
500  int value;
501 
502  long getValue() { return ((value & 0x7F) << 0); }
503  void setValue(long val)
504  {
505  value = (int)((val >> 0) & 0x7F);
506  }
507  };
508 
509  class Int2DurationRegister : public Register
510  {
511  public:
512  Int2DurationRegister(RegisterManager& regManager) : Register(regManager,0x37, 1, false) { }
513  int value;
514 
515  long getValue() { return ((value & 0x7F) << 0); }
516  void setValue(long val)
517  {
518  value = (int)((val >> 0) & 0x7F);
519  }
520  };
521 
522  class ClickSourceRegister : public Register
523  {
524  public:
525  ClickSourceRegister(RegisterManager& regManager) : Register(regManager,0x39, 1, false) { }
526  int x;
527  int y;
528  int z;
529  int sign;
530  int singleClickEnable;
531  int doubleClickEnable;
532  int interruptActive;
533 
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)
536  {
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);
544  }
545  };
546 
547  class ClickThresholdRegister : public Register
548  {
549  public:
550  ClickThresholdRegister(RegisterManager& regManager) : Register(regManager,0x3A, 1, false) { }
551  int threshold;
552  int lirClick;
553 
554  long getValue() { return ((threshold & 0x7F) << 0) | ((lirClick & 0x1) << 7); }
555  void setValue(long val)
556  {
557  threshold = (int)((val >> 0) & 0x7F);
558  lirClick = (int)((val >> 7) & 0x1);
559  }
560  };
561 
562  class TimeLimitRegister : public Register
563  {
564  public:
565  TimeLimitRegister(RegisterManager& regManager) : Register(regManager,0x3B, 1, false) { }
566  int value;
567 
568  long getValue() { return ((value & 0x7F) << 0); }
569  void setValue(long val)
570  {
571  value = (int)((val >> 0) & 0x7F);
572  }
573  };
574 
575  class TimeLatencyRegister : public Register
576  {
577  public:
578  TimeLatencyRegister(RegisterManager& regManager) : Register(regManager,0x3C, 10, false) { }
579  int value;
580 
581  long getValue() { return ((value & 0x7FFF) << 0); }
582  void setValue(long val)
583  {
584  value = (int)((val >> 0) & 0x7FFF);
585  }
586  };
587 
588  class TimeWindowRegister : public Register
589  {
590  public:
591  TimeWindowRegister(RegisterManager& regManager) : Register(regManager,0x3D, 1, false) { }
592  int value;
593 
594  long getValue() { return ((value & 0xFF) << 0); }
595  void setValue(long val)
596  {
597  value = (int)((val >> 0) & 0xFF);
598  }
599  };
600 
601  class ActivationThresholdRegister : public Register
602  {
603  public:
604  ActivationThresholdRegister(RegisterManager& regManager) : Register(regManager,0x3E, 1, false) { }
605  int value;
606 
607  long getValue() { return ((value & 0x7F) << 0); }
608  void setValue(long val)
609  {
610  value = (int)((val >> 0) & 0x7F);
611  }
612  };
613 
614  class ActivationDurationRegister : public Register
615  {
616  public:
617  ActivationDurationRegister(RegisterManager& regManager) : Register(regManager,0x3F, 1, false) { }
618  int value;
619 
620  long getValue() { return ((value & 0xFF) << 0); }
621  void setValue(long val)
622  {
623  value = (int)((val >> 0) & 0xFF);
624  }
625  };
626 
627  class Ctrl1Register : public Register
628  {
629  public:
630  Ctrl1Register(RegisterManager& regManager) : Register(regManager,0xA0, 1, false) { }
631  int xAxisEnable;
632  int yAxisEnable;
633  int zAxisEnable;
634  int lowPowerEnable;
635  int outputDataRate;
636  OutputDataRates getOutputDataRate() { return (OutputDataRates)outputDataRate; }
637  void setOutputDataRate(OutputDataRates enumVal) { outputDataRate = (int)enumVal; }
638 
639  long getValue() { return ((xAxisEnable & 0x1) << 0) | ((yAxisEnable & 0x1) << 1) | ((zAxisEnable & 0x1) << 2) | ((lowPowerEnable & 0x1) << 3) | ((outputDataRate & 0xF) << 4); }
640  void setValue(long val)
641  {
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);
647  }
648  };
649 
650  class OutXRegister : public Register
651  {
652  public:
653  OutXRegister(RegisterManager& regManager) : Register(regManager,0xA8, 2, false) { }
654  int value;
655 
656  long getValue() { return ((value & 0x3FF) << 6); }
657  void setValue(long val)
658  {
659  value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
660  }
661  };
662 
663  class OutYRegister : public Register
664  {
665  public:
666  OutYRegister(RegisterManager& regManager) : Register(regManager,0xAA, 2, false) { }
667  int value;
668 
669  long getValue() { return ((value & 0x3FF) << 6); }
670  void setValue(long val)
671  {
672  value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
673  }
674  };
675 
676  class OutZRegister : public Register
677  {
678  public:
679  OutZRegister(RegisterManager& regManager) : Register(regManager,0xAC, 2, false) { }
680  int value;
681 
682  long getValue() { return ((value & 0x3FF) << 6); }
683  void setValue(long val)
684  {
685  value = (int)(((val >> 6) & 0x3FF) << (32 - 10)) >> (32 - 10);
686  }
687  };
688 
689  StatusRegAuxRegister statusRegAux;
690  OutAdc1Register outAdc1;
691  OutAdc2Register outAdc2;
692  OutAdc3Register outAdc3;
693  WhoAmIRegister whoAmI;
694  Ctrl0Register ctrl0;
695  TempCfgRegRegister tempCfgReg;
696  Ctrl2Register ctrl2;
697  Ctrl3Register ctrl3;
698  Ctrl4Register ctrl4;
699  Ctrl5Register ctrl5;
700  Ctrl6Register ctrl6;
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;
720  Ctrl1Register ctrl1;
721  OutXRegister outX;
722  OutYRegister outY;
723  OutZRegister outZ;
724 
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)
726  {
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);
762  }
763  };
764  } } } }
FullScaleSelections
Definition: Lis3dhRegisters.h:26
Definition: Dm632.h:9
Definition: Register.h:11
Definition: RegisterManager.h:10
FifoModes
Definition: L3gd20Registers.h:20
SdoPuDiscs
Definition: Lis3dhRegisters.h:12
OutputDataRates
Definition: Lis3dhRegisters.h:42
Definition: AdcPin.h:3
HighPassFilterModeSelections
Definition: Lis3dhRegisters.h:18