EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1
em_lesense.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __SILICON_LABS_EM_LESENSE_H__
34 #define __SILICON_LABS_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 /***************************************************************************/
63 /*******************************************************************************
64  ******************************** ENUMS ************************************
65  ******************************************************************************/
66 
71 typedef enum
72 {
82 
83 
85 typedef enum
86 {
89 
92 
96 
97 
101 typedef enum
102 {
107 #if defined( LESENSE_CTRL_PRSSEL_PRSCH4 )
109 #endif
110 #if defined( LESENSE_CTRL_PRSSEL_PRSCH5 )
112 #endif
113 #if defined( LESENSE_CTRL_PRSSEL_PRSCH6 )
115 #endif
116 #if defined( LESENSE_CTRL_PRSSEL_PRSCH7 )
118 #endif
119 #if defined( LESENSE_CTRL_PRSSEL_PRSCH8 )
121 #endif
122 #if defined( LESENSE_CTRL_PRSSEL_PRSCH9 )
124 #endif
125 #if defined( LESENSE_CTRL_PRSSEL_PRSCH10 )
127 #endif
128 #if defined( LESENSE_CTRL_PRSSEL_PRSCH11 )
130 #endif
132 
133 
135 typedef enum
136 {
139 
143 
144 
146 typedef enum
147 {
150 
154 
155 
157 typedef enum
158 {
161 
164 
170 
171 
173 typedef enum
174 {
177 
180 
184 
185 
187 typedef enum
188 {
192 
196 
200 
205 
206 
208 typedef enum
209 {
213 
218 
219 
221 typedef enum
222 {
226 
230 
234 
239 
240 
242 typedef enum
243 {
247 
251 
255 
260 
261 
263 typedef enum
264 {
267 
271 
272 
274 typedef enum
275 {
279 
283 
288 
289 
291 typedef enum
292 {
295 
298 
301 
305 
306 
308 typedef enum
309 {
312 
316 
317 
319 typedef enum
320 {
323 
327 
328 
330 typedef enum
331 {
334 
337 
340 
344 
345 
347 typedef enum
348 {
351 
354 
357 
361 
362 
364 typedef enum
365 {
369 
373 
377 
381 
386 
387 
389 typedef enum
390 {
393 
397 
398 
400 typedef enum
401 {
405 
410 
411 
413 typedef enum
414 {
418 
422 
427 
428 
430 typedef enum
431 {
435 
438 
441 
444 
447 
450 
453 
456 
459 
462 
465 
469 
470 
471 /*******************************************************************************
472  ******************************* STRUCTS ***********************************
473  ******************************************************************************/
474 
476 typedef struct
477 {
480 
483 
486 
488  bool invACMP0;
489 
491  bool invACMP1;
492 
495 
499 
502  bool bufOverWr;
503 
506 
509 
512 
514  bool debugRun;
516 
518 #define LESENSE_CORECTRL_DESC_DEFAULT \
519 { \
520  lesenseScanStartPeriodic, /* Start new scan each time the period counter overflows. */ \
521  lesensePRSCh0, /* Default PRS channel is selected. */ \
522  lesenseScanConfDirMap, /* Direct mapping SCANCONF register usage strategy. */ \
523  false, /* Don't invert ACMP0 output. */ \
524  false, /* Don't invert ACMP1 output. */ \
525  false, /* Disable dual sampling. */ \
526  true, /* Store scan result after each scan. */ \
527  true, /* Overwrite result buffer register even if it is full. */ \
528  lesenseBufTrigHalf, /* Trigger interrupt and DMA request if result buffer is half full. */ \
529  lesenseDMAWakeUpDisable, /* Don't wake up on DMA from EM2. */ \
530  lesenseBiasModeDontTouch, /* Don't touch bias configuration. */ \
531  true /* Keep LESENSE running in debug mode. */ \
532 }
533 
534 
536 typedef struct
537 {
540  uint8_t startDelay;
542 
544 #define LESENSE_TIMECTRL_DESC_DEFAULT \
545 { \
546  0U /* No sensor interaction delay. */ \
547 }
548 
549 
551 typedef struct
552 {
555 
558 
561 
564 
567 
570 
573  uint8_t dacPresc;
574 
578 
581 
584 
588 
590 #define LESENSE_PERCTRL_DESC_DEFAULT \
591 { \
592  lesenseDACIfData, \
593  lesenseDACConvModeDisable, \
594  lesenseDACOutModeDisable, \
595  lesenseDACIfData, \
596  lesenseDACConvModeDisable, \
597  lesenseDACOutModeDisable, \
598  0U, \
599  lesenseDACRefVdd, \
600  lesenseACMPModeMuxThres, \
601  lesenseACMPModeMuxThres, \
602  lesenseWarmupModeKeepWarm, \
603 }
604 
605 
607 typedef struct
608 {
611 
613  uint32_t initState;
614 
617  bool chkState;
618 
621  bool intMap;
622 
625  bool hystPRS0;
626 
629  bool hystPRS1;
630 
633  bool hystPRS2;
634 
637  bool hystIRQ;
638 
641  bool prsCount;
642 
645 
648 
651 
655 
657 #define LESENSE_DECCTRL_DESC_DEFAULT \
658 { \
659  lesenseDecInputSensorSt, \
660  0U, \
661  false, \
662  true, \
663  true, \
664  true, \
665  true, \
666  true, \
667  false, \
668  lesensePRSCh0, \
669  lesensePRSCh1, \
670  lesensePRSCh2, \
671  lesensePRSCh3, \
672 }
673 
674 
676 typedef struct
677 {
680 
683 
686 
690 
692 #define LESENSE_INIT_DEFAULT \
693 { \
694  .coreCtrl = LESENSE_CORECTRL_DESC_DEFAULT, /* Default core control parameters. */ \
695  .timeCtrl = LESENSE_TIMECTRL_DESC_DEFAULT, /* Default time control parameters. */ \
696  .perCtrl = LESENSE_PERCTRL_DESC_DEFAULT, /* Default peripheral control parameters. */ \
697  .decCtrl = LESENSE_DECCTRL_DESC_DEFAULT /* Default decoder control parameters. */ \
698 }
699 
700 
702 typedef struct
703 {
705  bool enaScanCh;
706 
708  bool enaPin;
709 
712  bool enaInt;
713 
717 
720 
722  bool useAltEx;
723 
726  bool shiftRes;
727 
729  bool invRes;
730 
734 
737 
740 
743  uint8_t exTime;
744 
747  uint8_t sampleDelay;
748 
751  uint8_t measDelay;
752 
762  uint16_t acmpThres;
763 
766 
769 
772  uint16_t cntThres;
773 
777 
778 
780 typedef struct
781 {
785 
787 #define LESENSE_CH_CONF_DEFAULT \
788 { \
789  true, /* Enable scan channel. */ \
790  true, /* Enable the assigned pin on scan channel. */ \
791  true, /* Enable interrupts on channel. */ \
792  lesenseChPinExHigh, /* Channel pin is high during the excitation period. */ \
793  lesenseChPinIdleLow, /* Channel pin is low during the idle period. */ \
794  false, /* Don't use alternate excitation pins for excitation. */ \
795  false, /* Disabled to shift results from this channel to the decoder register. */ \
796  false, /* Disabled to invert the scan result bit. */ \
797  false, /* Disabled to store counter value in the result buffer. */ \
798  lesenseClkLF, /* Use the LF clock for excitation timing. */ \
799  lesenseClkLF, /* Use the LF clock for sample timing. */ \
800  0x03U, /* Excitation time is set to 3(+1) excitation clock cycles. */ \
801  0x09U, /* Sample delay is set to 9(+1) sample clock cycles. */ \
802  0x06U, /* Measure delay is set to 6 excitation clock cycles.*/ \
803  0x00U, /* ACMP threshold has been set to 0. */ \
804  lesenseSampleModeACMP, /* ACMP output will be used in comparison. */ \
805  lesenseSetIntNone, /* No interrupt is generated by the channel. */ \
806  0xFFU, /* Counter threshold has bee set to 0xFF. */ \
807  lesenseCompModeLess /* Compare mode has been set to trigger interrupt on "less". */ \
808 }
809 
811 #define LESENSE_SCAN_CONF_DEFAULT \
812 { \
813  { \
814  LESENSE_CH_CONF_DEFAULT, /* Scan channel 0. */ \
815  LESENSE_CH_CONF_DEFAULT, /* Scan channel 1. */ \
816  LESENSE_CH_CONF_DEFAULT, /* Scan channel 2. */ \
817  LESENSE_CH_CONF_DEFAULT, /* Scan channel 3. */ \
818  LESENSE_CH_CONF_DEFAULT, /* Scan channel 4. */ \
819  LESENSE_CH_CONF_DEFAULT, /* Scan channel 5. */ \
820  LESENSE_CH_CONF_DEFAULT, /* Scan channel 6. */ \
821  LESENSE_CH_CONF_DEFAULT, /* Scan channel 7. */ \
822  LESENSE_CH_CONF_DEFAULT, /* Scan channel 8. */ \
823  LESENSE_CH_CONF_DEFAULT, /* Scan channel 9. */ \
824  LESENSE_CH_CONF_DEFAULT, /* Scan channel 10. */ \
825  LESENSE_CH_CONF_DEFAULT, /* Scan channel 11. */ \
826  LESENSE_CH_CONF_DEFAULT, /* Scan channel 12. */ \
827  LESENSE_CH_CONF_DEFAULT, /* Scan channel 13. */ \
828  LESENSE_CH_CONF_DEFAULT, /* Scan channel 14. */ \
829  LESENSE_CH_CONF_DEFAULT, /* Scan channel 15. */ \
830  } \
831 }
832 
833 
835 typedef struct
836 {
839  bool enablePin;
840 
844 
852  bool alwaysEx;
854 
855 
857 typedef struct
858 {
861 
875 
877 
878 
880 #define LESENSE_ALTEX_CH_CONF_DEFAULT \
881 { \
882  true, /* Alternate excitation enabled.*/ \
883  lesenseAltExPinIdleDis,/* Alternate excitation pin is disabled in idle. */ \
884  false /* Excite only for corresponding channel. */ \
885 }
886 
888 #define LESENSE_ALTEX_CONF_DEFAULT \
889 { \
890  lesenseAltExMapACMP, \
891  { \
892  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 0. */ \
893  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 1. */ \
894  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 2. */ \
895  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 3. */ \
896  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 4. */ \
897  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 5. */ \
898  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 6. */ \
899  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 7. */ \
900  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 8. */ \
901  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 9. */ \
902  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 10. */ \
903  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 11. */ \
904  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 12. */ \
905  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 13. */ \
906  LESENSE_ALTEX_CH_CONF_DEFAULT, /* Alternate excitation channel 14. */ \
907  LESENSE_ALTEX_CH_CONF_DEFAULT /* Alternate excitation channel 15. */ \
908  } \
909 }
910 
911 
913 typedef struct
914 {
917  uint8_t compVal;
918 
922  uint8_t compMask;
923 
926  uint8_t nextState;
927 
931 
933  bool setInt;
935 
937 #define LESENSE_ST_CONF_DEFAULT \
938 { \
939  0x0FU, /* Compare value set to 0x0F. */ \
940  0x00U, /* All decoder inputs masked. */ \
941  0U, /* Next state is state 0. */ \
942  lesenseTransActNone, /* No PRS action performed on compare match. */ \
943  false /* No interrupt triggered on compare match. */ \
944 }
945 
946 
948 typedef struct
949 {
952  bool chainDesc;
953 
957 
962 
963 
965 typedef struct
966 {
970 
972 #define LESENSE_DECODER_CONF_DEFAULT \
973 { /* chain | Descriptor A | Descriptor B */ \
974  { \
975  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 0. */ \
976  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 1. */ \
977  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 2. */ \
978  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 3. */ \
979  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 4. */ \
980  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 5. */ \
981  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 6. */ \
982  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 7. */ \
983  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 8. */ \
984  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 9. */ \
985  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 10. */ \
986  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 11. */ \
987  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 12. */ \
988  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 13. */ \
989  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT }, /* Decoder state 14. */ \
990  { false, LESENSE_ST_CONF_DEFAULT, LESENSE_ST_CONF_DEFAULT } /* Decoder state 15. */ \
991  } \
992 }
993 
994 /*******************************************************************************
995  ***************************** PROTOTYPES **********************************
996  ******************************************************************************/
997 void LESENSE_Init(LESENSE_Init_TypeDef const *init, bool const reqReset);
998 void LESENSE_Reset(void);
999 
1000 uint32_t LESENSE_ScanFreqSet(uint32_t refFreq, uint32_t const scanFreq);
1001 void LESENSE_ScanModeSet(LESENSE_ScanMode_TypeDef const scanMode,
1002  bool const start);
1003 
1004 void LESENSE_StartDelaySet(uint8_t const startDelay);
1005 
1007  LESENSE_ClkPresc_TypeDef const clkDiv);
1008 
1009 void LESENSE_ChannelAllConfig(LESENSE_ChAll_TypeDef const *confChAll);
1011  uint32_t const chIdx);
1012 void LESENSE_ChannelEnable(uint8_t const chIdx,
1013  bool const enaScanCh,
1014  bool const enaPin);
1015 void LESENSE_ChannelEnableMask(uint16_t chMask, uint16_t pinMask);
1016 void LESENSE_ChannelTimingSet(uint8_t const chIdx,
1017  uint8_t const exTime,
1018  uint8_t const sampleDelay,
1019  uint8_t const measDelay);
1020 void LESENSE_ChannelThresSet(uint8_t const chIdx,
1021  uint16_t const acmpThres,
1022  uint16_t const cntThres);
1023 
1024 void LESENSE_AltExConfig(LESENSE_ConfAltEx_TypeDef const *confAltEx);
1025 
1028  uint32_t const decSt);
1029 void LESENSE_DecoderStateSet(uint32_t decSt);
1030 uint32_t LESENSE_DecoderStateGet(void);
1031 
1032 void LESENSE_ScanStart(void);
1033 void LESENSE_ScanStop(void);
1034 void LESENSE_DecoderStart(void);
1035 void LESENSE_ResultBufferClear(void);
1036 
1037 
1038 /***************************************************************************/
1046 __STATIC_INLINE void LESENSE_DecoderStop(void)
1047 {
1048  /* Stop the decoder */
1049  LESENSE->DECCTRL |= LESENSE_DECCTRL_DISABLE;
1050 }
1051 
1052 
1053 /***************************************************************************/
1067 __STATIC_INLINE uint32_t LESENSE_StatusGet(void)
1068 {
1069  return LESENSE->STATUS;
1070 }
1071 
1072 
1073 /***************************************************************************/
1093 __STATIC_INLINE void LESENSE_StatusWait(uint32_t flag)
1094 {
1095  while (!(LESENSE->STATUS & flag))
1096  ;
1097 }
1098 
1099 
1100 /***************************************************************************/
1108 __STATIC_INLINE uint32_t LESENSE_ChannelActiveGet(void)
1109 {
1110  return LESENSE->CURCH;
1111 }
1112 
1113 
1114 /***************************************************************************/
1125 __STATIC_INLINE uint32_t LESENSE_ScanResultGet(void)
1126 {
1127  return LESENSE->SCANRES;
1128 }
1129 
1130 
1131 /***************************************************************************/
1144 __STATIC_INLINE uint32_t LESENSE_ScanResultDataGet(void)
1145 {
1146  return LESENSE->BUFDATA;
1147 }
1148 
1149 
1150 /***************************************************************************/
1165 __STATIC_INLINE uint32_t LESENSE_ScanResultDataBufferGet(uint32_t idx)
1166 {
1167  /* Note: masking is needed to avoid over-indexing! */
1168  return LESENSE->BUF[idx & 0x0FU].DATA;
1169 }
1170 
1171 /***************************************************************************/
1179 __STATIC_INLINE uint32_t LESENSE_SensorStateGet(void)
1180 {
1181  return LESENSE->SENSORSTATE;
1182 }
1183 
1184 
1185 /***************************************************************************/
1197 __STATIC_INLINE void LESENSE_RAMPowerDown(void)
1198 {
1199  /* Power down LESENSE RAM */
1200  LESENSE->POWERDOWN = LESENSE_POWERDOWN_RAM;
1201 }
1202 
1203 
1204 /***************************************************************************/
1213 __STATIC_INLINE void LESENSE_IntClear(uint32_t flags)
1214 {
1215  LESENSE->IFC = flags;
1216 }
1217 
1218 
1219 /***************************************************************************/
1228 __STATIC_INLINE void LESENSE_IntEnable(uint32_t flags)
1229 {
1230  LESENSE->IEN |= flags;
1231 }
1232 
1233 
1234 /***************************************************************************/
1243 __STATIC_INLINE void LESENSE_IntDisable(uint32_t flags)
1244 {
1245  LESENSE->IEN &= ~flags;
1246 }
1247 
1248 
1249 /***************************************************************************/
1258 __STATIC_INLINE void LESENSE_IntSet(uint32_t flags)
1259 {
1260  LESENSE->IFS = flags;
1261 }
1262 
1263 
1264 /***************************************************************************/
1275 __STATIC_INLINE uint32_t LESENSE_IntGet(void)
1276 {
1277  return LESENSE->IF;
1278 }
1279 
1280 
1281 /***************************************************************************/
1299 __STATIC_INLINE uint32_t LESENSE_IntGetEnabled(void)
1300 {
1301  uint32_t tmp;
1302 
1303  /* Store LESENSE->IEN in temporary variable in order to define explicit order
1304  * of volatile accesses. */
1305  tmp = LESENSE->IEN;
1306 
1307  /* Bitwise AND of pending and enabled interrupts */
1308  return LESENSE->IF & tmp;
1309 }
1310 
1311 
1315 #ifdef __cplusplus
1316 }
1317 #endif
1318 
1319 #endif /* defined(LESENSE_COUNT) && (LESENSE_COUNT > 0) */
1320 
1321 #endif /* __SILICON_LABS_EM_LESENSE_H__ */
#define LESENSE_BIASCTRL_BIASMODE_DONTTOUCH
__STATIC_INLINE uint32_t LESENSE_IntGetEnabled(void)
Get enabled and pending LESENSE interrupt flags.
Definition: em_lesense.h:1299
#define _LESENSE_PERCTRL_DACCH0OUT_DISABLE
LESENSE_PRSSel_TypeDef
Definition: em_lesense.h:101
__STATIC_INLINE void LESENSE_StatusWait(uint32_t flag)
Wait until the status of LESENSE is equal to what requested.
Definition: em_lesense.h:1093
LESENSE_PRSSel_TypeDef prsChSel3
Definition: em_lesense.h:653
__STATIC_INLINE void LESENSE_IntClear(uint32_t flags)
Clear one or more pending LESENSE interrupts.
Definition: em_lesense.h:1213
LESENSE_TimeCtrlDesc_TypeDef timeCtrl
Definition: em_lesense.h:682
#define _LESENSE_PERCTRL_DACCH0DATA_ACMPTHRES
void LESENSE_ChannelTimingSet(uint8_t const chIdx, uint8_t const exTime, uint8_t const sampleDelay, uint8_t const measDelay)
Set LESENSE channel timing parameters.
Definition: em_lesense.c:728
LESENSE_ControlACMP_TypeDef acmp1Mode
Definition: em_lesense.h:583
#define _LESENSE_IDLECONF_CH0_DACCH0
#define LESENSE_CTRL_BUFIDL_FULL
LESENSE_ControlACMP_TypeDef
Definition: em_lesense.h:274
void LESENSE_DecoderStart(void)
Start LESENSE decoder.
Definition: em_lesense.c:1003
void LESENSE_ChannelAllConfig(LESENSE_ChAll_TypeDef const *confChAll)
Configure all (16) LESENSE sensor channels.
Definition: em_lesense.c:436
LESENSE_ChSampleMode_TypeDef
Definition: em_lesense.h:319
LESENSE_ControlDACData_TypeDef dacCh0Data
Definition: em_lesense.h:554
#define LESENSE_CTRL_BUFIDL_HALFFULL
void LESENSE_ChannelThresSet(uint8_t const chIdx, uint16_t const acmpThres, uint16_t const cntThres)
Set LESENSE channel threshold parameters.
Definition: em_lesense.c:780
#define LESENSE_ST_TCONFA_PRSACT_PRS12
LESENSE_DecStCond_TypeDef confA
Definition: em_lesense.h:956
LESENSE_BufTrigLevel_TypeDef
Definition: em_lesense.h:146
LESENSE_DecCtrlDesc_TypeDef decCtrl
Definition: em_lesense.h:688
LESENSE_BiasMode_TypeDef
Definition: em_lesense.h:173
LESENSE_AltExMap_TypeDef
Definition: em_lesense.h:135
LESENSE_ControlDACData_TypeDef dacCh1Data
Definition: em_lesense.h:563
void LESENSE_AltExConfig(LESENSE_ConfAltEx_TypeDef const *confAltEx)
Configure the LESENSE alternate excitation modes.
Definition: em_lesense.c:570
LESENSE_ChPinIdleMode_TypeDef chPinIdleMode
Definition: em_lesense.h:719
LESENSE_ScanConfSel_TypeDef
Definition: em_lesense.h:187
#define LESENSE_CTRL_SCANMODE_PERIODIC
#define _LESENSE_PERCTRL_DACCH0OUT_PIN
LESENSE_ControlDACOut_TypeDef
Definition: em_lesense.h:242
#define LESENSE_CH_INTERACT_SETIF_LEVEL
uint32_t LESENSE_ScanFreqSet(uint32_t refFreq, uint32_t const scanFreq)
Set scan frequency for periodic scanning.
Definition: em_lesense.c:207
__STATIC_INLINE uint32_t LESENSE_SensorStateGet(void)
Get the current state of the LESENSE sensor.
Definition: em_lesense.h:1179
void LESENSE_Reset(void)
Reset the LESENSE module.
Definition: em_lesense.c:1062
#define _LESENSE_IDLECONF_CH0_DISABLE
#define LESENSE_ST_TCONFA_PRSACT_NONE
LESENSE_DMAWakeUp_TypeDef
Definition: em_lesense.h:157
void LESENSE_ResultBufferClear(void)
Clear result buffer.
Definition: em_lesense.c:1033
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
LESENSE_DACRef_TypeDef
Definition: em_lesense.h:263
#define _LESENSE_PERCTRL_DACCH0DATA_DACDATA
#define _LESENSE_IDLECONF_CH0_LOW
#define LESENSE_DECCTRL_INPUT_PRS
void LESENSE_ChannelEnable(uint8_t const chIdx, bool const enaScanCh, bool const enaPin)
Enable/disable LESENSE scan channel and the pin assigned to it.
Definition: em_lesense.c:654
#define LESENSE_CH_INTERACT_SETIF_POSEDGE
#define LESENSE_ST_TCONFA_PRSACT_PRS0
#define LESENSE_ST_TCONFA_PRSACT_PRS2
#define LESENSE_CH_INTERACT_EXMODE_DACOUT
#define _LESENSE_PERCTRL_DACCH0OUT_PINADCACMP
LESENSE_PRSSel_TypeDef prsChSel0
Definition: em_lesense.h:644
#define _LESENSE_PERCTRL_DACCH0CONV_SAMPLEOFF
#define LESENSE_PERCTRL_DACREF_BANDGAP
#define LESENSE_ST_TCONFA_PRSACT_PRS1
void LESENSE_ChannelConfig(LESENSE_ChDesc_TypeDef const *confCh, uint32_t const chIdx)
Configure a single LESENSE sensor channel.
Definition: em_lesense.c:471
LESENSE_ClkPresc_TypeDef
Definition: em_lesense.h:71
LESENSE_ControlDACOut_TypeDef dacCh0OutMode
Definition: em_lesense.h:560
#define LESENSE_CH_EVAL_COMP_GE
#define LESENSE_ST_TCONFA_PRSACT_DOWNANDPRS2
void LESENSE_DecoderStateSet(uint32_t decSt)
Set LESENSE decoder state.
Definition: em_lesense.c:905
#define LESENSE_CTRL_SCANMODE_PRS
#define _LESENSE_ALTEXCONF_IDLECONF0_HIGH
#define _LESENSE_ALTEXCONF_IDLECONF0_LOW
#define _LESENSE_PERCTRL_DACCH0CONV_DISABLE
LESENSE_PRSSel_TypeDef prsSel
Definition: em_lesense.h:482
#define _LESENSE_IDLECONF_CH12_DACCH1
#define _LESENSE_PERCTRL_ACMP0MODE_MUX
LESENSE_AltExPinIdle_TypeDef
Definition: em_lesense.h:413
#define LESENSE_CH_INTERACT_SAMPLE_ACMP
#define LESENSE_CTRL_DMAWU_BUFLEVEL
#define LESENSE_CH_INTERACT_SETIF_NONE
#define LESENSE_ST_TCONFA_PRSACT_UPANDPRS2
LESENSE_ChClk_TypeDef exClk
Definition: em_lesense.h:736
#define _LESENSE_CTRL_ALTEXMAP_ALTEX
#define LESENSE
#define _LESENSE_ALTEXCONF_IDLECONF0_DISABLE
#define LESENSE_CH_INTERACT_SETIF_NEGEDGE
#define LESENSE_ST_TCONFA_PRSACT_DOWN
#define _LESENSE_PERCTRL_DACCH0OUT_ADCACMP
#define _LESENSE_PERCTRL_ACMP0MODE_MUXTHRES
#define _LESENSE_CTRL_ALTEXMAP_ACMP
#define LESENSE_CH_INTERACT_EXMODE_HIGH
__STATIC_INLINE void LESENSE_IntDisable(uint32_t flags)
Disable one or more LESENSE interrupts.
Definition: em_lesense.h:1243
LESENSE_DMAWakeUp_TypeDef wakeupOnDMA
Definition: em_lesense.h:508
LESENSE_ControlDACConv_TypeDef dacCh1ConvMode
Definition: em_lesense.h:566
#define _LESENSE_PERCTRL_DACCH0CONV_CONTINUOUS
#define LESENSE_PERCTRL_DACREF_VDD
#define LESENSE_CH_INTERACT_EXMODE_DISABLE
__STATIC_INLINE uint32_t LESENSE_ScanResultDataBufferGet(uint32_t idx)
Get data from the result data buffer.
Definition: em_lesense.h:1165
#define LESENSE_BIASCTRL_BIASMODE_HIGHACC
LESENSE_StTransAct_TypeDef
Definition: em_lesense.h:430
LESENSE_ChCompMode_TypeDef compMode
Definition: em_lesense.h:775
#define _LESENSE_PERCTRL_ACMP0MODE_DISABLE
void LESENSE_ClkDivSet(LESENSE_ChClk_TypeDef const clk, LESENSE_ClkPresc_TypeDef const clkDiv)
Set clock division for LESENSE timers.
Definition: em_lesense.c:374
#define _LESENSE_CH_INTERACT_EXCLK_LFACLK
__STATIC_INLINE uint32_t LESENSE_StatusGet(void)
Get the current status of LESENSE.
Definition: em_lesense.h:1067
#define LESENSE_CH_INTERACT_EXMODE_LOW
LESENSE_DecInput_TypeDef
Definition: em_lesense.h:308
#define LESENSE_CTRL_SCANCONF_INVMAP
LESENSE_PRSSel_TypeDef prsChSel2
Definition: em_lesense.h:650
#define _LESENSE_IDLECONF_CH0_HIGH
LESENSE_DACRef_TypeDef dacRef
Definition: em_lesense.h:577
LESENSE_WarmupMode_TypeDef
Definition: em_lesense.h:291
#define LESENSE_DECCTRL_INPUT_SENSORSTATE
__STATIC_INLINE uint32_t LESENSE_ScanResultGet(void)
Get the latest scan comparison result (1 bit / channel).
Definition: em_lesense.h:1125
#define LESENSE_ST_TCONFA_PRSACT_PRS02
#define LESENSE_CH_EVAL_COMP_LESS
LESENSE_PerCtrlDesc_TypeDef perCtrl
Definition: em_lesense.h:685
LESENSE_ScanConfSel_TypeDef scanConfSel
Definition: em_lesense.h:485
uint32_t LESENSE_DecoderStateGet(void)
Get the current state of the LESENSE decoder.
Definition: em_lesense.c:921
#define LESENSE_CTRL_SCANMODE_ONESHOT
void LESENSE_Init(LESENSE_Init_TypeDef const *init, bool const reqReset)
Initialize the LESENSE module.
Definition: em_lesense.c:96
LESENSE_ControlACMP_TypeDef acmp0Mode
Definition: em_lesense.h:580
LESENSE_ChCompMode_TypeDef
Definition: em_lesense.h:400
LESENSE_ControlDACConv_TypeDef
Definition: em_lesense.h:221
#define LESENSE_ST_TCONFA_PRSACT_UP
#define LESENSE_PERCTRL_WARMUPMODE_KEEPACMPWARM
#define LESENSE_PERCTRL_WARMUPMODE_KEEPACMPDACWARM
__STATIC_INLINE uint32_t LESENSE_IntGet(void)
Get pending LESENSE interrupt flags.
Definition: em_lesense.h:1275
#define LESENSE_CTRL_SCANCONF_DECDEF
LESENSE_ChPinExMode_TypeDef
Definition: em_lesense.h:347
#define LESENSE_ST_TCONFA_PRSACT_PRS012
LESENSE_ControlDACConv_TypeDef dacCh0ConvMode
Definition: em_lesense.h:557
LESENSE_ControlDACOut_TypeDef dacCh1OutMode
Definition: em_lesense.h:569
#define LESENSE_CH_INTERACT_SAMPLE_COUNTER
#define LESENSE_ST_TCONFA_PRSACT_PRS01
LESENSE_DecStCond_TypeDef confB
Definition: em_lesense.h:960
LESENSE_ChClk_TypeDef sampleClk
Definition: em_lesense.h:739
LESENSE_CoreCtrlDesc_TypeDef coreCtrl
Definition: em_lesense.h:679
LESENSE_ScanMode_TypeDef scanStart
Definition: em_lesense.h:479
__STATIC_INLINE uint32_t LESENSE_ScanResultDataGet(void)
Get the oldest unread data from the result buffer.
Definition: em_lesense.h:1144
LESENSE_AltExMap_TypeDef altExMap
Definition: em_lesense.h:860
LESENSE_ScanMode_TypeDef
Definition: em_lesense.h:85
void LESENSE_DecoderStateAllConfig(LESENSE_DecStAll_TypeDef const *confDecStAll)
Configure all LESENSE decoder states.
Definition: em_lesense.c:826
#define LESENSE_CTRL_SCANCONF_DIRMAP
#define LESENSE_DECCTRL_DISABLE
LESENSE_ControlDACData_TypeDef
Definition: em_lesense.h:208
#define LESENSE_PERCTRL_WARMUPMODE_NORMAL
LESENSE_DecInput_TypeDef decInput
Definition: em_lesense.h:610
LESENSE_ChIntMode_TypeDef
Definition: em_lesense.h:330
LESENSE_WarmupMode_TypeDef warmupMode
Definition: em_lesense.h:586
#define LESENSE_CTRL_DMAWU_BUFDATAV
LESENSE_StTransAct_TypeDef prsAct
Definition: em_lesense.h:930
LESENSE_BiasMode_TypeDef biasMode
Definition: em_lesense.h:511
LESENSE_AltExPinIdle_TypeDef idleConf
Definition: em_lesense.h:843
void LESENSE_ChannelEnableMask(uint16_t chMask, uint16_t pinMask)
Enable/disable LESENSE scan channel and the pin assigned to it.
Definition: em_lesense.c:691
void LESENSE_ScanStart(void)
Start scanning of sensors.
Definition: em_lesense.c:940
#define _LESENSE_PERCTRL_DACCH0CONV_SAMPLEHOLD
#define LESENSE_BIASCTRL_BIASMODE_DUTYCYCLE
void LESENSE_DecoderStateConfig(LESENSE_DecStDesc_TypeDef const *confDecSt, uint32_t const decSt)
Configure a single LESENSE decoder state.
Definition: em_lesense.c:854
__STATIC_INLINE void LESENSE_DecoderStop(void)
Stop LESENSE decoder.
Definition: em_lesense.h:1046
void LESENSE_ScanStop(void)
Stop scanning of sensors.
Definition: em_lesense.c:973
#define LESENSE_PERCTRL_WARMUPMODE_KEEPDACWARM
__STATIC_INLINE uint32_t LESENSE_ChannelActiveGet(void)
Get the currently active channel index.
Definition: em_lesense.h:1108
#define LESENSE_CTRL_DMAWU_DISABLE
__STATIC_INLINE void LESENSE_IntEnable(uint32_t flags)
Enable one or more LESENSE interrupts.
Definition: em_lesense.h:1228
LESENSE_ChClk_TypeDef
Definition: em_lesense.h:389
LESENSE_ChPinIdleMode_TypeDef
Definition: em_lesense.h:364
void LESENSE_ScanModeSet(LESENSE_ScanMode_TypeDef const scanMode, bool const start)
Set scan mode of the LESENSE channels.
Definition: em_lesense.c:289
__STATIC_INLINE void LESENSE_RAMPowerDown(void)
Shut off power to the LESENSE RAM, disables LESENSE.
Definition: em_lesense.h:1197
#define _LESENSE_CH_INTERACT_EXCLK_AUXHFRCO
#define LESENSE_CTRL_SCANCONF_TOGGLE
LESENSE_ChIntMode_TypeDef intMode
Definition: em_lesense.h:768
LESENSE_ChPinExMode_TypeDef chPinExMode
Definition: em_lesense.h:716
LESENSE_BufTrigLevel_TypeDef bufTrigLevel
Definition: em_lesense.h:505
LESENSE_PRSSel_TypeDef prsChSel1
Definition: em_lesense.h:647
#define LESENSE_POWERDOWN_RAM
void LESENSE_StartDelaySet(uint8_t const startDelay)
Set start delay of sensor interaction on each channel.
Definition: em_lesense.c:331
LESENSE_ChSampleMode_TypeDef sampleMode
Definition: em_lesense.h:765
__STATIC_INLINE void LESENSE_IntSet(uint32_t flags)
Set one or more pending LESENSE interrupts from SW.
Definition: em_lesense.h:1258