LESENSE - Low Energy Sensor#
Low Energy Sensor (LESENSE) Peripheral API.
This module contains functions to control the LESENSE peripheral of Silicon Labs 32-bit MCUs and SoCs. LESENSE is a low-energy sensor interface capable of autonomously collecting and processing data from multiple sensors even when in EM2.
Modules#
Enumerations#
Clock divisors for controlling the prescaling factor of the period counter.
Scan modes.
PRS sources.
Modes of operation for DMA wakeup from EM2.
Scan configuration.
DAC CHx data control configuration.
ACMPx control configuration.
Decoder input source configuration.
Interrupt generation setup for CHx interrupt flag.
Channel pin mode for the excitation phase of the scan sequence.
Channel pin mode for the idle phase of scan sequence.
Clock used for excitation and sample delay timing.
Compare modes for counter comparison.
Mode of Storing of Sensor Sample in Result Buffer.
Sensor evaluation modes.
Transition action modes.
Typedefs#
Decoder state x configuration structure.
Functions#
Initialize the LESENSE module.
Reset the LESENSE module.
Set the scan frequency for periodic scanning.
Set scan mode of the LESENSE channels.
Set the start delay of the sensor interaction on each channel.
Set the clock division for LESENSE timers.
Configure all (16) LESENSE sensor channels.
Configure a single LESENSE sensor channel.
Enable/disable LESENSE scan channel and the pin assigned to it.
Enable/disable LESENSE scan channel and the pin assigned to it.
Set LESENSE channel timing parameters.
Set LESENSE channel threshold parameters.
Configure a Sliding Window evaluation mode for a specific channel.
Configure the step detection evaluation mode for a specific channel.
Set the window size for all LESENSE channels.
Set the step size for all LESENSE channels.
Configure the LESENSE alternate excitation modes.
Configure all LESENSE decoder states.
Configure a single LESENSE decoder state.
Get the current state of the LESENSE decoder.
Enable or disable the PRS output from the LESENSE decoder.
Start scanning sensors.
Stop scanning sensors.
Start the LESENSE decoder.
Clear the result buffer.
Stop LESENSE decoder.
Get the current status of LESENSE.
Wait until status of LESENSE is equal to what was requested.
Get the currently active channel index.
Get the latest scan comparison result (1 bit / channel).
Get the oldest unread data from the result buffer.
Get the current state of the LESENSE sensor.
Clear one or more pending LESENSE interrupts.
Enable one or more LESENSE interrupts.
Disable one or more LESENSE interrupts.
Set one or more pending LESENSE interrupts from SW.
Get pending LESENSE interrupt flags.
Get enabled and pending LESENSE interrupt flags.
Macros#
Number of decoder states supported by current device.
Number of ARCs supported by current device.
Number of LESENSE channels.
Default configuration for LESENSE_CtrlDesc_TypeDef structure.
Default configuration for LESENSE_TimeCtrlDesc_TypeDef structure.
Default configuration for LESENSE_PerCtrl_TypeDef structure.
Default configuration for LESENSE_PerCtrl_TypeDef structure.
Default configuration for LESENSE_Init_TypeDef structure.
Default configuration for the scan channel.
Default configuration for all the sensor channels.
Default configuration for the alternate excitation channel.
Default configuration for all the alternate excitation channels.
Default configuration for the decoder state condition.
Default configuration for all decoder states.
Enumeration Documentation#
LESENSE_ClkPresc_TypeDef#
LESENSE_ClkPresc_TypeDef
Clock divisors for controlling the prescaling factor of the period counter.
Note: These enumeration values are used for different clock division related configuration parameters (hfPresc, lfPresc, pcPresc).
Enumerator | |
---|---|
lesenseClkDiv_1 | Divide clock by 1. |
lesenseClkDiv_2 | Divide clock by 2. |
lesenseClkDiv_4 | Divide clock by 4. |
lesenseClkDiv_8 | Divide clock by 8. |
lesenseClkDiv_16 | Divide clock by 16. |
lesenseClkDiv_32 | Divide clock by 32. |
lesenseClkDiv_64 | Divide clock by 64. |
lesenseClkDiv_128 | Divide clock by 128. |
65
of file platform/emlib/inc/em_lesense.h
LESENSE_ScanMode_TypeDef#
LESENSE_ScanMode_TypeDef
Scan modes.
Enumerator | |
---|---|
lesenseScanStartPeriodic | New scan is started each time the period counter overflows. |
lesenseScanStartOneShot | Single scan is performed when LESENSE_ScanStart() is called. |
lesenseScanStartPRS | New scan is triggered by pulse on PRS channel. |
89
of file platform/emlib/inc/em_lesense.h
LESENSE_PRSSel_TypeDef#
LESENSE_PRSSel_TypeDef
PRS sources.
Note: These enumeration values are being used for different PRS related configuration parameters.
Enumerator | |
---|---|
lesensePRSCh0 | PRS channel 0. |
lesensePRSCh1 | PRS channel 1. |
lesensePRSCh2 | PRS channel 2. |
lesensePRSCh3 | PRS channel 3. |
lesensePRSCh4 | PRS channel 4. |
lesensePRSCh5 | PRS channel 5. |
lesensePRSCh6 | PRS channel 6. |
lesensePRSCh7 | PRS channel 7. |
lesensePRSCh8 | PRS channel 8. |
lesensePRSCh9 | PRS channel 9. |
lesensePRSCh10 | PRS channel 10. |
lesensePRSCh11 | PRS channel 11. |
104
of file platform/emlib/inc/em_lesense.h
LESENSE_DMAWakeUp_TypeDef#
LESENSE_DMAWakeUp_TypeDef
Modes of operation for DMA wakeup from EM2.
Enumerator | |
---|---|
lesenseDMAWakeUpDisable | No DMA wakeup from EM2. |
lesenseDMAWakeUpEnable | DMA wakeup from EM2. |
180
of file platform/emlib/inc/em_lesense.h
LESENSE_ScanConfSel_TypeDef#
LESENSE_ScanConfSel_TypeDef
Scan configuration.
Enumerator | |
---|---|
lesenseScanConfDirMap | Channel configuration registers (CHx_CONF) used are directly mapped to the channel number. |
lesenseScanConfInvMap | Channel configuration registers used are CHx+8_CONF for channels 0-7 and CHx-8_CONF for channels 8-15. |
lesenseScanConfToggle | Channel configuration registers used toggles between CHX_SCANCONF and CHX+8_SCANCONF when channel x triggers. |
lesenseScanConfDecDef | Decoder state defines the channel configuration register (CHx_CONF) to be used. |
223
of file platform/emlib/inc/em_lesense.h
LESENSE_ControlDACData_TypeDef#
LESENSE_ControlDACData_TypeDef
DAC CHx data control configuration.
Enumerator | |
---|---|
lesenseDACIfData | DAC channel x data is defined by the DAC_CHxDATA register. |
lesenseThres | DAC channel x data is defined by the THRES in LESENSE_CHx_INTERACT. |
243
of file platform/emlib/inc/em_lesense.h
LESENSE_ControlACMP_TypeDef#
LESENSE_ControlACMP_TypeDef
ACMPx control configuration.
Enumerator | |
---|---|
lesenseACMPModeMux | LESENSE does not control ACMPx. |
lesenseACMPModeMuxThres | LESENSE controls input mux of and threshold value of ACMPx. |
315
of file platform/emlib/inc/em_lesense.h
LESENSE_ChSampleMode_TypeDef#
LESENSE_ChSampleMode_TypeDef
Decoder input source configuration.
Ocelot only provides SENSORSTATE as input for the decoder. Compare source selection for sensor sampling.
Enumerator | |
---|---|
lesenseSampleModeCounter | Counter output will be used in comparison. |
lesenseSampleModeACMP | ACMP output will be used in comparison. |
lesenseSampleModeADC | ADC output will be used in comparison. |
lesenseSampleModeADCDiff | Differential ADC output will be used in comparison. |
362
of file platform/emlib/inc/em_lesense.h
LESENSE_ChIntMode_TypeDef#
LESENSE_ChIntMode_TypeDef
Interrupt generation setup for CHx interrupt flag.
Enumerator | |
---|---|
lesenseSetIntNone | No interrupt is generated. |
lesenseSetIntLevel | Set interrupt flag if the sensor triggers. |
lesenseSetIntPosEdge | Set interrupt flag on positive edge of the sensor state. |
lesenseSetIntNegEdge | Set interrupt flag on negative edge of the sensor state. |
lesenseSetIntBothEdges | Set interrupt flag on both edges of the sensor state. |
383
of file platform/emlib/inc/em_lesense.h
LESENSE_ChPinExMode_TypeDef#
LESENSE_ChPinExMode_TypeDef
Channel pin mode for the excitation phase of the scan sequence.
Enumerator | |
---|---|
lesenseChPinExDis | Channel pin is disabled. |
lesenseChPinExHigh | Channel pin is configured as push-pull, driven HIGH. |
lesenseChPinExLow | Channel pin is configured as push-pull, driven LOW. |
lesenseChPinExDACOut | DAC output (only available on channel 0, 1, 2, 3, 12, 13, 14 and 15) |
403
of file platform/emlib/inc/em_lesense.h
LESENSE_ChPinIdleMode_TypeDef#
LESENSE_ChPinIdleMode_TypeDef
Channel pin mode for the idle phase of scan sequence.
Enumerator | |
---|---|
lesenseChPinIdleDis | Channel pin is disabled in idle phase. |
lesenseChPinIdleHigh | Channel pin is configured as push-pull, driven HIGH in idle phase. |
lesenseChPinIdleLow | Channel pin is configured as push-pull, driven LOW in idle phase. |
lesenseChPinIdleDACC | Channel pin is connected to DAC output in idle phase. |
447
of file platform/emlib/inc/em_lesense.h
LESENSE_ChClk_TypeDef#
LESENSE_ChClk_TypeDef
Clock used for excitation and sample delay timing.
Enumerator | |
---|---|
lesenseClkLF | LFACLK (LF clock) is used. |
lesenseClkHF | AUXHFRCO (HF clock) is used. |
467
of file platform/emlib/inc/em_lesense.h
LESENSE_ChCompMode_TypeDef#
LESENSE_ChCompMode_TypeDef
Compare modes for counter comparison.
Enumerator | |
---|---|
lesenseCompModeLess | Comparison evaluates to 1 if sensor data is less than the counter threshold, or if ACMP output is 0. |
lesenseCompModeGreaterOrEq | Comparison evaluates to 1 if sensor data is greater than, or equal to the counter threshold, or if the ACMP output is 1. |
487
of file platform/emlib/inc/em_lesense.h
LESENSE_StoreSample_TypeDef#
LESENSE_StoreSample_TypeDef
Mode of Storing of Sensor Sample in Result Buffer.
Enumerator | |
---|---|
lesenseStoreSampleDisable | Nothing will be stored in the result buffer. |
lesenseStoreSampleData | The sensor sample data will be stored in the result buffer. |
lesenseStoreSampleDataSrc | The data source (i.e. |
520
of file platform/emlib/inc/em_lesense.h
LESENSE_ChEvalMode_TypeDef#
LESENSE_ChEvalMode_TypeDef
Sensor evaluation modes.
Enumerator | |
---|---|
lesenseEvalModeThreshold | Threshold comparison evaluation mode. |
lesenseEvalModeSlidingWindow | Sliding window evaluation mode. |
lesenseEvalModeStepDetection | Step detection evaluation mode. |
559
of file platform/emlib/inc/em_lesense.h
LESENSE_StTransAct_TypeDef#
LESENSE_StTransAct_TypeDef
Transition action modes.
Enumerator | |
---|---|
lesenseTransActNone | No PRS pulses generated (if PRSCOUNT == 0). |
lesenseTransActPRS0 | Generate pulse on LESPRS0 (if PRSCOUNT == 0). |
lesenseTransActPRS1 | Generate pulse on LESPRS1 (if PRSCOUNT == 0). |
lesenseTransActPRS01 | Generate pulse on LESPRS0 and LESPRS1 (if PRSCOUNT == 0). |
lesenseTransActPRS2 | Generate pulse on LESPRS2 (for both PRSCOUNT == 0 and PRSCOUNT == 1). |
lesenseTransActPRS02 | Generate pulse on LESPRS0 and LESPRS2 (if PRSCOUNT == 0). |
lesenseTransActPRS12 | Generate pulse on LESPRS1 and LESPRS2 (if PRSCOUNT == 0). |
lesenseTransActPRS012 | Generate pulse on LESPRS0, LESPRS1 and LESPRS2 (if PRSCOUNT == 0). |
lesenseTransActUp | Count up (if PRSCOUNT == 1). |
lesenseTransActDown | Count down (if PRSCOUNT == 1). |
lesenseTransActUpAndPRS2 | Count up and generate pulse on LESPRS2 (if PRSCOUNT == 1). |
lesenseTransActDownAndPRS2 | Count down and generate pulse on LESPRS2 (if PRSCOUNT == 1). |
640
of file platform/emlib/inc/em_lesense.h
Typedef Documentation#
LESENSE_DecStDesc_TypeDef#
typedef LESENSE_DecStCond_TypeDef LESENSE_DecStDesc_TypeDef
Decoder state x configuration structure.
1405
of file platform/emlib/inc/em_lesense.h
Function Documentation#
LESENSE_Init#
void LESENSE_Init (const LESENSE_Init_TypeDef * init, bool reqReset)
Initialize the LESENSE module.
[in] | init | The LESENSE initialization structure. |
[in] | reqReset | Request to call LESENSE_Reset() first to initialize all LESENSE registers with default values. |
This function configures the main parameters of the LESENSE interface. See the initialization parameter type definition (LESENSE_Init_TypeDef) for more details.
Note
LESENSE_Init() is designed to initialize LESENSE once in an operation cycle. Be aware of the effects of reconfiguration if using this function from multiple sources in your code. This function has not been designed to be re-entrant. Requesting reset by setting
reqReset
to true is required in each reset or power-on cycle to configure the default values of the RAM mapped LESENSE registers. Notice that GPIO pins used by the LESENSE module must be properly configured by the user explicitly for the LESENSE to work as intended. (When configuring pins, one should remember to consider the sequence of configuration to avoid unintended pulses/glitches on output pins.)
117
of file platform/emlib/src/em_lesense.c
LESENSE_Reset#
void LESENSE_Reset (void )
Reset the LESENSE module.
N/A |
Use this function to reset LESENSE registers.
Note
Resetting LESENSE registers is required in each reset or power-on cycle to configure the default values of the RAM mapped LESENSE registers. LESENSE_Reset() can be called on initialization by setting the
reqReset
parameter to true in LESENSE_Init(). Starting from Series 2 Config 3 (xG23 and higher), this function leaves LESENSE in the disabled state.
1658
of file platform/emlib/src/em_lesense.c
LESENSE_ScanFreqSet#
uint32_t LESENSE_ScanFreqSet (uint32_t refFreq, uint32_t scanFreq)
Set the scan frequency for periodic scanning.
[in] | refFreq | Select reference LFACLK clock frequency in Hz. If set to 0, the current clock frequency is being used as a reference. |
[in] | scanFreq | Set the desired scan frequency in Hz. |
This function only applies to LESENSE if a period counter is used as a trigger for scan start. The calculation is based on the following formula: Fscan = LFACLKles / ((1+PCTOP)*2^PCPRESC)
Note
Note that the calculation does not necessarily result in the requested scan frequency due to integer division. Check the return value for the resulted scan frequency.
Returns
Frequency in Hz calculated and set by this function. Users can use this to compare the requested and set values.
291
of file platform/emlib/src/em_lesense.c
LESENSE_ScanModeSet#
void LESENSE_ScanModeSet (LESENSE_ScanMode_TypeDef scanMode, bool start)
Set scan mode of the LESENSE channels.
[in] | scanMode | Select the location to map LESENSE alternate excitation channels.
|
[in] | start | If true, LESENSE_ScanStart() is immediately issued after configuration. |
This function configures how the scan start is triggered. It can be used for re-configuring the scan mode while running the application but it is also used by LESENSE_Init() for initialization.
Note
Users can configure the scan mode by LESENSE_Init() function, but only with a significant overhead. This simple function serves the purpose of controlling this parameter after the channel has been configured. Be aware of the effects of the non-atomic Read-Modify-Write cycle.
405
of file platform/emlib/src/em_lesense.c
LESENSE_StartDelaySet#
void LESENSE_StartDelaySet (uint8_t startDelay)
Set the start delay of the sensor interaction on each channel.
[in] | startDelay | A number of LFACLK cycles to delay. A valid range: 0-3 (2 bit). |
This function sets the start delay of the sensor interaction on each channel. It can be used for adjusting the start delay while running the application but it is also used by LESENSE_Init() for initialization.
Note
Users can configure the start delay by LESENSE_Init() function, but only with a significant overhead. This simple function serves the purpose of controlling this parameter after the channel has been configured. Be aware of the effects of the non-atomic Read-Modify-Write cycle.
477
of file platform/emlib/src/em_lesense.c
LESENSE_ClkDivSet#
void LESENSE_ClkDivSet (LESENSE_ChClk_TypeDef clk, LESENSE_ClkPresc_TypeDef clkDiv)
Set the clock division for LESENSE timers.
[in] | clk | Select the clock to prescale.
|
[in] | clkDiv | The clock divisor value. A valid range depends on the |
Use this function to configure the clock division for the LESENSE timers used for excitation timing. The division setting is global but the clock source can be selected for each channel using LESENSE_ChannelConfig() function. See documentation for more details.
Note
If AUXHFRCO is used for excitation timing, LFACLK can't exceed 500 kHz. LFACLK can't exceed 50 kHz if the ACMP threshold level (ACMPTHRES) is not equal for all channels.
543
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelAllConfig#
void LESENSE_ChannelAllConfig (const LESENSE_ChAll_TypeDef * confChAll)
Configure all (16) LESENSE sensor channels.
[in] | confChAll | A configuration structure for all (16) LESENSE sensor channels. |
This function configures all sensor channels of the LESENSE interface. See the configuration parameter type definition (LESENSE_ChAll_TypeDef) for more details.
Note
Channels can be configured individually using LESENSE_ChannelConfig() function. Notice that pins used by the LESENSE module must be properly configured by the user explicitly for LESENSE to work as intended. (When configuring pins, consider the sequence of the configuration to avoid unintended pulses/glitches on output pins.)
625
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelConfig#
void LESENSE_ChannelConfig (const LESENSE_ChDesc_TypeDef * confCh, uint32_t chIdx)
Configure a single LESENSE sensor channel.
[in] | confCh | A configuration structure for a single LESENSE sensor channel. |
[in] | chIdx | A channel index to configure (0-15). |
This function configures a single sensor channel of the LESENSE interface. See the configuration parameter type definition (LESENSE_ChDesc_TypeDef) for more details.
Note
This function has been designed to minimize the effects of sensor channel reconfiguration while LESENSE is in operation. However, be aware of these effects and the right timing to call this function. Parameter
useAltEx
must be true in the channel configuration to use alternate excitation pins.
658
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelEnable#
void LESENSE_ChannelEnable (uint8_t chIdx, bool enaScanCh, bool enaPin)
Enable/disable LESENSE scan channel and the pin assigned to it.
[in] | chIdx | An identifier of the scan channel. A valid range: 0-15. |
[in] | enaScanCh | Enable/disable the selected scan channel by setting this parameter to true/false respectively. |
[in] | enaPin | Enable/disable the pin assigned to the channel selected by |
Use this function to enable/disable a selected LESENSE scan channel and the pin assigned to it.
Note
Users can enable/disable scan channels and the channel pin with the LESENSE_ChannelConfig() function, but only with a significant overhead. This simple function controls these parameters after the channel has been configured.
900
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelEnableMask#
void LESENSE_ChannelEnableMask (uint16_t chMask, uint16_t pinMask)
Enable/disable LESENSE scan channel and the pin assigned to it.
[in] | chMask | Set the corresponding bit to 1 to enable, 0 to disable the selected scan channel. |
[in] | pinMask | Set the corresponding bit to 1 to enable, 0 to disable the pin on selected channel. |
Use this function to enable/disable LESENSE scan channels and the pins assigned to them using a mask.
Note
Users can enable/disable scan channels and channel pins by using the LESENSE_ChannelAllConfig() function, but only with a significant overhead. This simple function controls these parameters after the channel has been configured.
936
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelTimingSet#
void LESENSE_ChannelTimingSet (uint8_t chIdx, uint8_t exTime, uint8_t sampleDelay, uint16_t measDelay)
Set LESENSE channel timing parameters.
[in] | chIdx | An identifier of the scan channel. A valid range is 0-15. |
[in] | exTime | An excitation time on chIdx. The excitation will last exTime+1 excitation clock cycles. A valid range is 0-63 (6 bits). |
[in] | sampleDelay | Sample delay on chIdx. Sampling will occur after sampleDelay+1 sample clock cycles. A valid range is 0-127 (7 bits). |
[in] | measDelay | A measure delay on chIdx. Sensor measuring is delayed for measDelay+1 excitation clock cycles. A valid range is 0-127 (7 bits). |
Use this function to set timing parameters on a selected LESENSE channel.
Note
Users can configure the channel timing parameters with the LESENSE_ChannelConfig() function, but only with a significant overhead. This simple function controls these parameters after the channel has been configured.
972
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelThresSet#
void LESENSE_ChannelThresSet (uint8_t chIdx, uint16_t acmpThres, uint16_t cntThres)
Set LESENSE channel threshold parameters.
[in] | chIdx | An identifier of the scan channel. A valid range is 0-15. |
[in] | acmpThres | ACMP threshold.
|
[in] | cntThres | A decision threshold for counter comparison. A valid range is 0-65535 (16 bits). |
Use this function to set threshold parameters on a selected LESENSE channel.
Note
Users can configure the channel threshold parameters with the LESENSE_ChannelConfig() function, but only with a significant overhead. This simple function serves controls these parameters after the channel has been configured.
1052
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelSlidingWindow#
void LESENSE_ChannelSlidingWindow (uint8_t chIdx, uint32_t windowSize, uint32_t initValue)
Configure a Sliding Window evaluation mode for a specific channel.
[in] | chIdx | An identifier of the scan channel. A valid range is 0-15. |
[in] | windowSize | A window size to be used on all channels. |
[in] | initValue | The initial sensor value for the channel. |
This function will configure the evaluation mode, the initial sensor measurement (COMPTHRES), and the window size. For other channel-related configuration, see the LESENSE_ChannelConfig() function.
Warnings
Note that the step size and window size configuration are global to all LESENSE channels and use the same register field in the hardware. This means that any windowSize configuration passed to this function will apply for all channels and override all other stepSize/windowSize configurations.
1143
of file platform/emlib/src/em_lesense.c
LESENSE_ChannelStepDetection#
void LESENSE_ChannelStepDetection (uint8_t chIdx, uint32_t stepSize, uint32_t initValue)
Configure the step detection evaluation mode for a specific channel.
[in] | chIdx | An identifier of the scan channel. A valid range is 0-15. |
[in] | stepSize | A step size to be used on all channels. |
[in] | initValue | The initial sensor value for the channel. |
This function will configure the evaluation mode, the initial sensor measurement (COMPTHRES) and the window size. For other channel-related configuration, see the LESENSE_ChannelConfig() function.
Warnings
Note that the step size and window size configuration are global to all LESENSE channels and use the same register field in the hardware. This means that any stepSize configuration passed to this function will apply for all channels and override all other stepSize/windowSize configurations.
1218
of file platform/emlib/src/em_lesense.c
LESENSE_WindowSizeSet#
void LESENSE_WindowSizeSet (uint32_t windowSize)
Set the window size for all LESENSE channels.
[in] | windowSize | The window size to use for all channels. |
The window size is used by all channels that are configured as lesenseEvalModeSlidingWindow.
Warnings
The window size configuration is using the same register field as the step detection size. As a result, the window size configuration will have an effect on channels configured with the lesenseEvalModeStepDetection evaluation mode as well.
1283
of file platform/emlib/src/em_lesense.c
LESENSE_StepSizeSet#
void LESENSE_StepSizeSet (uint32_t stepSize)
Set the step size for all LESENSE channels.
[in] | stepSize | The step size to use for all channels. |
The step size is configured using the same register field as used to configure window size. Therefore, calling this function will overwrite any previously configured window size as done by the LESENSE_WindowSizeSet() function.
1326
of file platform/emlib/src/em_lesense.c
LESENSE_AltExConfig#
void LESENSE_AltExConfig (const LESENSE_ConfAltEx_TypeDef * confAltEx)
Configure the LESENSE alternate excitation modes.
[in] | confAltEx | A configuration structure for LESENSE alternate excitation pins. |
This function configures the alternate excitation channels of the LESENSE interface. See the configuration parameter type definition (LESENSE_ConfAltEx_TypeDef) for more details.
Note
The
useAltEx
parameter must be true in the channel configuration structure (LESENSE_ChDesc_TypeDef) to use alternate excitation pins on the channel.
805
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderStateAllConfig#
void LESENSE_DecoderStateAllConfig (const LESENSE_DecStAll_TypeDef * confDecStAll)
Configure all LESENSE decoder states.
[in] | confDecStAll | A configuration structure for all (16 or 32) LESENSE decoder states. |
This function configures all the decoder states of the LESENSE interface. See the configuration parameter type definition (LESENSE_DecStAll_TypeDef) for more details.
Note
Decoder states can be configured individually using LESENSE_DecoderStateConfig() function. Starting from Series 2 Config 3 (xG23 and higher), this function configures a transition ARC instead of a decoder state.
1350
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderStateConfig#
void LESENSE_DecoderStateConfig (const LESENSE_DecStDesc_TypeDef * confDecSt, uint32_t decSt)
Configure a single LESENSE decoder state.
[in] | confDecSt | A configuration structure for a single LESENSE decoder state. |
[in] | decSt | A decoder state index to configure (0-15) or (0-31) depending on the device. |
This function configures a single decoder state of the LESENSE interface. See the configuration parameter type definition (LESENSE_DecStDesc_TypeDef) for more details.
Note
Starting from Series 2 Config 3 (xG23 and higher), this function configures a transition ARC instead of a decoder state.
1388
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderStateGet#
uint32_t LESENSE_DecoderStateGet (void )
Get the current state of the LESENSE decoder.
N/A |
Returns
This function returns the value of the LESENSE_DECSTATE register that represents the current state of the LESENSE decoder.
1492
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderPrsOut#
void LESENSE_DecoderPrsOut (bool enable, uint32_t decMask, uint32_t decVal)
Enable or disable the PRS output from the LESENSE decoder.
[in] | enable | Enable/disable the PRS output from the LESENSE decoder. True to enable and false to disable. |
[in] | decMask | A decoder state compare value mask. |
[in] | decVal | A decoder state comparison value. |
1512
of file platform/emlib/src/em_lesense.c
LESENSE_ScanStart#
void LESENSE_ScanStart (void )
Start scanning sensors.
N/A |
Note
This function will wait for any pending previous write operation to the CMD register to complete before accessing the CMD register. It will also wait for the write operation to the CMD register to complete before returning. Each write operation to the CMD register may take up to 3 LF clock cycles, so expect some delay. The user may implement a separate function to write multiple command bits in the CMD register in one single operation to optimize an application.
1533
of file platform/emlib/src/em_lesense.c
LESENSE_ScanStop#
void LESENSE_ScanStop (void )
Stop scanning sensors.
N/A |
Note
This function will wait for any pending previous write operation to the CMD register to complete before accessing the CMD register. It will also wait for the write operation to the CMD register to complete before returning. Each write operation to the CMD register may take up to 3 LF clock cycles, so the user should expect some delay. The user may implement a separate function to write multiple command bits in the CMD register in one single operation in order to optimize an application.
If issued during a scan, the command takes effect after scan completion.
1565
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderStart#
void LESENSE_DecoderStart (void )
Start the LESENSE decoder.
N/A |
Note
This function will wait for any pending previous write operation to the CMD register to complete before accessing the CMD register. It will also wait for the write operation to the CMD register to complete before returning. Each write operation to the CMD register may take up to 3 LF clock cycles, so expect some delay. The user may implement a separate function to write multiple command bits in the CMD register in one single operation to optimize an application.
1594
of file platform/emlib/src/em_lesense.c
LESENSE_ResultBufferClear#
void LESENSE_ResultBufferClear (void )
Clear the result buffer.
N/A |
Note
This function will wait for any pending previous write operation to the CMD register to complete before accessing the CMD register. It will also wait for the write operation to the CMD register to complete before returning. Each write operation to the CMD register may take up to 3 LF clock cycles, so expect some delay. The user may implement a separate function to write multiple command bits in the CMD register in one single operation to optimize an application.
1623
of file platform/emlib/src/em_lesense.c
LESENSE_DecoderStop#
void LESENSE_DecoderStop (void )
Stop LESENSE decoder.
N/A |
Disables LESENSE decoder by setting the command to LESENSE_DECCTRL register.
1583
of file platform/emlib/inc/em_lesense.h
LESENSE_StatusGet#
uint32_t LESENSE_StatusGet (void )
Get the current status of LESENSE.
N/A |
Returns
Returns the value of the LESENSE_STATUS register that contains the OR combination of the following status bits for EFR series 0/1:
LESENSE_STATUS_BUFDATAV - Result data valid. Set when data is available in result buffer. Cleared when buffer is empty.
LESENSE_STATUS_BUFFULL - Result buffer full. Set when result buffer is full.
LESENSE_STATUS_BUFHALFFULL - Result buffer half full. Set when result buffer is half full.
LESENSE_STATUS_RUNNING - LESENSE is active.
LESENSE_STATUS_SCANACTIVE - LESENSE is currently interfacing sensors.
The OR combination of the following status bits for EFR series 2:
LESENSE_STATUS_RESFIFOV - Result Fifo valid. Set when data is available in result Fifo. Cleared when Fifo is empty.
LESENSE_STATUS_RESFIFOFULL - Result Fifo full. Set when result Fifo is full.
LESENSE_STATUS_RUNNING - LESENSE is active.
LESENSE_STATUS_SCANACTIVE - LESENSE is currently interfacing sensors.
LESENSE_STATUS_FLUSHING - Fifo flushing
LESENSE_STATUS_READBUSY - Fifo Read busy
1619
of file platform/emlib/inc/em_lesense.h
LESENSE_StatusWait#
void LESENSE_StatusWait (uint32_t flag)
Wait until status of LESENSE is equal to what was requested.
[in] | flag | The OR combination of the following status bits for EFR series 0/1:
The OR combination of the following status bits for EFR series 2:
|
Polls LESENSE_STATUS register and waits until requested combination of flags are set.
1654
of file platform/emlib/inc/em_lesense.h
LESENSE_ChannelActiveGet#
uint32_t LESENSE_ChannelActiveGet (void )
Get the currently active channel index.
N/A |
Returns
Returns the value of the LESENSE_CHINDEX register that contains the index of currently active channel (0-15).
1668
of file platform/emlib/inc/em_lesense.h
LESENSE_ScanResultGet#
uint32_t LESENSE_ScanResultGet (void )
Get the latest scan comparison result (1 bit / channel).
N/A |
Returns
Returns the value of the LESENSE_SCANRES register that contains the comparison result of last scan on all channels. Bit x is set if a comparison triggered on channel x, which means that LESENSE counter met the comparison criteria set in LESENSE_CHx_EVAL by COMPMODE and CNTTHRES.
1684
of file platform/emlib/inc/em_lesense.h
LESENSE_ScanResultDataGet#
uint32_t LESENSE_ScanResultDataGet (void )
Get the oldest unread data from the result buffer.
N/A |
Note
Make sure that the STORERES bit is set in LESENSE_CHx_EVAL, or the STRSCANRES bit is set in LESENSE_CTRL; otherwise, returns the undefined value.
Returns
Returns the value of LESENSE_RESDATA register that contains the oldest unread counter result from result buffer.
1702
of file platform/emlib/inc/em_lesense.h
LESENSE_SensorStateGet#
uint32_t LESENSE_SensorStateGet (void )
Get the current state of the LESENSE sensor.
N/A |
Returns
Returns the value of LESENSE_SENSORSTATE register that represents the current state of the LESENSE sensor.
1742
of file platform/emlib/inc/em_lesense.h
LESENSE_IntClear#
void LESENSE_IntClear (uint32_t flags)
Clear one or more pending LESENSE interrupts.
[in] | flags | Pending LESENSE interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources of LESENSE module (LESENSE_IF_nnn). |
1776
of file platform/emlib/inc/em_lesense.h
LESENSE_IntEnable#
void LESENSE_IntEnable (uint32_t flags)
Enable one or more LESENSE interrupts.
[in] | flags | LESENSE interrupt sources to enable. Use a set of interrupt flags OR-ed together to enable multiple interrupt sources of LESENSE module (LESENSE_IF_nnn). |
1794
of file platform/emlib/inc/em_lesense.h
LESENSE_IntDisable#
void LESENSE_IntDisable (uint32_t flags)
Disable one or more LESENSE interrupts.
[in] | flags | LESENSE interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources of LESENSE module (LESENSE_IF_nnn). |
1812
of file platform/emlib/inc/em_lesense.h
LESENSE_IntSet#
void LESENSE_IntSet (uint32_t flags)
Set one or more pending LESENSE interrupts from SW.
[in] | flags | LESENSE interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources of LESENSE module (LESENSE_IFS_nnn). |
1830
of file platform/emlib/inc/em_lesense.h
LESENSE_IntGet#
uint32_t LESENSE_IntGet (void )
Get pending LESENSE interrupt flags.
N/A |
Note
Event bits are not cleared by the use of this function.
Returns
Pending LESENSE interrupt sources. The OR combination of valid interrupt flags of the LESENSE module (LESENSE_IF_nnn).
1850
of file platform/emlib/inc/em_lesense.h
LESENSE_IntGetEnabled#
uint32_t LESENSE_IntGetEnabled (void )
Get enabled and pending LESENSE interrupt flags.
N/A |
Useful for handling more interrupt sources in the same interrupt handler.
Note
Event bits are not cleared by the use of this function.
Returns
Pending and enabled LESENSE interrupt sources. Return value is the bitwise AND combination of
the OR combination of enabled interrupt sources in LESENSE_IEN_nnn register (LESENSE_IEN_nnn) and
the OR combination of valid interrupt flags of LESENSE module (LESENSE_IF_nnn).
1873
of file platform/emlib/inc/em_lesense.h
Macro Definition Documentation#
LESENSE_NUM_DECODER_STATES#
#define LESENSE_NUM_DECODER_STATESValue:
(_LESENSE_DECSTATE_DECSTATE_MASK + 1)
Number of decoder states supported by current device.
50
of file platform/emlib/inc/em_lesense.h
LESENSE_NUM_ARCS#
#define LESENSE_NUM_ARCSValue:
(LESENSE_NUM_DECODER_STATES << 1)
Number of ARCs supported by current device.
Number of ARCS is the number of states times 2
53
of file platform/emlib/inc/em_lesense.h
LESENSE_NUM_CHANNELS#
#define LESENSE_NUM_CHANNELSValue:
16
Number of LESENSE channels.
56
of file platform/emlib/inc/em_lesense.h
LESENSE_CORECTRL_DESC_DEFAULT#
#define LESENSE_CORECTRL_DESC_DEFAULTValue:
Default configuration for LESENSE_CtrlDesc_TypeDef structure.
752
of file platform/emlib/inc/em_lesense.h
LESENSE_TIMECTRL_DESC_DEFAULT#
#define LESENSE_TIMECTRL_DESC_DEFAULTValue:
Default configuration for LESENSE_TimeCtrlDesc_TypeDef structure.
781
of file platform/emlib/inc/em_lesense.h
LESENSE_PERCTRL_DESC_DEFAULT#
#define LESENSE_PERCTRL_DESC_DEFAULTValue:
Default configuration for LESENSE_PerCtrl_TypeDef structure.
893
of file platform/emlib/inc/em_lesense.h
LESENSE_DECCTRL_DESC_DEFAULT#
#define LESENSE_DECCTRL_DESC_DEFAULTValue:
Default configuration for LESENSE_PerCtrl_TypeDef structure.
975
of file platform/emlib/inc/em_lesense.h
LESENSE_INIT_DEFAULT#
#define LESENSE_INIT_DEFAULTValue:
Default configuration for LESENSE_Init_TypeDef structure.
1003
of file platform/emlib/inc/em_lesense.h
LESENSE_CH_CONF_DEFAULT#
#define LESENSE_CH_CONF_DEFAULTValue:
Default configuration for the scan channel.
1110
of file platform/emlib/inc/em_lesense.h
LESENSE_SCAN_CONF_DEFAULT#
#define LESENSE_SCAN_CONF_DEFAULTValue:
Default configuration for all the sensor channels.
1184
of file platform/emlib/inc/em_lesense.h
LESENSE_ALTEX_CH_CONF_DEFAULT#
#define LESENSE_ALTEX_CH_CONF_DEFAULTValue:
Default configuration for the alternate excitation channel.
1259
of file platform/emlib/inc/em_lesense.h
LESENSE_ALTEX_CONF_DEFAULT#
#define LESENSE_ALTEX_CONF_DEFAULTValue:
Default configuration for all the alternate excitation channels.
1315
of file platform/emlib/inc/em_lesense.h
LESENSE_ST_CONF_DEFAULT#
#define LESENSE_ST_CONF_DEFAULTValue:
Default configuration for the decoder state condition.
1378
of file platform/emlib/inc/em_lesense.h
LESENSE_DECODER_CONF_DEFAULT#
#define LESENSE_DECODER_CONF_DEFAULT
Default configuration for all decoder states.
1481
of file platform/emlib/inc/em_lesense.h