CapSenseKit Drivers
Detailed Description
Capacitive sensing driver.
Capacitive sensing driver using TIMER and ACMP peripherals.
Functions |
|
uint32_t | CAPLESENSE_getNormalizedVal (uint8_t channel) |
Get the current normalized channelValue for a channel.
|
|
uint8_t | CAPLESENSE_getSegmentChannel (uint8_t capSegment) |
Get the channelValue for a sensor segment.
|
|
int32_t | CAPLESENSE_getSliderPosition (void) |
Get the position of the slider.
|
|
uint32_t | CAPLESENSE_getVal (uint8_t channel) |
Get the current channelValue for a channel.
|
|
void | CAPLESENSE_Init (bool sleep) |
Initializes the capacative sense system without LESENSE.
|
|
void | CAPLESENSE_setupCallbacks (void(*scanCb)(void), void(*chCb)(void)) |
LESENSE callback setup.
|
|
void | CAPLESENSE_setupLESENSE (bool sleep) |
Setup the LESENSE for capavitive sensing.
|
|
void | CAPLESENSE_Sleep (void) |
Send the capacative sense system to sleep mode.
|
|
uint32_t | CAPSENSE_getNormalizedVal (uint8_t channel) |
Get the current normalized channelValue for a channel.
|
|
bool | CAPSENSE_getPressed (uint8_t channel) |
Get the state of the Gecko Button.
|
|
int32_t | CAPSENSE_getSliderPosition (void) |
Get the position of the slider.
|
|
uint32_t | CAPSENSE_getVal (uint8_t channel) |
Get the current channelValue for a channel.
|
|
void | CAPSENSE_Init (void) |
Initializes the capacitive sense system.
|
|
static void | CAPSENSE_Measure ( ACMP_Channel_TypeDef channel) |
Start a capsense measurement of a specific channel and waits for it to complete.
|
|
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 | TIMER0_IRQHandler (void) |
TIMER0 interrupt handler.
|
|
Function Documentation
uint32_t CAPLESENSE_getNormalizedVal | ( | uint8_t |
channel
|
) |
Get the current normalized channelValue for a channel.
- Parameters
-
channel
The channel.
- Returns
- The channel value in range (0-256).
Definition at line
427
of file
caplesense.c
.
References channelMaxValues , and channelValues .
uint8_t CAPLESENSE_getSegmentChannel | ( | uint8_t |
capSegment
|
) |
Get the channelValue for a sensor segment.
- Parameters
-
capSegment
- Returns
- channel
Definition at line
391
of file
caplesense.c
.
int32_t CAPLESENSE_getSliderPosition | ( | void |
|
) |
Get the position of the slider.
- Returns
- The position of the slider if it can be determined, -1 otherwise.
Definition at line
438
of file
caplesense.c
.
References channelMaxValues , and channelValues .
uint32_t CAPLESENSE_getVal | ( | uint8_t |
channel
|
) |
Get the current channelValue for a channel.
- Parameters
-
channel
The channel.
- Returns
- The channelValue.
Definition at line
417
of file
caplesense.c
.
References channelValues .
void CAPLESENSE_Init | ( | bool |
sleep
|
) |
Initializes the capacative sense system without LESENSE.
- Parameters
-
sleep
If true, go into sleep mode.
Definition at line
503
of file
caplesense.c
.
References CAPLESENSE_setupACMP() , CAPLESENSE_setupCMU() , CAPLESENSE_setupGPIO() , CAPLESENSE_setupLESENSE() , CORE_DECLARE_IRQ_STATE , CORE_ENTER_ATOMIC , and CORE_EXIT_ATOMIC .
void CAPLESENSE_setupCallbacks | ( | void(*)(void) |
scanCb,
|
void(*)(void) |
chCb
|
||
) |
LESENSE callback setup.
- Parameters
-
scanCb
Scan callback chCb
Channel callback
Definition at line
332
of file
caplesense.c
.
References lesenseChCb , and lesenseScanCb .
void CAPLESENSE_setupLESENSE | ( | bool |
sleep
|
) |
Setup the LESENSE for capavitive sensing.
- Parameters
-
sleep
If true, go into sleep mode.
Definition at line
165
of file
caplesense.c
.
References channelsInUse , LESENSE_Init_TypeDef::coreCtrl , LESENSE_ChannelAllConfig() , LESENSE_ChannelThresSet() , LESENSE_ClkDivSet() , LESENSE_Init() , LESENSE_IntClear() , LESENSE_IntDisable() , LESENSE_IntEnable() , LESENSE_ResultBufferClear() , LESENSE_ScanFreqSet() , LESENSE_ScanResultDataBufferGet() , LESENSE_ScanStart() , LESENSE_ScanStop() , LESENSE_StatusGet() , lesenseACMPModeMuxThres , lesenseBiasModeDutyCycle , lesenseBufTrigHalf , lesenseClkDiv_1 , lesenseClkDiv_8 , lesenseClkLF , lesenseDACConvModeDisable , lesenseDACIfData , lesenseDACOutModeDisable , lesenseDACRefBandGap , lesenseDecInputSensorSt , lesenseDMAWakeUpDisable , lesensePRSCh0 , lesensePRSCh1 , lesensePRSCh2 , lesensePRSCh3 , lesenseScanConfDirMap , lesenseScanStartPeriodic , lesenseWarmupModeNormal , and LESENSE_CoreCtrlDesc_TypeDef::scanStart .
Referenced by CAPLESENSE_Init() .
uint32_t CAPSENSE_getNormalizedVal | ( | uint8_t |
channel
|
) |
Get the current normalized channelValue for a channel.
- Parameters
-
channel
The channel.
- Returns
- The channel value in range (0-256).
Definition at line
146
of file
capsense.c
.
References channelMaxValues , and channelValues .
bool CAPSENSE_getPressed | ( | uint8_t |
channel
|
) |
Get the state of the Gecko Button.
- Parameters
-
channel
The channel.
- Returns
- true if the button is "pressed" false otherwise.
Definition at line
158
of file
capsense.c
.
References channelMaxValues , and channelValues .
int32_t CAPSENSE_getSliderPosition | ( | void |
|
) |
Get the position of the slider.
- Returns
- The position of the slider if it can be determined, -1 otherwise.
Definition at line
178
of file
capsense.c
.
References channelMaxValues , and channelValues .
uint32_t CAPSENSE_getVal | ( | uint8_t |
channel
|
) |
Get the current channelValue for a channel.
- Parameters
-
channel
The channel.
- Returns
- The channelValue.
Definition at line
136
of file
capsense.c
.
References channelValues .
void CAPSENSE_Init | ( | void |
|
) |
Initializes the capacitive sense system.
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
298
of file
capsense.c
.
References ACMP_CAPSENSE_INIT_DEFAULT , ACMP_CapsenseInit() , CMU_ClockEnable() , cmuClock_HFPER , cmuClock_PRS , cmuClock_TIMER0 , and cmuClock_TIMER1 .
void TIMER0_IRQHandler | ( | void |
|
) |
TIMER0 interrupt handler.
When TIMER0 expires the number of pulses on TIMER1 is inserted into channelValues. If this values is bigger than what is recorded in channelMaxValues, channelMaxValues is updated. Finally, the next ACMP channel is selected.
Definition at line
106
of file
capsense.c
.
References channelMaxValues , channelValues , and currentChannel .