EFR32 Blue Gecko 12 Software Documentation  efr32bg12-doc-5.1.2
em_lesense.h File Reference

Detailed Description

Low Energy Sensor (LESENSE) peripheral API.

Version
5.1.2

License

Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file em_lesense.h.

#include "em_device.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  LESENSE_AltExDesc_TypeDef
 
struct  LESENSE_ChAll_TypeDef
 
struct  LESENSE_ChDesc_TypeDef
 
struct  LESENSE_ConfAltEx_TypeDef
 
struct  LESENSE_CoreCtrlDesc_TypeDef
 
struct  LESENSE_DecCtrlDesc_TypeDef
 
struct  LESENSE_DecStAll_TypeDef
 
struct  LESENSE_DecStCond_TypeDef
 
struct  LESENSE_DecStDesc_TypeDef
 
struct  LESENSE_Init_TypeDef
 
struct  LESENSE_PerCtrlDesc_TypeDef
 
struct  LESENSE_TimeCtrlDesc_TypeDef
 

Macros

#define LESENSE_ALTEX_CH_CONF_DEFAULT
 
#define LESENSE_ALTEX_CONF_DEFAULT
 
#define LESENSE_CH_CONF_DEFAULT
 
#define LESENSE_CORECTRL_DESC_DEFAULT
 
#define LESENSE_DECCTRL_DESC_DEFAULT
 
#define LESENSE_DECODER_CONF_DEFAULT
 
#define LESENSE_INIT_DEFAULT
 
#define LESENSE_NUM_CHANNELS   16
 
#define LESENSE_NUM_DECODER_STATES   (_LESENSE_DECSTATE_DECSTATE_MASK + 1)
 
#define LESENSE_PERCTRL_DESC_DEFAULT
 
#define LESENSE_SCAN_CONF_DEFAULT
 
#define LESENSE_ST_CONF_DEFAULT
 
#define LESENSE_TIMECTRL_DESC_DEFAULT
 

Enumerations

enum  LESENSE_AltExMap_TypeDef {
  lesenseAltExMapALTEX = _LESENSE_CTRL_ALTEXMAP_ALTEX,
  lesenseAltExMapCH = _LESENSE_CTRL_ALTEXMAP_CH
}
 
enum  LESENSE_AltExPinIdle_TypeDef {
  lesenseAltExPinIdleDis = _LESENSE_ALTEXCONF_IDLECONF0_DISABLE,
  lesenseAltExPinIdleHigh = _LESENSE_ALTEXCONF_IDLECONF0_HIGH,
  lesenseAltExPinIdleLow = _LESENSE_ALTEXCONF_IDLECONF0_LOW
}
 
enum  LESENSE_BiasMode_TypeDef {
  lesenseBiasModeDutyCycle = LESENSE_BIASCTRL_BIASMODE_DUTYCYCLE,
  lesenseBiasModeHighAcc = LESENSE_BIASCTRL_BIASMODE_HIGHACC,
  lesenseBiasModeDontTouch = LESENSE_BIASCTRL_BIASMODE_DONTTOUCH
}
 
enum  LESENSE_BufTrigLevel_TypeDef {
  lesenseBufTrigHalf = LESENSE_CTRL_BUFIDL_HALFFULL,
  lesenseBufTrigFull = LESENSE_CTRL_BUFIDL_FULL
}
 
enum  LESENSE_ChClk_TypeDef {
  lesenseClkLF = _LESENSE_CH_INTERACT_EXCLK_LFACLK,
  lesenseClkHF = _LESENSE_CH_INTERACT_EXCLK_AUXHFRCO
}
 
enum  LESENSE_ChCompMode_TypeDef {
  lesenseCompModeLess = LESENSE_CH_EVAL_COMP_LESS,
  lesenseCompModeGreaterOrEq = LESENSE_CH_EVAL_COMP_GE
}
 
enum  LESENSE_ChEvalMode_TypeDef {
  lesenseEvalModeThreshold = _LESENSE_CH_EVAL_MODE_THRES,
  lesenseEvalModeSlidingWindow = _LESENSE_CH_EVAL_MODE_SLIDINGWIN,
  lesenseEvalModeStepDetection = _LESENSE_CH_EVAL_MODE_STEPDET
}
 
enum  LESENSE_ChIntMode_TypeDef {
  lesenseSetIntNone = LESENSE_CH_INTERACT_SETIF_NONE,
  lesenseSetIntLevel = LESENSE_CH_INTERACT_SETIF_LEVEL,
  lesenseSetIntPosEdge = LESENSE_CH_INTERACT_SETIF_POSEDGE,
  lesenseSetIntNegEdge = LESENSE_CH_INTERACT_SETIF_NEGEDGE
}
 
enum  LESENSE_ChPinExMode_TypeDef {
  lesenseChPinExDis = LESENSE_CH_INTERACT_EXMODE_DISABLE,
  lesenseChPinExHigh = LESENSE_CH_INTERACT_EXMODE_HIGH,
  lesenseChPinExLow = LESENSE_CH_INTERACT_EXMODE_LOW,
  lesenseChPinExDACOut = LESENSE_CH_INTERACT_EXMODE_DACOUT
}
 
enum  LESENSE_ChPinIdleMode_TypeDef {
  lesenseChPinIdleDis = _LESENSE_IDLECONF_CH0_DISABLE,
  lesenseChPinIdleHigh = _LESENSE_IDLECONF_CH0_HIGH,
  lesenseChPinIdleLow = _LESENSE_IDLECONF_CH0_LOW,
  lesenseChPinIdleDACC = _LESENSE_IDLECONF_CH0_DAC
}
 
enum  LESENSE_ChSampleMode_TypeDef {
  lesenseSampleModeCounter = 0x0 << _LESENSE_CH_INTERACT_SAMPLE_SHIFT,
  lesenseSampleModeACMP = LESENSE_CH_INTERACT_SAMPLE_ACMP,
  lesenseSampleModeADC = LESENSE_CH_INTERACT_SAMPLE_ADC,
  lesenseSampleModeADCDiff = LESENSE_CH_INTERACT_SAMPLE_ADCDIFF
}
 
enum  LESENSE_ClkPresc_TypeDef {
  lesenseClkDiv_1 = 0,
  lesenseClkDiv_2 = 1,
  lesenseClkDiv_4 = 2,
  lesenseClkDiv_8 = 3,
  lesenseClkDiv_16 = 4,
  lesenseClkDiv_32 = 5,
  lesenseClkDiv_64 = 6,
  lesenseClkDiv_128 = 7
}
 
enum  LESENSE_ControlACMP_TypeDef {
  lesenseACMPModeDisable = _LESENSE_PERCTRL_ACMP0MODE_DISABLE,
  lesenseACMPModeMux = _LESENSE_PERCTRL_ACMP0MODE_MUX,
  lesenseACMPModeMuxThres = _LESENSE_PERCTRL_ACMP0MODE_MUXTHRES
}
 
enum  LESENSE_ControlDACData_TypeDef {
  lesenseDACIfData = _LESENSE_PERCTRL_DACCH0DATA_DACDATA,
  lesenseThres = _LESENSE_PERCTRL_DACCH0DATA_THRES
}
 
enum  LESENSE_DecInput_TypeDef {
  lesenseDecInputSensorSt = LESENSE_DECCTRL_INPUT_SENSORSTATE,
  lesenseDecInputPRS = LESENSE_DECCTRL_INPUT_PRS
}
 
enum  LESENSE_DMAWakeUp_TypeDef {
  lesenseDMAWakeUpDisable = LESENSE_CTRL_DMAWU_DISABLE,
  lesenseDMAWakeUpBufValid = LESENSE_CTRL_DMAWU_BUFDATAV,
  lesenseDMAWakeUpBufLevel = LESENSE_CTRL_DMAWU_BUFLEVEL
}
 
enum  LESENSE_PRSSel_TypeDef {
  lesensePRSCh0 = 0,
  lesensePRSCh1 = 1,
  lesensePRSCh2 = 2,
  lesensePRSCh3 = 3,
  lesensePRSCh4 = 4,
  lesensePRSCh5 = 5,
  lesensePRSCh6 = 6,
  lesensePRSCh7 = 7,
  lesensePRSCh8 = 8,
  lesensePRSCh9 = 9,
  lesensePRSCh10 = 10,
  lesensePRSCh11 = 11
}
 
enum  LESENSE_ScanConfSel_TypeDef {
  lesenseScanConfDirMap = LESENSE_CTRL_SCANCONF_DIRMAP,
  lesenseScanConfInvMap = LESENSE_CTRL_SCANCONF_INVMAP,
  lesenseScanConfToggle = LESENSE_CTRL_SCANCONF_TOGGLE,
  lesenseScanConfDecDef = LESENSE_CTRL_SCANCONF_DECDEF
}
 
enum  LESENSE_ScanMode_TypeDef {
  lesenseScanStartPeriodic = LESENSE_CTRL_SCANMODE_PERIODIC,
  lesenseScanStartOneShot = LESENSE_CTRL_SCANMODE_ONESHOT,
  lesenseScanStartPRS = LESENSE_CTRL_SCANMODE_PRS
}
 
enum  LESENSE_StTransAct_TypeDef {
  lesenseTransActNone = LESENSE_ST_TCONFA_PRSACT_NONE,
  lesenseTransActPRS0 = LESENSE_ST_TCONFA_PRSACT_PRS0,
  lesenseTransActPRS1 = LESENSE_ST_TCONFA_PRSACT_PRS1,
  lesenseTransActPRS01 = LESENSE_ST_TCONFA_PRSACT_PRS01,
  lesenseTransActPRS2 = LESENSE_ST_TCONFA_PRSACT_PRS2,
  lesenseTransActPRS02 = LESENSE_ST_TCONFA_PRSACT_PRS02,
  lesenseTransActPRS12 = LESENSE_ST_TCONFA_PRSACT_PRS12,
  lesenseTransActPRS012 = LESENSE_ST_TCONFA_PRSACT_PRS012,
  lesenseTransActUp = LESENSE_ST_TCONFA_PRSACT_UP,
  lesenseTransActDown = LESENSE_ST_TCONFA_PRSACT_DOWN,
  lesenseTransActUpAndPRS2 = LESENSE_ST_TCONFA_PRSACT_UPANDPRS2,
  lesenseTransActDownAndPRS2 = LESENSE_ST_TCONFA_PRSACT_DOWNANDPRS2
}
 
enum  LESENSE_WarmupMode_TypeDef {
  lesenseWarmupModeNormal = LESENSE_PERCTRL_WARMUPMODE_NORMAL,
  lesenseWarmupModeACMP = LESENSE_PERCTRL_WARMUPMODE_KEEPACMPWARM,
  lesenseWarmupModeDAC = LESENSE_PERCTRL_WARMUPMODE_KEEPDACWARM,
  lesenseWarmupModeKeepWarm = LESENSE_PERCTRL_WARMUPMODE_KEEPACMPDACWARM
}
 

Functions

void LESENSE_AltExConfig (const LESENSE_ConfAltEx_TypeDef *confAltEx)
 Configure the LESENSE alternate excitation modes. More...
 
__STATIC_INLINE uint32_t LESENSE_ChannelActiveGet (void)
 Get the currently active channel index. More...
 
void LESENSE_ChannelAllConfig (const LESENSE_ChAll_TypeDef *confChAll)
 Configure all (16) LESENSE sensor channels. More...
 
void LESENSE_ChannelConfig (const LESENSE_ChDesc_TypeDef *confCh, uint32_t chIdx)
 Configure a single LESENSE sensor channel. More...
 
void LESENSE_ChannelEnable (uint8_t chIdx, bool enaScanCh, bool enaPin)
 Enable/disable LESENSE scan channel and the pin assigned to it. More...
 
void LESENSE_ChannelEnableMask (uint16_t chMask, uint16_t pinMask)
 Enable/disable LESENSE scan channel and the pin assigned to it. More...
 
void LESENSE_ChannelSlidingWindow (uint8_t chIdx, uint32_t windowSize, uint32_t initValue)
 Configure Sliding Window evaluation mode for a specific channel. More...
 
void LESENSE_ChannelStepDetection (uint8_t chIdx, uint32_t stepSize, uint32_t initValue)
 Configure step detection evaluation mode for a specific channel. More...
 
void LESENSE_ChannelThresSet (uint8_t chIdx, uint16_t acmpThres, uint16_t cntThres)
 Set LESENSE channel threshold parameters. More...
 
void LESENSE_ChannelTimingSet (uint8_t chIdx, uint8_t exTime, uint8_t sampleDelay, uint16_t measDelay)
 Set LESENSE channel timing parameters. More...
 
void LESENSE_ClkDivSet (LESENSE_ChClk_TypeDef clk, LESENSE_ClkPresc_TypeDef clkDiv)
 Set clock division for LESENSE timers. More...
 
void LESENSE_DecoderPrsOut (bool enable, uint32_t decMask, uint32_t decVal)
 Enable or disable PRS output from the LESENSE decoder. More...
 
void LESENSE_DecoderStart (void)
 Start LESENSE decoder. More...
 
void LESENSE_DecoderStateAllConfig (const LESENSE_DecStAll_TypeDef *confDecStAll)
 Configure all LESENSE decoder states. More...
 
void LESENSE_DecoderStateConfig (const LESENSE_DecStDesc_TypeDef *confDecSt, uint32_t decSt)
 Configure a single LESENSE decoder state. More...
 
uint32_t LESENSE_DecoderStateGet (void)
 Get the current state of the LESENSE decoder. More...
 
void LESENSE_DecoderStateSet (uint32_t decSt)
 Set LESENSE decoder state. More...
 
__STATIC_INLINE void LESENSE_DecoderStop (void)
 Stop LESENSE decoder. More...
 
void LESENSE_Init (const LESENSE_Init_TypeDef *init, bool reqReset)
 Initialize the LESENSE module. More...
 
__STATIC_INLINE void LESENSE_IntClear (uint32_t flags)
 Clear one or more pending LESENSE interrupts. More...
 
__STATIC_INLINE void LESENSE_IntDisable (uint32_t flags)
 Disable one or more LESENSE interrupts. More...
 
__STATIC_INLINE void LESENSE_IntEnable (uint32_t flags)
 Enable one or more LESENSE interrupts. More...
 
__STATIC_INLINE uint32_t LESENSE_IntGet (void)
 Get pending LESENSE interrupt flags. More...
 
__STATIC_INLINE uint32_t LESENSE_IntGetEnabled (void)
 Get enabled and pending LESENSE interrupt flags. More...
 
__STATIC_INLINE void LESENSE_IntSet (uint32_t flags)
 Set one or more pending LESENSE interrupts from SW. More...
 
void LESENSE_Reset (void)
 Reset the LESENSE module. More...
 
void LESENSE_ResultBufferClear (void)
 Clear result buffer. More...
 
uint32_t LESENSE_ScanFreqSet (uint32_t refFreq, uint32_t scanFreq)
 Set scan frequency for periodic scanning. More...
 
void LESENSE_ScanModeSet (LESENSE_ScanMode_TypeDef scanMode, bool start)
 Set scan mode of the LESENSE channels. More...
 
__STATIC_INLINE uint32_t LESENSE_ScanResultDataBufferGet (uint32_t idx)
 Get data from the result data buffer. More...
 
__STATIC_INLINE uint32_t LESENSE_ScanResultDataGet (void)
 Get the oldest unread data from the result buffer. More...
 
__STATIC_INLINE uint32_t LESENSE_ScanResultGet (void)
 Get the latest scan comparison result (1 bit / channel). More...
 
void LESENSE_ScanStart (void)
 Start scanning of sensors. More...
 
void LESENSE_ScanStop (void)
 Stop scanning of sensors. More...
 
__STATIC_INLINE uint32_t LESENSE_SensorStateGet (void)
 Get the current state of the LESENSE sensor. More...
 
void LESENSE_StartDelaySet (uint8_t startDelay)
 Set start delay of sensor interaction on each channel. More...
 
__STATIC_INLINE uint32_t LESENSE_StatusGet (void)
 Get the current status of LESENSE. More...
 
__STATIC_INLINE void LESENSE_StatusWait (uint32_t flag)
 Wait until the status of LESENSE is equal to what requested. More...
 
void LESENSE_StepSizeSet (uint32_t stepSize)
 Set the step size for all LESENSE channels. More...
 
void LESENSE_WindowSizeSet (uint32_t windowSize)
 Set the window size for all LESENSE channels. More...