CapSense
[Drivers]

Collaboration diagram for CapSense:

Functions

uint8_t CAPLESENSE_getSegmentChannel (uint8_t capSegment)
 Get the channelValue for a sensor segment.
uint32_t CAPLESENSE_getVal (uint8_t channel)
 Get the current channelValue for a channel.
uint32_t CAPLESENSE_getNormalizedVal (uint8_t channel)
 Get the current normalized channelValue for a channel.
int32_t CAPLESENSE_getSliderPosition (void)
 Get the position of the slider.
void CAPLESENSE_Init (bool sleep)
 Initializes the capacative sense system without LESENSE.
void CAPLESENSE_setupLESENSE (bool sleep)
 Setup the LESENSE for capavitive sensing.
void CAPLESENSE_setupCallbacks (void(*scanCb)(void), void(*chCb)(void))
 LESENSE callback setup.
void CAPLESENSE_Sleep (void)
 Send the capacative sense system to sleep mode.
uint8_t CAPSENSE_getSegmentChannel (uint8_t capSegment)
 Get the channelValue for a sensor segment.
uint8_t CAPSENSE_getButtonChannel (void)
 Get the channelValue for a sensor segment.
uint32_t CAPSENSE_getVal (uint8_t channel)
 Get the current channelValue for a channel.
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.
void CAPSENSE_Sense (void)
 This function iterates through all the capsensors and reads and initiates a reading.
void CAPSENSE_Init (void)
 Initializes the capacative sense system.

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 467 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 428 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 480 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 457 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 548 of file caplesense.c.

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

Here is the call graph for this function:

void CAPLESENSE_setupCallbacks ( void(*)(void)  scanCb,
void(*)(void)  chCb 
)

LESENSE callback setup.

Parameters:
scanCb Scan callback
chCb Channel callback

Definition at line 359 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 191 of file caplesense.c.

Referenced by CAPLESENSE_Init().

Here is the caller graph for this function:

void CAPLESENSE_Sleep ( void   ) 

Send the capacative sense system to sleep mode.

Definition at line 537 of file caplesense.c.

uint8_t CAPSENSE_getButtonChannel ( void   ) 

Get the channelValue for a sensor segment.

Returns:
channel

Definition at line 138 of file capsense.c.

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 150 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 162 of file capsense.c.

References channelMaxValues, and channelValues.

uint8_t CAPSENSE_getSegmentChannel ( uint8_t  capSegment  ) 

Get the channelValue for a sensor segment.

Parameters:
capSegment 
Returns:
channel

Definition at line 111 of file capsense.c.

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 183 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 101 of file capsense.c.

References channelValues.

void CAPSENSE_Init ( void   ) 

Initializes the capacative sense system.

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

Definition at line 280 of file capsense.c.

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.

Definition at line 237 of file capsense.c.

References channelsInUse, and currentChannel.