EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1
CapSense

Functions

uint8_t CAPLESENSE_getSegmentChannel (uint8_t capSegment)
 Get the channelValue for a sensor segment. More...
 
uint32_t CAPLESENSE_getVal (uint8_t channel)
 Get the current channelValue for a channel. More...
 
uint32_t CAPLESENSE_getNormalizedVal (uint8_t channel)
 Get the current normalized channelValue for a channel. More...
 
int32_t CAPLESENSE_getSliderPosition (void)
 Get the position of the slider. More...
 
void CAPLESENSE_Init (bool sleep)
 Initializes the capacative sense system without LESENSE. More...
 
void CAPLESENSE_setupLESENSE (bool sleep)
 Setup the LESENSE for capavitive sensing. More...
 
void CAPLESENSE_setupCallbacks (void(*scanCb)(void), void(*chCb)(void))
 LESENSE callback setup. More...
 
void CAPLESENSE_Sleep (void)
 Send the capacative sense system to sleep mode.
 
uint32_t CAPSENSE_getVal (uint8_t channel)
 Get the current channelValue for a channel. More...
 
uint32_t CAPSENSE_getNormalizedVal (uint8_t channel)
 Get the current normalized channelValue for a channel. More...
 
bool CAPSENSE_getPressed (uint8_t channel)
 Get the state of the Gecko Button. More...
 
int32_t CAPSENSE_getSliderPosition (void)
 Get the position of the slider. More...
 
void CAPSENSE_Sense (void)
 This function iterates through all the capsensors and reads and initiates a reading. Uses EM1 while waiting for the result from each sensor.
 
void CAPSENSE_Init (void)
 Initializes the capacitive sense system. More...
 

Detailed Description

Function Documentation

uint8_t CAPLESENSE_getSegmentChannel ( uint8_t  capSegment)
Parameters
capSegment
Returns
channel

Definition at line 411 of file caplesense.c.

uint32_t CAPLESENSE_getVal ( uint8_t  channel)
Parameters
channelThe channel.
Returns
The channelValue.

Definition at line 440 of file caplesense.c.

References channelValues.

uint32_t CAPLESENSE_getNormalizedVal ( uint8_t  channel)
Parameters
channelThe channel.
Returns
The channel value in range (0-256).

Definition at line 450 of file caplesense.c.

References channelMaxValues, and channelValues.

int32_t CAPLESENSE_getSliderPosition ( void  )
Returns
The position of the slider if it can be determined, -1 otherwise.

Definition at line 463 of file caplesense.c.

References channelMaxValues, and channelValues.

void CAPLESENSE_Init ( bool  sleep)
Parameters
sleepIf true, go into sleep mode.

Definition at line 531 of file caplesense.c.

References CAPLESENSE_setupACMP(), CAPLESENSE_setupCMU(), CAPLESENSE_setupGPIO(), CAPLESENSE_setupLESENSE(), INT_Disable(), and INT_Enable().

void CAPLESENSE_setupCallbacks ( void(*)(void)  scanCb,
void(*)(void)  chCb 
)
Parameters
scanCbScan callback
chCbChannel callback

Definition at line 342 of file caplesense.c.

References lesenseChCb, and lesenseScanCb.

uint32_t CAPSENSE_getVal ( uint8_t  channel)
Parameters
channelThe channel.
Returns
The channelValue.

Definition at line 121 of file capsense.c.

References channelValues.

uint32_t CAPSENSE_getNormalizedVal ( uint8_t  channel)
Parameters
channelThe channel.
Returns
The channel value in range (0-256).

Definition at line 131 of file capsense.c.

References channelMaxValues, and channelValues.

bool CAPSENSE_getPressed ( uint8_t  channel)
Parameters
channelThe channel.
Returns
true if the button is "pressed" false otherwise.

Definition at line 143 of file capsense.c.

References channelMaxValues, and channelValues.

int32_t CAPSENSE_getSliderPosition ( void  )
Returns
The position of the slider if it can be determined, -1 otherwise.

Definition at line 164 of file capsense.c.

References channelMaxValues, and channelValues.

void CAPSENSE_Init ( void  )

Capacitive sensing uses two timers: TIMER0 and TIMER1 as well as ACMP. ACMP is set up in cap-sense (oscillator mode). TIMER1 counts the number of pulses generated by ACMP_CAPSENSE. When TIMER0 expires it generates an interrupt. The number of pulses counted by TIMER1 is then stored in channelValues

Definition at line 290 of file capsense.c.

References ACMP_CAPSENSE_INIT_DEFAULT, ACMP_CapsenseInit(), CMU, CMU_ClockEnable(), cmuClock_HFPER, cmuClock_PRS, cmuClock_TIMER0, cmuClock_TIMER1, PRS, PRS_CH_CTRL_EDSEL_POSEDGE, TIMER0, TIMER0_IRQn, TIMER1, TIMER_CC_CTRL_ICEDGE_BOTH, TIMER_CC_CTRL_ICEVCTRL_RISING, TIMER_CC_CTRL_INSEL_PRS, TIMER_CC_CTRL_MODE_INPUTCAPTURE, TIMER_CC_CTRL_PRSSEL_PRSCH0, TIMER_CTRL_CLKSEL_CC1, TIMER_CTRL_PRESC_DIV1024, TIMER_CTRL_PRESC_DIV512, and TIMER_IEN_OF.