caplesense.c File Reference

Capacitive sense driver. More...

#include "em_device.h"
#include "caplesense.h"
#include <stdint.h>
#include <stdbool.h>
#include "em_emu.h"
#include "em_acmp.h"
#include "em_assert.h"
#include "em_cmu.h"
#include "em_gpio.h"
#include "em_int.h"
#include "em_lesense.h"
#include "caplesenseconfig.h"
Include dependency graph for caplesense.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void CAPLESENSE_setupCMU (void)
 Prototypes.
void CAPLESENSE_setupGPIO (void)
 Setup the GPIO.
void CAPLESENSE_setupACMP (void)
 Setup the ACMP.
void CAPLESENSE_setupLESENSE (bool sleep)
 Setup the LESENSE for capavitive sensing.
void CAPLESENSE_setupCallbacks (void(*scanCb)(void), void(*chCb)(void))
 LESENSE callback setup.
void LESENSE_IRQHandler (void)
 LESENSE interrupt handler.
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_Sleep (void)
 Send the capacative sense system to sleep mode.
void CAPLESENSE_Init (bool sleep)
 Initializes the capacative sense system without LESENSE.

Variables

static volatile uint32_t channelValues [LESENSE_CHANNELS]
 This vector stores the latest read values from LESENSE.
static volatile uint32_t channelMaxValues [LESENSE_CHANNELS]
 This stores the maximum values seen by a channel.
static const bool channelsInUse [LESENSE_CHANNELS] = LESENSE_CAPSENSE_CH_IN_USE
 A bit vector which represents the channels to iterate through.
static void(* lesenseScanCb )(void)
 Local variables.
static void(* lesenseChCb )(void)
 Callback function for LESENSE interrupts.
static volatile uint8_t currentChannel
 The current channel we are sensing.

Detailed Description

Capacitive sense driver.

Author:
Energy Micro AS
Version:
3.20.0

License

(C) Copyright 2012 Energy Micro AS, http://www.energymicro.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. 4. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers and "EFR4" radios.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS 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.

Energy Micro AS 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 caplesense.c.


Function Documentation

void CAPLESENSE_setupACMP ( void   ) 

Setup the ACMP.

Definition at line 158 of file caplesense.c.

Referenced by CAPLESENSE_Init().

Here is the caller graph for this function:

void CAPLESENSE_setupCMU ( void   ) 

Prototypes.

Setup the CMU.

Definition at line 108 of file caplesense.c.

Referenced by CAPLESENSE_Init().

Here is the caller graph for this function:

void CAPLESENSE_setupGPIO ( void   ) 

Setup the GPIO.

Definition at line 141 of file caplesense.c.

Referenced by CAPLESENSE_Init().

Here is the caller graph for this function:

void LESENSE_IRQHandler ( void   ) 

LESENSE interrupt handler.

Definition at line 369 of file caplesense.c.

References channelMaxValues, channelsInUse, channelValues, currentChannel, lesenseChCb, and lesenseScanCb.


Variable Documentation

volatile uint32_t channelMaxValues[LESENSE_CHANNELS] [static]
Initial value:
{

  1, 1, 1, 1, 1, 1, 1, 1,

  1, 1, 1, 1, 1, 1, 1, 1
}

This stores the maximum values seen by a channel.

Parameters:
LESENSE_CHANNELS Vector of channels.

Definition at line 70 of file caplesense.c.

Referenced by CAPLESENSE_getNormalizedVal(), CAPLESENSE_getSliderPosition(), and LESENSE_IRQHandler().

const bool channelsInUse[LESENSE_CHANNELS] = LESENSE_CAPSENSE_CH_IN_USE [static]

A bit vector which represents the channels to iterate through.

Parameters:
LESENSE_CHANNELS Vector of channels.

Definition at line 82 of file caplesense.c.

Referenced by LESENSE_IRQHandler().

volatile uint32_t channelValues[LESENSE_CHANNELS] [static]
Initial value:
{

  0, 0, 0, 0, 0, 0, 0, 0,

  0, 0, 0, 0, 0, 0, 0, 0
}

This vector stores the latest read values from LESENSE.

Parameters:
LESENSE_CHANNELS Vector of channels.

Definition at line 57 of file caplesense.c.

Referenced by CAPLESENSE_getNormalizedVal(), CAPLESENSE_getSliderPosition(), CAPLESENSE_getVal(), and LESENSE_IRQHandler().

volatile uint8_t currentChannel [static]

The current channel we are sensing.

Definition at line 101 of file caplesense.c.

Referenced by LESENSE_IRQHandler().

void(* lesenseChCb)(void) [static]

Callback function for LESENSE interrupts.

Definition at line 98 of file caplesense.c.

Referenced by CAPLESENSE_setupCallbacks(), and LESENSE_IRQHandler().

void(* lesenseScanCb)(void) [static]

Local variables.

Callback function for LESENSE interrupts.

Definition at line 96 of file caplesense.c.

Referenced by CAPLESENSE_setupCallbacks(), and LESENSE_IRQHandler().