EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
em_lesense.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef EM_LESENSE_H
34 #define EM_LESENSE_H
35 
36 #include "em_device.h"
37 
38 #if defined(LESENSE_COUNT) && (LESENSE_COUNT > 0)
39 #include <stdint.h>
40 #include <stdbool.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 /***************************************************************************/
52 /***************************************************************************/
58 #define LESENSE_NUM_DECODER_STATES (_LESENSE_DECSTATE_DECSTATE_MASK + 1)
59 
61 #define LESENSE_NUM_CHANNELS 16
62 
63 /*******************************************************************************
64  ******************************** ENUMS ************************************
65  ******************************************************************************/
66 
71 typedef enum
72 {
73  lesenseClkDiv_1 = 0,
74  lesenseClkDiv_2 = 1,
75  lesenseClkDiv_4 = 2,
76  lesenseClkDiv_8 = 3,
77  lesenseClkDiv_16 = 4,
78  lesenseClkDiv_32 = 5,
79  lesenseClkDiv_64 = 6,
80  lesenseClkDiv_128 = 7
81 } LESENSE_ClkPresc_TypeDef;
82 
83 
85 typedef enum
86 {
88  lesenseScanStartPeriodic = LESENSE_CTRL_SCANMODE_PERIODIC,
89 
91  lesenseScanStartOneShot = LESENSE_CTRL_SCANMODE_ONESHOT,
92 
94  lesenseScanStartPRS = LESENSE_CTRL_SCANMODE_PRS
95 } LESENSE_ScanMode_TypeDef;
96 
97 
101 typedef enum
102 {
103  lesensePRSCh0 = 0,
104  lesensePRSCh1 = 1,
105  lesensePRSCh2 = 2,
106  lesensePRSCh3 = 3,
107 #if defined( LESENSE_CTRL_PRSSEL_PRSCH4 )
108  lesensePRSCh4 = 4,
109 #endif
110 #if defined( LESENSE_CTRL_PRSSEL_PRSCH5 )
111  lesensePRSCh5 = 5,
112 #endif
113 #if defined( LESENSE_CTRL_PRSSEL_PRSCH6 )
114  lesensePRSCh6 = 6,
115 #endif
116 #if defined( LESENSE_CTRL_PRSSEL_PRSCH7 )
117  lesensePRSCh7 = 7,
118 #endif
119 #if defined( LESENSE_CTRL_PRSSEL_PRSCH8 )
120  lesensePRSCh8 = 8,
121 #endif
122 #if defined( LESENSE_CTRL_PRSSEL_PRSCH9 )
123  lesensePRSCh9 = 9,
124 #endif
125 #if defined( LESENSE_CTRL_PRSSEL_PRSCH10 )
126  lesensePRSCh10 = 10,
127 #endif
128 #if defined( LESENSE_CTRL_PRSSEL_PRSCH11 )
129  lesensePRSCh11 = 11,
130 #endif
131 } LESENSE_PRSSel_TypeDef;
132 
133 
135 typedef enum
136 {
138  lesenseAltExMapALTEX = _LESENSE_CTRL_ALTEXMAP_ALTEX,
139 
140 #if defined(_LESENSE_CTRL_ALTEXMAP_ACMP)
141 
142  lesenseAltExMapACMP = _LESENSE_CTRL_ALTEXMAP_ACMP,
143 #endif
144 
145 #if defined(_LESENSE_CTRL_ALTEXMAP_CH)
146 
148  lesenseAltExMapCH = _LESENSE_CTRL_ALTEXMAP_CH,
149 #endif
150 } LESENSE_AltExMap_TypeDef;
151 
152 
154 typedef enum
155 {
157  lesenseBufTrigHalf = LESENSE_CTRL_BUFIDL_HALFFULL,
158 
160  lesenseBufTrigFull = LESENSE_CTRL_BUFIDL_FULL
161 } LESENSE_BufTrigLevel_TypeDef;
162 
163 
165 typedef enum
166 {
168  lesenseDMAWakeUpDisable = LESENSE_CTRL_DMAWU_DISABLE,
169 
171  lesenseDMAWakeUpBufValid = LESENSE_CTRL_DMAWU_BUFDATAV,
172 
176  lesenseDMAWakeUpBufLevel = LESENSE_CTRL_DMAWU_BUFLEVEL
177 } LESENSE_DMAWakeUp_TypeDef;
178 
179 
181 typedef enum
182 {
184  lesenseBiasModeDutyCycle = LESENSE_BIASCTRL_BIASMODE_DUTYCYCLE,
185 
187  lesenseBiasModeHighAcc = LESENSE_BIASCTRL_BIASMODE_HIGHACC,
188 
190  lesenseBiasModeDontTouch = LESENSE_BIASCTRL_BIASMODE_DONTTOUCH
191 } LESENSE_BiasMode_TypeDef;
192 
193 
195 typedef enum
196 {
199  lesenseScanConfDirMap = LESENSE_CTRL_SCANCONF_DIRMAP,
200 
203  lesenseScanConfInvMap = LESENSE_CTRL_SCANCONF_INVMAP,
204 
207  lesenseScanConfToggle = LESENSE_CTRL_SCANCONF_TOGGLE,
208 
211  lesenseScanConfDecDef = LESENSE_CTRL_SCANCONF_DECDEF
212 } LESENSE_ScanConfSel_TypeDef;
213 
214 
216 typedef enum
217 {
220  lesenseDACIfData = _LESENSE_PERCTRL_DACCH0DATA_DACDATA,
221 
222 #if defined(_LESENSE_PERCTRL_DACCH0DATA_ACMPTHRES)
223 
225  lesenseACMPThres = _LESENSE_PERCTRL_DACCH0DATA_ACMPTHRES,
226 #endif
227 
228 #if defined(_LESENSE_PERCTRL_DACCH0DATA_THRES)
229 
231  lesenseThres = _LESENSE_PERCTRL_DACCH0DATA_THRES,
232 #endif
233 } LESENSE_ControlDACData_TypeDef;
234 
235 #if defined(_LESENSE_PERCTRL_DACCH0CONV_MASK)
236 
237 typedef enum
238 {
241  lesenseDACConvModeDisable = _LESENSE_PERCTRL_DACCH0CONV_DISABLE,
242 
245  lesenseDACConvModeContinuous = _LESENSE_PERCTRL_DACCH0CONV_CONTINUOUS,
246 
249  lesenseDACConvModeSampleHold = _LESENSE_PERCTRL_DACCH0CONV_SAMPLEHOLD,
250 
253  lesenseDACConvModeSampleOff = _LESENSE_PERCTRL_DACCH0CONV_SAMPLEOFF
254 } LESENSE_ControlDACConv_TypeDef;
255 #endif
256 
257 #if defined(_LESENSE_PERCTRL_DACCH0OUT_MASK)
258 
259 typedef enum
260 {
263  lesenseDACOutModeDisable = _LESENSE_PERCTRL_DACCH0OUT_DISABLE,
264 
267  lesenseDACOutModePin = _LESENSE_PERCTRL_DACCH0OUT_PIN,
268 
271  lesenseDACOutModeADCACMP = _LESENSE_PERCTRL_DACCH0OUT_ADCACMP,
272 
275  lesenseDACOutModePinADCACMP = _LESENSE_PERCTRL_DACCH0OUT_PINADCACMP
276 } LESENSE_ControlDACOut_TypeDef;
277 #endif
278 
279 
280 #if defined(_LESENSE_PERCTRL_DACREF_MASK)
281 
282 typedef enum
283 {
285  lesenseDACRefVdd = LESENSE_PERCTRL_DACREF_VDD,
286 
288  lesenseDACRefBandGap = LESENSE_PERCTRL_DACREF_BANDGAP
289 } LESENSE_DACRef_TypeDef;
290 #endif
291 
292 
294 typedef enum
295 {
298  lesenseACMPModeDisable = _LESENSE_PERCTRL_ACMP0MODE_DISABLE,
299 
302  lesenseACMPModeMux = _LESENSE_PERCTRL_ACMP0MODE_MUX,
303 
306  lesenseACMPModeMuxThres = _LESENSE_PERCTRL_ACMP0MODE_MUXTHRES
307 } LESENSE_ControlACMP_TypeDef;
308 
309 
311 typedef enum
312 {
314  lesenseWarmupModeNormal = LESENSE_PERCTRL_WARMUPMODE_NORMAL,
315 
317  lesenseWarmupModeACMP = LESENSE_PERCTRL_WARMUPMODE_KEEPACMPWARM,
318 
320  lesenseWarmupModeDAC = LESENSE_PERCTRL_WARMUPMODE_KEEPDACWARM,
321 
323  lesenseWarmupModeKeepWarm = LESENSE_PERCTRL_WARMUPMODE_KEEPACMPDACWARM
324 } LESENSE_WarmupMode_TypeDef;
325 
326 
328 typedef enum
329 {
331  lesenseDecInputSensorSt = LESENSE_DECCTRL_INPUT_SENSORSTATE,
332 
334  lesenseDecInputPRS = LESENSE_DECCTRL_INPUT_PRS
335 } LESENSE_DecInput_TypeDef;
336 
337 
339 typedef enum
340 {
342  lesenseSampleModeCounter = 0x0 << _LESENSE_CH_INTERACT_SAMPLE_SHIFT,
343 
345  lesenseSampleModeACMP = LESENSE_CH_INTERACT_SAMPLE_ACMP,
346 
347 #if defined(LESENSE_CH_INTERACT_SAMPLE_ADC)
348 
349  lesenseSampleModeADC = LESENSE_CH_INTERACT_SAMPLE_ADC,
350 
352  lesenseSampleModeADCDiff = LESENSE_CH_INTERACT_SAMPLE_ADCDIFF,
353 #endif
354 } LESENSE_ChSampleMode_TypeDef;
355 
356 
358 typedef enum
359 {
361  lesenseSetIntNone = LESENSE_CH_INTERACT_SETIF_NONE,
362 
364  lesenseSetIntLevel = LESENSE_CH_INTERACT_SETIF_LEVEL,
365 
367  lesenseSetIntPosEdge = LESENSE_CH_INTERACT_SETIF_POSEDGE,
368 
370  lesenseSetIntNegEdge = LESENSE_CH_INTERACT_SETIF_NEGEDGE
371 } LESENSE_ChIntMode_TypeDef;
372 
373 
375 typedef enum
376 {
378  lesenseChPinExDis = LESENSE_CH_INTERACT_EXMODE_DISABLE,
379 
381  lesenseChPinExHigh = LESENSE_CH_INTERACT_EXMODE_HIGH,
382 
384  lesenseChPinExLow = LESENSE_CH_INTERACT_EXMODE_LOW,
385 
387  lesenseChPinExDACOut = LESENSE_CH_INTERACT_EXMODE_DACOUT
388 } LESENSE_ChPinExMode_TypeDef;
389 
390 
392 typedef enum
393 {
396  lesenseChPinIdleDis = _LESENSE_IDLECONF_CH0_DISABLE,
397 
400  lesenseChPinIdleHigh = _LESENSE_IDLECONF_CH0_HIGH,
401 
404  lesenseChPinIdleLow = _LESENSE_IDLECONF_CH0_LOW,
405 
406 #if defined(_LESENSE_IDLECONF_CH0_DAC)
407 
409  lesenseChPinIdleDACC = _LESENSE_IDLECONF_CH0_DAC
410 #else
411 
413  lesenseChPinIdleDACCh0 = _LESENSE_IDLECONF_CH0_DACCH0,
414 
417  lesenseChPinIdleDACCh1 = _LESENSE_IDLECONF_CH12_DACCH1,
418 #endif
419 } LESENSE_ChPinIdleMode_TypeDef;
420 
421 
423 typedef enum
424 {
426  lesenseClkLF = _LESENSE_CH_INTERACT_EXCLK_LFACLK,
427 
429  lesenseClkHF = _LESENSE_CH_INTERACT_EXCLK_AUXHFRCO
430 } LESENSE_ChClk_TypeDef;
431 
432 
434 typedef enum
435 {
438  lesenseCompModeLess = LESENSE_CH_EVAL_COMP_LESS,
439 
442  lesenseCompModeGreaterOrEq = LESENSE_CH_EVAL_COMP_GE
443 } LESENSE_ChCompMode_TypeDef;
444 
445 
446 #if defined(_LESENSE_CH_EVAL_MODE_MASK)
447 
448 typedef enum
449 {
455  lesenseEvalModeThreshold = _LESENSE_CH_EVAL_MODE_THRES,
456 
460  lesenseEvalModeSlidingWindow = _LESENSE_CH_EVAL_MODE_SLIDINGWIN,
461 
468  lesenseEvalModeStepDetection = _LESENSE_CH_EVAL_MODE_STEPDET,
469 } LESENSE_ChEvalMode_TypeDef;
470 #endif
471 
472 
474 typedef enum
475 {
478  lesenseAltExPinIdleDis = _LESENSE_ALTEXCONF_IDLECONF0_DISABLE,
479 
482  lesenseAltExPinIdleHigh = _LESENSE_ALTEXCONF_IDLECONF0_HIGH,
483 
486  lesenseAltExPinIdleLow = _LESENSE_ALTEXCONF_IDLECONF0_LOW
487 } LESENSE_AltExPinIdle_TypeDef;
488 
489 
491 typedef enum
492 {
495  lesenseTransActNone = LESENSE_ST_TCONFA_PRSACT_NONE,
496 
498  lesenseTransActPRS0 = LESENSE_ST_TCONFA_PRSACT_PRS0,
499 
501  lesenseTransActPRS1 = LESENSE_ST_TCONFA_PRSACT_PRS1,
502 
504  lesenseTransActPRS01 = LESENSE_ST_TCONFA_PRSACT_PRS01,
505 
507  lesenseTransActPRS2 = LESENSE_ST_TCONFA_PRSACT_PRS2,
508 
510  lesenseTransActPRS02 = LESENSE_ST_TCONFA_PRSACT_PRS02,
511 
513  lesenseTransActPRS12 = LESENSE_ST_TCONFA_PRSACT_PRS12,
514 
516  lesenseTransActPRS012 = LESENSE_ST_TCONFA_PRSACT_PRS012,
517 
519  lesenseTransActUp = LESENSE_ST_TCONFA_PRSACT_UP,
520 
522  lesenseTransActDown = LESENSE_ST_TCONFA_PRSACT_DOWN,
523 
525  lesenseTransActUpAndPRS2 = LESENSE_ST_TCONFA_PRSACT_UPANDPRS2,
526 
528  lesenseTransActDownAndPRS2 = LESENSE_ST_TCONFA_PRSACT_DOWNANDPRS2
529 } LESENSE_StTransAct_TypeDef;
530 
531 
532 /*******************************************************************************
533  ******************************* STRUCTS ***********************************
534  ******************************************************************************/
535 
537 typedef struct
538 {
540  LESENSE_ScanMode_TypeDef scanStart;
541 
543  LESENSE_PRSSel_TypeDef prsSel;
544 
546  LESENSE_ScanConfSel_TypeDef scanConfSel;
547 
549  bool invACMP0;
550 
552  bool invACMP1;
553 
555  bool dualSample;
556 
559  bool storeScanRes;
560 
563  bool bufOverWr;
564 
566  LESENSE_BufTrigLevel_TypeDef bufTrigLevel;
567 
569  LESENSE_DMAWakeUp_TypeDef wakeupOnDMA;
570 
572  LESENSE_BiasMode_TypeDef biasMode;
573 
575  bool debugRun;
576 } LESENSE_CoreCtrlDesc_TypeDef;
577 
579 #define LESENSE_CORECTRL_DESC_DEFAULT \
580 { \
581  lesenseScanStartPeriodic, /* Start new scan each time the period counter overflows. */ \
582  lesensePRSCh0, /* Default PRS channel is selected. */ \
583  lesenseScanConfDirMap, /* Direct mapping SCANCONF register usage strategy. */ \
584  false, /* Don't invert ACMP0 output. */ \
585  false, /* Don't invert ACMP1 output. */ \
586  false, /* Disable dual sampling. */ \
587  true, /* Store scan result after each scan. */ \
588  true, /* Overwrite result buffer register even if it is full. */ \
589  lesenseBufTrigHalf, /* Trigger interrupt and DMA request if result buffer is half full. */ \
590  lesenseDMAWakeUpDisable, /* Don't wake up on DMA from EM2. */ \
591  lesenseBiasModeDontTouch, /* Don't touch bias configuration. */ \
592  true /* Keep LESENSE running in debug mode. */ \
593 }
594 
596 typedef struct
597 {
600  uint8_t startDelay;
601 
606  bool delayAuxStartup;
607 } LESENSE_TimeCtrlDesc_TypeDef;
608 
610 #define LESENSE_TIMECTRL_DESC_DEFAULT \
611 { \
612  0U, /* No sensor interaction delay. */ \
613  false /* Don't delay the AUXHFRCO startup. */ \
614 }
615 
616 
618 typedef struct
619 {
621  LESENSE_ControlDACData_TypeDef dacCh0Data;
622 
623 #if defined(_LESENSE_PERCTRL_DACCH0CONV_MASK)
624 
625  LESENSE_ControlDACConv_TypeDef dacCh0ConvMode;
626 
628  LESENSE_ControlDACOut_TypeDef dacCh0OutMode;
629 #endif
630 
632  LESENSE_ControlDACData_TypeDef dacCh1Data;
633 
634 #if defined(_LESENSE_PERCTRL_DACCH1CONV_MASK)
635 
636  LESENSE_ControlDACConv_TypeDef dacCh1ConvMode;
637 
639  LESENSE_ControlDACOut_TypeDef dacCh1OutMode;
640 #endif
641 
642 #if defined(_LESENSE_PERCTRL_DACPRESC_MASK)
643 
645  uint8_t dacPresc;
646 #endif
647 
648 #if defined(_LESENSE_PERCTRL_DACREF_MASK)
649 
651  LESENSE_DACRef_TypeDef dacRef;
652 #endif
653 
655  LESENSE_ControlACMP_TypeDef acmp0Mode;
656 
658  LESENSE_ControlACMP_TypeDef acmp1Mode;
659 
661  LESENSE_WarmupMode_TypeDef warmupMode;
662 
663 #if defined(_LESENSE_PERCTRL_DACCONVTRIG_MASK)
664 
666  bool dacScan;
667 #endif
668 } LESENSE_PerCtrlDesc_TypeDef;
669 
671 #if defined(_SILICON_LABS_32B_SERIES_0)
672 #define LESENSE_PERCTRL_DESC_DEFAULT \
673 { \
674  lesenseDACIfData, /* DAC channel 0 data is defined by DAC_CH0DATA register */ \
675  lesenseDACConvModeDisable, /* LESENSE does not control DAC CH0. */ \
676  lesenseDACOutModeDisable, /* DAC channel 0 output to pin disabled. */ \
677  lesenseDACIfData, /* DAC channel 1 data is defined by DAC_CH1DATA register */ \
678  lesenseDACConvModeDisable, /* LESENSE does not control DAC CH1. */ \
679  lesenseDACOutModeDisable, /* DAC channel 1 output to pin disabled. */ \
680  0U, /* DAC prescaling factor of 1 (0+1). */ \
681  lesenseDACRefVdd, /* DAC uses VDD reference. */ \
682  lesenseACMPModeMuxThres, /* LESENSE controls the input mux and the threshold value of ACMP0. */ \
683  lesenseACMPModeMuxThres, /* LESENSE controls the input mux and the threshold value of ACMP1. */ \
684  lesenseWarmupModeKeepWarm, /* Keep both ACMPs and the DAC powered up when LESENSE is idle. */ \
685 }
686 #else
687 #define LESENSE_PERCTRL_DESC_DEFAULT \
688 { \
689  lesenseDACIfData, /* DAC channel 0 data is defined by DAC_CH0DATA register. */ \
690  lesenseDACIfData, /* DAC channel 1 data is defined by DAC_CH1DATA register. */ \
691  lesenseACMPModeMuxThres, /* LESENSE controls the input mux and the threshold value of ACMP0. */ \
692  lesenseACMPModeMuxThres, /* LESENSE controls the input mux and the threshold value of ACMP1. */ \
693  lesenseWarmupModeKeepWarm, /* Keep both ACMPs and the DAC powered up when LESENSE is idle. */ \
694  false, /* DAC is enable for before every channel measurement. */ \
695 }
696 #endif
697 
699 typedef struct
700 {
702  LESENSE_DecInput_TypeDef decInput;
703 
705  uint32_t initState;
706 
709  bool chkState;
710 
713  bool intMap;
714 
717  bool hystPRS0;
718 
721  bool hystPRS1;
722 
725  bool hystPRS2;
726 
729  bool hystIRQ;
730 
733  bool prsCount;
734 
736  LESENSE_PRSSel_TypeDef prsChSel0;
737 
739  LESENSE_PRSSel_TypeDef prsChSel1;
740 
742  LESENSE_PRSSel_TypeDef prsChSel2;
743 
745  LESENSE_PRSSel_TypeDef prsChSel3;
746 } LESENSE_DecCtrlDesc_TypeDef;
747 
749 #define LESENSE_DECCTRL_DESC_DEFAULT \
750 { \
751  lesenseDecInputSensorSt, /* The SENSORSTATE register is used as input to the decoder. */ \
752  0U, /* State 0 is the initial state of the decoder. */ \
753  false, /* Disable check of current state. */ \
754  true, /* Enable channel x % 16 interrupt on state x change. */ \
755  true, /* Enable decoder hysteresis on PRS0 output. */ \
756  true, /* Enable decoder hysteresis on PRS1 output. */ \
757  true, /* Enable decoder hysteresis on PRS2 output. */ \
758  true, /* Enable decoder hysteresis on PRS3 output. */ \
759  false, /* Disable count mode on decoder PRS channels 0 and 1*/ \
760  lesensePRSCh0, /* PRS Channel 0 as input for bit 0 of the LESENSE decoder. */ \
761  lesensePRSCh1, /* PRS Channel 1 as input for bit 1 of the LESENSE decoder. */ \
762  lesensePRSCh2, /* PRS Channel 2 as input for bit 2 of the LESENSE decoder. */ \
763  lesensePRSCh3, /* PRS Channel 3 as input for bit 3 of the LESENSE decoder. */ \
764 }
765 
766 
768 typedef struct
769 {
771  LESENSE_CoreCtrlDesc_TypeDef coreCtrl;
772 
774  LESENSE_TimeCtrlDesc_TypeDef timeCtrl;
775 
777  LESENSE_PerCtrlDesc_TypeDef perCtrl;
778 
780  LESENSE_DecCtrlDesc_TypeDef decCtrl;
781 } LESENSE_Init_TypeDef;
782 
784 #define LESENSE_INIT_DEFAULT \
785 { \
786  .coreCtrl = LESENSE_CORECTRL_DESC_DEFAULT, /* Default core control parameters. */ \
787  .timeCtrl = LESENSE_TIMECTRL_DESC_DEFAULT, /* Default time control parameters. */ \
788  .perCtrl = LESENSE_PERCTRL_DESC_DEFAULT, /* Default peripheral control parameters. */ \
789  .decCtrl = LESENSE_DECCTRL_DESC_DEFAULT /* Default decoder control parameters. */ \
790 }
791 
792 
794 typedef struct
795 {
797  bool enaScanCh;
798 
800  bool enaPin;
801 
804  bool enaInt;
805 
808  LESENSE_ChPinExMode_TypeDef chPinExMode;
809 
811  LESENSE_ChPinIdleMode_TypeDef chPinIdleMode;
812 
814  bool useAltEx;
815 
818  bool shiftRes;
819 
821  bool invRes;
822 
825  bool storeCntRes;
826 
828  LESENSE_ChClk_TypeDef exClk;
829 
831  LESENSE_ChClk_TypeDef sampleClk;
832 
835  uint8_t exTime;
836 
840  uint8_t sampleDelay;
841 
845  uint16_t measDelay;
846 
856  uint16_t acmpThres;
857 
860  LESENSE_ChSampleMode_TypeDef sampleMode;
861 
863  LESENSE_ChIntMode_TypeDef intMode;
864 
867  uint16_t cntThres;
868 
870  LESENSE_ChCompMode_TypeDef compMode;
871 
872 #if defined(_LESENSE_CH_EVAL_MODE_MASK)
873 
874  LESENSE_ChEvalMode_TypeDef evalMode;
875 #endif
876 
877 } LESENSE_ChDesc_TypeDef;
878 
879 
881 typedef struct
882 {
884  LESENSE_ChDesc_TypeDef Ch[LESENSE_NUM_CHANNELS];
885 } LESENSE_ChAll_TypeDef;
886 
888 #if defined(_LESENSE_CH_EVAL_MODE_MASK)
889 #define LESENSE_CH_CONF_DEFAULT \
890 { \
891  true, /* Enable scan channel. */ \
892  true, /* Enable the assigned pin on scan channel. */ \
893  true, /* Enable interrupts on channel. */ \
894  lesenseChPinExHigh, /* Channel pin is high during the excitation period. */ \
895  lesenseChPinIdleLow, /* Channel pin is low during the idle period. */ \
896  false, /* Don't use alternate excitation pins for excitation. */ \
897  false, /* Disabled to shift results from this channel to the decoder register. */ \
898  false, /* Disabled to invert the scan result bit. */ \
899  false, /* Disabled to store counter value in the result buffer. */ \
900  lesenseClkLF, /* Use the LF clock for excitation timing. */ \
901  lesenseClkLF, /* Use the LF clock for sample timing. */ \
902  0x03U, /* Excitation time is set to 3(+1) excitation clock cycles. */ \
903  0x09U, /* Sample delay is set to 9(+1) sample clock cycles. */ \
904  0x06U, /* Measure delay is set to 6 excitation clock cycles.*/ \
905  0x00U, /* ACMP threshold has been set to 0. */ \
906  lesenseSampleModeACMP, /* ACMP output will be used in comparison. */ \
907  lesenseSetIntNone, /* No interrupt is generated by the channel. */ \
908  0xFFU, /* Counter threshold has bee set to 0xFF. */ \
909  lesenseCompModeLess, /* Compare mode has been set to trigger interrupt on "less". */ \
910  lesenseEvalModeThreshold /* Compare mode has been set to trigger interrupt on "less". */ \
911 }
912 #else
913 #define LESENSE_CH_CONF_DEFAULT \
914 { \
915  true, /* Enable scan channel. */ \
916  true, /* Enable the assigned pin on scan channel. */ \
917  true, /* Enable interrupts on channel. */ \
918  lesenseChPinExHigh, /* Channel pin is high during the excitation period. */ \
919  lesenseChPinIdleLow, /* Channel pin is low during the idle period. */ \
920  false, /* Don't use alternate excitation pins for excitation. */ \
921  false, /* Disabled to shift results from this channel to the decoder register. */ \
922  false, /* Disabled to invert the scan result bit. */ \
923  false, /* Disabled to store counter value in the result buffer. */ \
924  lesenseClkLF, /* Use the LF clock for excitation timing. */ \
925  lesenseClkLF, /* Use the LF clock for sample timing. */ \
926  0x03U, /* Excitation time is set to 3(+1) excitation clock cycles. */ \
927  0x09U, /* Sample delay is set to 9(+1) sample clock cycles. */ \
928  0x06U, /* Measure delay is set to 6 excitation clock cycles.*/ \
929  0x00U, /* ACMP threshold has been set to 0. */ \
930  lesenseSampleModeACMP, /* ACMP output will be used in comparison. */ \
931  lesenseSetIntNone, /* No interrupt is generated by the channel. */ \
932  0xFFU, /* Counter threshold has bee set to 0xFF. */ \
933  lesenseCompModeLess /* Compare mode has been set to trigger interrupt on "less". */ \
934 }
935 #endif
936 
937 
939 #define LESENSE_SCAN_CONF_DEFAULT \
940 { \
941  { \
942  LESENSE_CH_CONF_DEFAULT, /* Scan channel 0. */ \
943  LESENSE_CH_CONF_DEFAULT, /* Scan channel 1. */ \
944  LESENSE_CH_CONF_DEFAULT, /* Scan channel 2. */ \
945  LESENSE_CH_CONF_DEFAULT, /* Scan channel 3. */ \
946  LESENSE_CH_CONF_DEFAULT, /* Scan channel 4. */ \
947  LESENSE_CH_CONF_DEFAULT, /* Scan channel 5. */ \
948  LESENSE_CH_CONF_DEFAULT, /* Scan channel 6. */ \
949  LESENSE_CH_CONF_DEFAULT, /* Scan channel 7. */ \
950  LESENSE_CH_CONF_DEFAULT, /* Scan channel 8. */ \
951  LESENSE_CH_CONF_DEFAULT, /* Scan channel 9. */ \
952  LESENSE_CH_CONF_DEFAULT, /* Scan channel 10. */ \
953  LESENSE_CH_CONF_DEFAULT, /* Scan channel 11. */ \
954  LESENSE_CH_CONF_DEFAULT, /* Scan channel 12. */ \
955  LESENSE_CH_CONF_DEFAULT, /* Scan channel 13. */ \
956  LESENSE_CH_CONF_DEFAULT, /* Scan channel 14. */ \
957  LESENSE_CH_CONF_DEFAULT, /* Scan channel 15. */ \
958  } \
959 }
960 
961 
963 typedef struct
964 {
967  bool enablePin;
968 
971  LESENSE_AltExPinIdle_TypeDef idleConf;
972 
980  bool alwaysEx;
981 } LESENSE_AltExDesc_TypeDef;
982 
983 
985 typedef struct
986 {
988  LESENSE_AltExMap_TypeDef altExMap;
989 
1002  LESENSE_AltExDesc_TypeDef AltEx[16];
1003 
1004 } LESENSE_ConfAltEx_TypeDef;
1005 
1006 
1008 #define LESENSE_ALTEX_CH_CONF_DEFAULT \
1009 { \
1010  true, /* Alternate excitation enabled.*/ \
1011  lesenseAltExPinIdleDis,/* Alternate excitation pin is disabled in idle. */ \
1012  false /* Excite only for corresponding channel. */ \
1013 }
1014 
1016 #if defined(_LESENSE_CTRL_ALTEXMAP_ACMP)
1017 #define LESENSE_ALTEX_CONF_DEFAULT \
1018 { \
1019  lesenseAltExMapACMP, \
1020  { \
1021  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 0. */ \
1022  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 1. */ \
1023  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 2. */ \
1024  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 3. */ \
1025  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 4. */ \
1026  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 5. */ \
1027  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 6. */ \
1028  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 7. */ \
1029  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 8. */ \
1030  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 9. */ \
1031  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 10. */ \
1032  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 11. */ \
1033  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 12. */ \
1034  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 13. */ \
1035  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 14. */ \
1036  LESENSE_ALTEX_CH_CONF_DEFAULT /* Alternate excitation channel 15. */ \
1037  } \
1038 }
1039 #else
1040 #define LESENSE_ALTEX_CONF_DEFAULT \
1041 { \
1042  lesenseAltExMapCH, \
1043  { \
1044  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 0. */ \
1045  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 1. */ \
1046  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 2. */ \
1047  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 3. */ \
1048  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 4. */ \
1049  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 5. */ \
1050  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 6. */ \
1051  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 7. */ \
1052  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 8. */ \
1053  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 9. */ \
1054  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 10. */ \
1055  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 11. */ \
1056  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 12. */ \
1057  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 13. */ \
1058  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 14. */ \
1059  LESENSE_ALTEX_CH_CONF_DEFAULT /* Alternate excitation channel 15. */ \
1060  } \
1061 }
1062 #endif
1063 
1065 typedef struct
1066 {
1069  uint8_t compVal;
1070 
1074  uint8_t compMask;
1075 
1078  uint8_t nextState;
1079 
1082  LESENSE_StTransAct_TypeDef prsAct;
1083 
1085  bool setInt;
1086 } LESENSE_DecStCond_TypeDef;
1087 
1089 #define LESENSE_ST_CONF_DEFAULT \
1090 { \
1091  0x0FU, /* Compare value set to 0x0F. */ \
1092  0x00U, /* All decoder inputs masked. */ \
1093  0U, /* Next state is state 0. */ \
1094  lesenseTransActNone, /* No PRS action performed on compare match. */ \
1095  false /* No interrupt triggered on compare match. */ \
1096 }
1097 
1098 
1100 typedef struct
1101 {
1104  bool chainDesc;
1105 
1108  LESENSE_DecStCond_TypeDef confA;
1109 
1112  LESENSE_DecStCond_TypeDef confB;
1113 } LESENSE_DecStDesc_TypeDef;
1114 
1115 
1117 typedef struct
1118 {
1120  LESENSE_DecStDesc_TypeDef St[LESENSE_NUM_DECODER_STATES];
1121 } LESENSE_DecStAll_TypeDef;
1122 
1124 #if defined(_SILICON_LABS_32B_SERIES_0)
1125 #define LESENSE_DECODER_CONF_DEFAULT \
1126 { /* chain | Descriptor A | Descriptor B */ \
1127  { \
1128  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 0. */ \
1129  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 1. */ \
1130  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 2. */ \
1131  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 3. */ \
1132  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 4. */ \
1133  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 5. */ \
1134  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 6. */ \
1135  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 7. */ \
1136  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 8. */ \
1137  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 9. */ \
1138  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 10. */ \
1139  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 11. */ \
1140  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 12. */ \
1141  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 13. */ \
1142  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 14. */ \
1143  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT } /* Decoder state 15. */ \
1144  } \
1145 }
1146 #else
1147 #define LESENSE_DECODER_CONF_DEFAULT \
1148 { /* chain | Descriptor A | Descriptor B */ \
1149  { \
1150  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 0. */ \
1151  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 1. */ \
1152  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 2. */ \
1153  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 3. */ \
1154  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 4. */ \
1155  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 5. */ \
1156  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 6. */ \
1157  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 7. */ \
1158  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 8. */ \
1159  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 9. */ \
1160  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 10. */ \
1161  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 11. */ \
1162  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 12. */ \
1163  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 13. */ \
1164  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 14. */ \
1165  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 15. */ \
1166  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 16. */ \
1167  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 17. */ \
1168  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 18. */ \
1169  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 19. */ \
1170  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 20. */ \
1171  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 21. */ \
1172  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 22. */ \
1173  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 23. */ \
1174  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 24. */ \
1175  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 25. */ \
1176  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 26. */ \
1177  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 27. */ \
1178  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 28. */ \
1179  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 29. */ \
1180  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 30. */ \
1181  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT } /* Decoder state 31. */ \
1182  } \
1183 }
1184 #endif
1185 
1186 /*******************************************************************************
1187  ***************************** PROTOTYPES **********************************
1188  ******************************************************************************/
1189 void LESENSE_Init(const LESENSE_Init_TypeDef * init, bool reqReset);
1190 void LESENSE_Reset(void);
1191 
1192 uint32_t LESENSE_ScanFreqSet(uint32_t refFreq, uint32_t scanFreq);
1193 void LESENSE_ScanModeSet(LESENSE_ScanMode_TypeDef scanMode, bool start);
1194 void LESENSE_StartDelaySet(uint8_t startDelay);
1195 void LESENSE_ClkDivSet(LESENSE_ChClk_TypeDef clk,
1196  LESENSE_ClkPresc_TypeDef clkDiv);
1197 
1198 void LESENSE_ChannelAllConfig(const LESENSE_ChAll_TypeDef * confChAll);
1199 void LESENSE_ChannelConfig(const LESENSE_ChDesc_TypeDef * confCh,
1200  uint32_t chIdx);
1201 void LESENSE_ChannelEnable(uint8_t chIdx,
1202  bool enaScanCh,
1203  bool enaPin);
1204 void LESENSE_ChannelEnableMask(uint16_t chMask, uint16_t pinMask);
1205 void LESENSE_ChannelTimingSet(uint8_t chIdx,
1206  uint8_t exTime,
1207  uint8_t sampleDelay,
1208  uint16_t measDelay);
1209 void LESENSE_ChannelThresSet(uint8_t chIdx,
1210  uint16_t acmpThres,
1211  uint16_t cntThres);
1212 #if defined(_LESENSE_CH_EVAL_MODE_MASK)
1213 void LESENSE_ChannelSlidingWindow(uint8_t chIdx,
1214  uint32_t windowSize,
1215  uint32_t initValue);
1216 void LESENSE_ChannelStepDetection(uint8_t chIdx,
1217  uint32_t stepSize,
1218  uint32_t initValue);
1219 void LESENSE_WindowSizeSet(uint32_t windowSize);
1220 void LESENSE_StepSizeSet(uint32_t stepSize);
1221 #endif
1222 
1223 void LESENSE_AltExConfig(const LESENSE_ConfAltEx_TypeDef * confAltEx);
1224 
1225 void LESENSE_DecoderStateAllConfig(const LESENSE_DecStAll_TypeDef * confDecStAll);
1226 void LESENSE_DecoderStateConfig(const LESENSE_DecStDesc_TypeDef * confDecSt,
1227  uint32_t decSt);
1228 void LESENSE_DecoderStateSet(uint32_t decSt);
1229 uint32_t LESENSE_DecoderStateGet(void);
1230 #if defined(_LESENSE_PRSCTRL_MASK)
1231 void LESENSE_DecoderPrsOut(bool enable, uint32_t decMask, uint32_t decCmp);
1232 #endif
1233 
1234 void LESENSE_ScanStart(void);
1235 void LESENSE_ScanStop(void);
1236 void LESENSE_DecoderStart(void);
1237 void LESENSE_ResultBufferClear(void);
1238 
1239 
1240 /***************************************************************************/
1248 __STATIC_INLINE void LESENSE_DecoderStop(void)
1249 {
1250  /* Stop the decoder */
1251  LESENSE->DECCTRL |= LESENSE_DECCTRL_DISABLE;
1252 }
1253 
1254 
1255 /***************************************************************************/
1269 __STATIC_INLINE uint32_t LESENSE_StatusGet(void)
1270 {
1271  return LESENSE->STATUS;
1272 }
1273 
1274 
1275 /***************************************************************************/
1295 __STATIC_INLINE void LESENSE_StatusWait(uint32_t flag)
1296 {
1297  while (!(LESENSE->STATUS & flag))
1298  ;
1299 }
1300 
1301 
1302 /***************************************************************************/
1310 __STATIC_INLINE uint32_t LESENSE_ChannelActiveGet(void)
1311 {
1312  return LESENSE->CURCH;
1313 }
1314 
1315 
1316 /***************************************************************************/
1327 __STATIC_INLINE uint32_t LESENSE_ScanResultGet(void)
1328 {
1329  return LESENSE->SCANRES & _LESENSE_SCANRES_SCANRES_MASK;
1330 }
1331 
1332 
1333 /***************************************************************************/
1346 __STATIC_INLINE uint32_t LESENSE_ScanResultDataGet(void)
1347 {
1348  return LESENSE->BUFDATA;
1349 }
1350 
1351 
1352 /***************************************************************************/
1367 __STATIC_INLINE uint32_t LESENSE_ScanResultDataBufferGet(uint32_t idx)
1368 {
1369  /* Note: masking is needed to avoid over-indexing! */
1370  return LESENSE->BUF[idx & 0x0FU].DATA;
1371 }
1372 
1373 /***************************************************************************/
1381 __STATIC_INLINE uint32_t LESENSE_SensorStateGet(void)
1382 {
1383  return LESENSE->SENSORSTATE;
1384 }
1385 
1386 
1387 #if defined(LESENSE_POWERDOWN_RAM)
1388 /***************************************************************************/
1400 __STATIC_INLINE void LESENSE_RAMPowerDown(void)
1401 {
1402  /* Power down LESENSE RAM */
1403  LESENSE->POWERDOWN = LESENSE_POWERDOWN_RAM;
1404 }
1405 #endif
1406 
1407 
1408 /***************************************************************************/
1417 __STATIC_INLINE void LESENSE_IntClear(uint32_t flags)
1418 {
1419  LESENSE->IFC = flags;
1420 }
1421 
1422 
1423 /***************************************************************************/
1432 __STATIC_INLINE void LESENSE_IntEnable(uint32_t flags)
1433 {
1434  LESENSE->IEN |= flags;
1435 }
1436 
1437 
1438 /***************************************************************************/
1447 __STATIC_INLINE void LESENSE_IntDisable(uint32_t flags)
1448 {
1449  LESENSE->IEN &= ~flags;
1450 }
1451 
1452 
1453 /***************************************************************************/
1462 __STATIC_INLINE void LESENSE_IntSet(uint32_t flags)
1463 {
1464  LESENSE->IFS = flags;
1465 }
1466 
1467 
1468 /***************************************************************************/
1479 __STATIC_INLINE uint32_t LESENSE_IntGet(void)
1480 {
1481  return LESENSE->IF;
1482 }
1483 
1484 
1485 /***************************************************************************/
1503 __STATIC_INLINE uint32_t LESENSE_IntGetEnabled(void)
1504 {
1505  uint32_t tmp;
1506 
1507  /* Store LESENSE->IEN in temporary variable in order to define explicit order
1508  * of volatile accesses. */
1509  tmp = LESENSE->IEN;
1510 
1511  /* Bitwise AND of pending and enabled interrupts */
1512  return LESENSE->IF & tmp;
1513 }
1514 
1515 
1519 #ifdef __cplusplus
1520 }
1521 #endif
1522 
1523 #endif /* defined(LESENSE_COUNT) && (LESENSE_COUNT > 0) */
1524 
1525 #endif /* EM_LESENSE_H */
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.