35 #if defined(LESENSE_COUNT) && (LESENSE_COUNT > 0)
41 #if !defined(UINT32_MAX)
42 #define UINT32_MAX ((uint32_t)(0xFFFFFFFF))
63 #if defined(_LESENSE_ROUTE_MASK)
64 #define GENERIC_LESENSE_ROUTE LESENSE->ROUTE
66 #define GENERIC_LESENSE_ROUTE LESENSE->ROUTEPEN
69 #if defined(_SILICON_LABS_32B_SERIES_0)
71 #define DACOUT_SUPPORT 0xF00F
74 #define DACOUT_SUPPORT 0x34B0
122 #if defined(_LESENSE_PERCTRL_DACPRESC_MASK)
123 EFM_ASSERT((uint32_t)init->
perCtrl.dacPresc < 32U);
134 #if defined(_LESENSE_TIMCTRL_AUXSTARTUP_MASK)
152 #
if defined(_LESENSE_CTRL_ACMP0INV_MASK)
172 #if defined(_LESENSE_PERCTRL_DACCH0CONV_MASK)
173 | ((uint32_t)init->
perCtrl.dacCh0ConvMode << _LESENSE_PERCTRL_DACCH0CONV_SHIFT)
174 | ((uint32_t)init->
perCtrl.dacCh0OutMode << _LESENSE_PERCTRL_DACCH0OUT_SHIFT)
175 | ((uint32_t)init->
perCtrl.dacCh1ConvMode << _LESENSE_PERCTRL_DACCH1CONV_SHIFT)
176 | ((uint32_t)init->
perCtrl.dacCh1OutMode << _LESENSE_PERCTRL_DACCH1OUT_SHIFT)
177 | ((uint32_t)init->
perCtrl.dacPresc << _LESENSE_PERCTRL_DACPRESC_SHIFT)
178 | (uint32_t)init->
perCtrl.dacRef
186 #if defined(_LESENSE_PERCTRL_DACCONVTRIG_MASK)
250 uint32_t pcPresc = 0UL;
251 uint32_t clkDiv = 1UL;
252 uint32_t pcTop = 63UL;
253 uint32_t calcScanFreq;
266 EFM_ASSERT(refFreq < ((uint32_t)UINT32_MAX / 128UL));
269 EFM_ASSERT((scanFreq > 0U) && (scanFreq <= refFreq));
274 while ((refFreq / ((uint32_t)scanFreq * clkDiv) > (pcTop + 1UL))
278 clkDiv = (uint32_t)1UL << pcPresc;
282 pcTop = ((uint32_t)refFreq / ((uint32_t)scanFreq * clkDiv)) - 1UL;
297 calcScanFreq = ((uint32_t)refFreq / ((uint32_t)(1UL + pcTop) * clkDiv));
340 tmp |= (uint32_t)scanMode;
377 EFM_ASSERT(startDelay < 4U);
521 #if defined(_SILICON_LABS_32B_SERIES_0)
532 EFM_ASSERT((0x1 << chIdx) & DACOUT_SUPPORT);
535 #if defined(_LESENSE_IDLECONF_CH0_DACCH0)
540 && (chIdx != 15U))));
551 tmp = (
LESENSE->IDLECONF & ~((uint32_t)0x3UL << (chIdx * 2UL)));
637 for (i = 0U; i < 8U; ++i)
649 tmp = (
LESENSE->ALTEXCONF & ~((uint32_t)0x3UL << (i * 2UL)));
650 tmp |= ((uint32_t)confAltEx->
AltEx[i].
idleConf << (i * 2UL));
660 #if defined(_LESENSE_CTRL_ALTEXMAP_ACMP)
661 case lesenseAltExMapACMP:
666 for (i = 0U; i < 16U; ++i)
750 GENERIC_LESENSE_ROUTE = pinMask;
790 #if defined(_SILICON_LABS_32B_SERIES_0)
845 EFM_ASSERT(acmpThres < 4096U);
851 tmp =
LESENSE->CH[chIdx].INTERACT & ~(0xFFF);
853 tmp |= (uint32_t)acmpThres;
855 LESENSE->CH[chIdx].INTERACT = tmp;
866 #if defined(_LESENSE_CH_EVAL_MODE_MASK)
1100 #if defined(_LESENSE_PRSCTRL_MASK)
1284 #if defined(_LESENSE_EVALCTRL_MASK)
1293 #if defined(_LESENSE_ROUTE_MASK)
1294 LESENSE->ROUTE = _LESENSE_ROUTE_RESETVALUE;
Clock management unit (CMU) API.
#define _LESENSE_CH_TIMING_EXTIME_SHIFT
LESENSE_PRSSel_TypeDef prsChSel3
LESENSE_TimeCtrlDesc_TypeDef timeCtrl
void LESENSE_AltExConfig(const LESENSE_ConfAltEx_TypeDef *confAltEx)
Configure the LESENSE alternate excitation modes.
LESENSE_ControlACMP_TypeDef acmp1Mode
#define LESENSE_NUM_CHANNELS
#define _LESENSE_TIMCTRL_AUXSTARTUP_SHIFT
#define _LESENSE_PRSCTRL_DECCMPMASK_SHIFT
void LESENSE_DecoderStart(void)
Start LESENSE decoder.
#define _LESENSE_PERCTRL_DACCH1DATA_SHIFT
#define _LESENSE_PRSCTRL_DECCMPEN_SHIFT
#define _LESENSE_CH_TIMING_RESETVALUE
#define _LESENSE_CH_INTERACT_EXCLK_SHIFT
Emlib peripheral API "assert" implementation.
LESENSE_ControlDACData_TypeDef dacCh0Data
#define _LESENSE_CH_INTERACT_SAMPLECLK_SHIFT
#define _LESENSE_TIMCTRL_LFPRESC_SHIFT
LESENSE_DecStCond_TypeDef confA
RAM and peripheral bit-field set and clear API.
LESENSE_DecCtrlDesc_TypeDef decCtrl
#define _LESENSE_CTRL_DEBUGRUN_SHIFT
#define _LESENSE_CH_INTERACT_ALTEX_SHIFT
LESENSE_ControlDACData_TypeDef dacCh1Data
#define _LESENSE_DECSTATE_DECSTATE_MASK
#define _LESENSE_CHEN_RESETVALUE
LESENSE_ChPinIdleMode_TypeDef chPinIdleMode
#define _LESENSE_ST_TCONFA_NEXTSTATE_SHIFT
void LESENSE_Init(const LESENSE_Init_TypeDef *init, bool reqReset)
Initialize the LESENSE module.
void LESENSE_DecoderPrsOut(bool enable, uint32_t decMask, uint32_t decCmp)
Enable or disable PRS output from the LESENSE decoder.
#define _LESENSE_CH_EVAL_RESETVALUE
#define _LESENSE_PERCTRL_DACCONVTRIG_SHIFT
#define _LESENSE_PRSCTRL_RESETVALUE
LESENSE_ChDesc_TypeDef Ch[LESENSE_NUM_CHANNELS]
void LESENSE_Reset(void)
Reset the LESENSE module.
#define _LESENSE_CH_EVAL_SCANRESINV_SHIFT
void LESENSE_ResultBufferClear(void)
Clear result buffer.
void LESENSE_ChannelThresSet(uint8_t chIdx, uint16_t acmpThres, uint16_t cntThres)
Set LESENSE channel threshold parameters.
void LESENSE_ScanModeSet(LESENSE_ScanMode_TypeDef scanMode, bool start)
Set scan mode of the LESENSE channels.
LESENSE_AltExDesc_TypeDef AltEx[16]
void LESENSE_ChannelSlidingWindow(uint8_t chIdx, uint32_t windowSize, uint32_t initValue)
Configure Sliding Window evaluation mode for a specific channel.
LESENSE_CH EFR32BG13P LESENSE CH.
#define _LESENSE_DECCTRL_PRSSEL0_SHIFT
LESENSE_PRSSel_TypeDef prsChSel0
#define _LESENSE_ST_TCONFA_RESETVALUE
#define _LESENSE_CTRL_STRSCANRES_SHIFT
#define _LESENSE_ST_TCONFB_RESETVALUE
void LESENSE_DecoderStateSet(uint32_t decSt)
Set LESENSE decoder state.
void LESENSE_WindowSizeSet(uint32_t windowSize)
Set the window size for all LESENSE channels.
#define _LESENSE_TIMCTRL_LFPRESC_MASK
#define _LESENSE_BIASCTRL_RESETVALUE
#define _LESENSE_ALTEXCONF_RESETVALUE
#define _LESENSE_PERCTRL_ACMP0INV_SHIFT
#define _LESENSE_ST_TCONFA_MASK_SHIFT
LESENSE_PRSSel_TypeDef prsSel
LESENSE_DecStDesc_TypeDef St[LESENSE_NUM_DECODER_STATES]
#define _LESENSE_DECCTRL_PRSSEL3_SHIFT
#define _LESENSE_TIMCTRL_AUXSTARTUP_MASK
LESENSE_ChClk_TypeDef exClk
#define _LESENSE_DECCTRL_HYSTIRQ_SHIFT
LESENSE_ChEvalMode_TypeDef evalMode
#define _LESENSE_CH_TIMING_SAMPLEDLY_MASK
void LESENSE_ChannelTimingSet(uint8_t chIdx, uint8_t exTime, uint8_t sampleDelay, uint16_t measDelay)
Set LESENSE channel timing parameters.
#define _LESENSE_TIMCTRL_PCPRESC_MASK
#define _LESENSE_DECCTRL_INTMAP_SHIFT
#define _LESENSE_CH_INTERACT_RESETVALUE
uint32_t LESENSE_ScanFreqSet(uint32_t refFreq, uint32_t scanFreq)
Set scan frequency for periodic scanning.
LESENSE_DMAWakeUp_TypeDef wakeupOnDMA
#define _LESENSE_PERCTRL_ACMP1INV_SHIFT
#define _LESENSE_DECCTRL_PRSSEL1_SHIFT
#define _LESENSE_DECCTRL_HYSTPRS1_SHIFT
#define _LESENSE_PERCTRL_ACMP0MODE_SHIFT
#define _LESENSE_TIMCTRL_AUXPRESC_MASK
LESENSE_ChCompMode_TypeDef compMode
#define _LESENSE_TIMCTRL_PCTOP_MASK
#define _LESENSE_CTRL_RESETVALUE
#define _LESENSE_IDLECONF_RESETVALUE
void LESENSE_ClkDivSet(LESENSE_ChClk_TypeDef clk, LESENSE_ClkPresc_TypeDef clkDiv)
Set clock division for LESENSE timers.
#define _LESENSE_CTRL_SCANMODE_MASK
LESENSE_PRSSel_TypeDef prsChSel2
#define LESENSE_NUM_DECODER_STATES
#define _LESENSE_TIMCTRL_STARTDLY_SHIFT
void LESENSE_ChannelAllConfig(const LESENSE_ChAll_TypeDef *confChAll)
Configure all (16) LESENSE sensor channels.
#define _LESENSE_CH_EVAL_MODE_SHIFT
#define _LESENSE_TIMCTRL_AUXPRESC_SHIFT
#define _LESENSE_DECCTRL_PRSCNT_SHIFT
LESENSE_PerCtrlDesc_TypeDef perCtrl
void LESENSE_ChannelConfig(const LESENSE_ChDesc_TypeDef *confCh, uint32_t chIdx)
Configure a single LESENSE sensor channel.
#define _LESENSE_PERCTRL_ACMP1MODE_SHIFT
LESENSE_ScanConfSel_TypeDef scanConfSel
#define _LESENSE_CTRL_ALTEXMAP_SHIFT
uint32_t LESENSE_DecoderStateGet(void)
Get the current state of the LESENSE decoder.
#define _LESENSE_CH_EVAL_DECODE_SHIFT
#define _LESENSE_CH_EVAL_COMPTHRES_MASK
#define _LESENSE_TIMCTRL_PCTOP_SHIFT
LESENSE_ControlACMP_TypeDef acmp0Mode
#define _LESENSE_DECCTRL_PRSSEL2_SHIFT
void LESENSE_ChannelEnable(uint8_t chIdx, bool enaScanCh, bool enaPin)
Enable/disable LESENSE scan channel and the pin assigned to it.
#define _LESENSE_DECCTRL_HYSTPRS2_SHIFT
#define _LESENSE_ST_TCONFA_COMP_SHIFT
#define LESENSE_SYNCBUSY_CMD
void LESENSE_StepSizeSet(uint32_t stepSize)
Set the step size for all LESENSE channels.
#define _LESENSE_PERCTRL_RESETVALUE
#define _LESENSE_TIMCTRL_STARTDLY_MASK
#define _LESENSE_CH_TIMING_SAMPLEDLY_SHIFT
#define _LESENSE_IFC_MASK
#define _LESENSE_ST_TCONFA_CHAIN_SHIFT
#define _LESENSE_DECCTRL_HYSTPRS0_SHIFT
LESENSE_DecStCond_TypeDef confB
#define _LESENSE_CH_EVAL_STRSAMPLE_SHIFT
#define LESENSE_CH_EVAL_MODE_STEPDET
LESENSE_ChClk_TypeDef sampleClk
LESENSE_CoreCtrlDesc_TypeDef coreCtrl
LESENSE_ScanMode_TypeDef scanStart
#define _LESENSE_EVALCTRL_RESETVALUE
#define _LESENSE_EVALCTRL_WINSIZE_MASK
#define _LESENSE_CH_EVAL_MODE_MASK
#define _LESENSE_CH_TIMING_MEASUREDLY_SHIFT
#define _LESENSE_CH_TIMING_MEASUREDLY_MASK
LESENSE_AltExMap_TypeDef altExMap
#define _LESENSE_CH_TIMING_EXTIME_MASK
#define _LESENSE_PERCTRL_DACCH0DATA_SHIFT
#define LESENSE_CH_EVAL_MODE_SLIDINGWIN
void LESENSE_DecoderStateConfig(const LESENSE_DecStDesc_TypeDef *confDecSt, uint32_t decSt)
Configure a single LESENSE decoder state.
#define _LESENSE_ST_TCONFB_NEXTSTATE_SHIFT
LESENSE_DecInput_TypeDef decInput
#define _LESENSE_CTRL_PRSSEL_SHIFT
#define _LESENSE_ST_TCONFB_SETIF_SHIFT
Low Energy Sensor (LESENSE) peripheral API.
#define LESENSE_DECCTRL_DISABLE
#define LESENSE_CMD_CLEARBUF
#define _LESENSE_ST_TCONFA_SETIF_SHIFT
LESENSE_WarmupMode_TypeDef warmupMode
#define _LESENSE_ST_TCONFB_MASK_SHIFT
LESENSE_StTransAct_TypeDef prsAct
#define _LESENSE_ROUTEPEN_RESETVALUE
LESENSE_BiasMode_TypeDef biasMode
LESENSE_AltExPinIdle_TypeDef idleConf
#define _LESENSE_PERCTRL_ACMP0INV_MASK
void LESENSE_ChannelEnableMask(uint16_t chMask, uint16_t pinMask)
Enable/disable LESENSE scan channel and the pin assigned to it.
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.
void LESENSE_StartDelaySet(uint8_t startDelay)
Set start delay of sensor interaction on each channel.
void LESENSE_ScanStart(void)
Start scanning of sensors.
#define _LESENSE_DECCTRL_RESETVALUE
#define _LESENSE_CTRL_BUFOW_SHIFT
#define _LESENSE_PRSCTRL_DECCMPVAL_SHIFT
void LESENSE_ScanStop(void)
Stop scanning of sensors.
uint32_t CMU_ClockFreqGet(CMU_Clock_TypeDef clock)
Get clock frequency for a clock point.
#define _LESENSE_CH_EVAL_COMPTHRES_SHIFT
#define _LESENSE_CTRL_DUALSAMPLE_SHIFT
#define _LESENSE_ST_TCONFB_COMP_SHIFT
void LESENSE_ChannelStepDetection(uint8_t chIdx, uint32_t stepSize, uint32_t initValue)
Configure step detection evaluation mode for a specific channel.
#define _LESENSE_DECCTRL_ERRCHK_SHIFT
LESENSE_ChIntMode_TypeDef intMode
#define LESENSE_CMD_START
LESENSE_ChPinExMode_TypeDef chPinExMode
LESENSE_BufTrigLevel_TypeDef bufTrigLevel
LESENSE_PRSSel_TypeDef prsChSel1
#define _LESENSE_IEN_RESETVALUE
LESENSE_ChSampleMode_TypeDef sampleMode
#define LESENSE_CMD_DECODE
void LESENSE_DecoderStateAllConfig(const LESENSE_DecStAll_TypeDef *confDecStAll)
Configure all LESENSE decoder states.
#define _LESENSE_TIMCTRL_PCPRESC_SHIFT