XMC Peripheral Library for XMC4000 Family: LEDTS

XMC Peripheral Library for XMC4000 Family

XMC Peripheral Library for XMC4000 Family  2.1.16

Data Structures

struct  XMC_LEDTS_GLOBAL_CONFIG_t
 
struct  XMC_LEDTS_GLOBAL_t
 
struct  XMC_LEDTS_LED_CONFIG_t
 
struct  XMC_LEDTS_TS_CONFIG_ADVANCED_t
 
struct  XMC_LEDTS_TS_CONFIG_BASIC_t
 

Macros

#define XMC_LEDTS0   ((XMC_LEDTS_GLOBAL_t *) LEDTS0)
 
#define XMC_LEDTS0   ((XMC_LEDTS_GLOBAL_t *) LEDTS0)
 

Typedefs

typedef XMC_LEDTS_GLOBAL_t XMC_LEDTS_t
 

Enumerations

Functions

void XMC_LEDTS_ClearInterruptFlag (XMC_LEDTS_t *const ledts, uint32_t interrupt_mask)
 
void XMC_LEDTS_DisableInterrupt (XMC_LEDTS_t *const ledts, uint32_t interrupt_mask)
 
void XMC_LEDTS_EnableInterrupt (XMC_LEDTS_t *const ledts, uint32_t interrupt_mask)
 
XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal (XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config)
 
XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED (XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config)
 
XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config)
 
XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config)
 
uint32_t XMC_LEDTS_ReadFNCOL (XMC_LEDTS_t *const ledts)
 
uint32_t XMC_LEDTS_ReadInterruptFlag (XMC_LEDTS_t *const ledts)
 
uint16_t XMC_LEDTS_ReadTSVAL (XMC_LEDTS_t *const ledts)
 
void XMC_LEDTS_SetActivePADNo (XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num)
 
void XMC_LEDTS_SetColumnBrightness (XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness)
 
void XMC_LEDTS_SetCommonOscillationWindow (XMC_LEDTS_t *const ledts, const uint8_t common_size)
 
void XMC_LEDTS_SetLEDLinePattern (XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern)
 
void XMC_LEDTS_SetNumOfLEDColumns (XMC_LEDTS_t *const ledts, uint8_t count)
 
void XMC_LEDTS_SetOscillationWindow (XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size)
 
void XMC_LEDTS_StartCounter (XMC_LEDTS_t *const ledts, const uint16_t prescaler)
 
void XMC_LEDTS_StopCounter (XMC_LEDTS_t *const ledts)
 

Detailed Description

The LED and Touch-Sense (LEDTS) drives LEDs and controls touch pads used as human-machine interface (HMI) in an application. The LEDTS can measure the capacitance of up to 8 touch pads, can also drive up to 64 LEDs in an LED matrix. Touch pads and LEDs can share pins to minimize the number of pins needed for such applications, this is realized by the module controlling the touch pads and driving the LEDs in a time-division multiplexed manner.

This device contains LEDTS kernel that has an LED driving function and a touch-sensing function.

It is recommended to set up all configurations for the LEDTS in all Special Function Registers(SFR) before enabling and starting LED and/or touch-sense function(s).

This Low Level Driver(LLD) provides APIs to configure and control LED functionality, Touch-Sense functionality and features common to both functionalities.

LED features:

  1. Configuration structure to configure LED functionality (XMC_LEDTS_LED_CONFIG_t) and initialization funtion (XMC_LEDTS_InitLED()).
  2. Selection of number of LED columns, active column level and enabling LED funtionality (XMC_LEDTS_InitLED()).
  3. Setting line pattern to be displayed on LED column (XMC_LEDTS_SetLEDLinePattern()).
  4. Brightness control of LED column (XMC_LEDTS_SetColumnBrightness()).
  5. Setting number of columns to be activated (XMC_LEDTS_SetNumOfLEDColumns()).

Touch-Sense features:

  1. Configuration structure to perform basic Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_BASIC_t) settings and initialization funtion (XMC_LEDTS_InitTSBasic()).
  2. Configuration structure to perform advanced Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_ADVANCED_t) settings and initialization function (XMC_LEDTS_InitTSAdvanced()).
  3. Setting number of touch inputs and acculumate count on touch input (XMC_LEDTS_InitTSBasic()).
  4. Enabling/disabling of common compare, Touch-Sense counter auto reset and Touch-Sense funtionality. (XMC_LEDTS_InitTSBasic()).
  5. Set number of mask bits for time frame validation and first touch input to be active. (XMC_LEDTS_InitTSAdvanced()).
  6. Enable/disable time frame interrupt, external pull-up on touch pin and hardware or software control of pad turn (XMC_LEDTS_InitTSAdvanced()).
  7. Setting size of common oscillation window for all touch-sense inputs (XMC_LEDTS_SetCommonOscillationWindow()).
  8. Setting size of oscillation window for a touch-sense input (XMC_LEDTS_SetOscillationWindow()).

Common features:

  1. Global configuration structure XMC_LEDTS_GLOBAL_CONFIG_t and initialization function XMC_LEDTS_InitGlobal().
  2. Selection of Clock source for LEDTS module (XMC_LEDTS_InitGlobal()).
  3. Kick-start and stop of LEDTS module (XMC_LEDTS_StartCounter() / XMC_LEDTS_StopCounter()).
  4. Read and clear of interrupt status flags (XMC_LEDTS_ReadInterruptFlag() / XMC_LEDTS_ClearInterruptFlag()).
  5. Reading of previous active column number (XMC_LEDTS_ReadFNCOL()).
  6. Enable/Disable Interrupts(XMC_LEDTS_EnableInterrupt() / XMC_LEDTS_DisableInterrupt()).

Macro Definition Documentation

#define XMC_LEDTS0   ((XMC_LEDTS_GLOBAL_t *) LEDTS0)

Typedef for LEDTS kernel0

#define XMC_LEDTS0   ((XMC_LEDTS_GLOBAL_t *) LEDTS0)

Typedef for LEDTS kernel0

Typedef Documentation

Defines typedef for LEDTS Global data structure. Use type XMC_LEDTS_t for this data structure.

Enumeration Type Documentation

Defines number of accumulation counts on Touch-Sense input. Use type XMC_LEDTS_ACCUMULATION_COUNT_t for this enum.

Enumerator
XMC_LEDTS_ACCUMULATION_COUNT_1_TIME 

Accumulate once

XMC_LEDTS_ACCUMULATION_COUNT_2_TIMES 

Accumulate twice

XMC_LEDTS_ACCUMULATION_COUNT_3_TIMES 

Accumulate thrice

XMC_LEDTS_ACCUMULATION_COUNT_4_TIMES 

Accumulate 4 times

XMC_LEDTS_ACCUMULATION_COUNT_5_TIMES 

Accumulate 5 times

XMC_LEDTS_ACCUMULATION_COUNT_6_TIMES 

Accumulate 6 times

XMC_LEDTS_ACCUMULATION_COUNT_7_TIMES 

Accumulate 7 times

XMC_LEDTS_ACCUMULATION_COUNT_8_TIMES 

Accumulate 8 times

XMC_LEDTS_ACCUMULATION_COUNT_9_TIMES 

Accumulate 9 times

XMC_LEDTS_ACCUMULATION_COUNT_10_TIMES 

Accumulate 10 times

XMC_LEDTS_ACCUMULATION_COUNT_11_TIMES 

Accumulate 11 times

XMC_LEDTS_ACCUMULATION_COUNT_12_TIMES 

Accumulate 12 times

XMC_LEDTS_ACCUMULATION_COUNT_13_TIMES 

Accumulate 13 times

XMC_LEDTS_ACCUMULATION_COUNT_14_TIMES 

Accumulate 14 times

XMC_LEDTS_ACCUMULATION_COUNT_15_TIMES 

Accumulate 15 times

XMC_LEDTS_ACCUMULATION_COUNT_16_TIMES 

Accumulate 16 times

Defines level of LED column when active. Use type XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t for this enum.

Enumerator
XMC_LEDTS_ACTIVE_LEVEL_LED_COL_LOW 

LED column pins output low when active

XMC_LEDTS_ACTIVE_LEVEL_LED_COL_HIGH 

LED column pins output high when active

Defines Autoscan time period interrupt flag status. Use type XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_t for this enum.

Enumerator
XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_INACTIVE 

Autoscan time period interrupt not active

XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_ACTIVE 

Autoscan time period interrupt active

Defines Clock master enable/disable. Use type for XMC_LEDTS_CLOCK_TYPE_t for this enum.

Enumerator
XMC_LEDTS_CLOCK_TYPE_MASTER 

Kernel generates its own clock

XMC_LEDTS_CLOCK_TYPE_SLAVE 

Clock is taken from another master kernel

Defines enable/disable of common compare configuration for Touch-Sense. Use type XMC_LEDTS_COMMON_COMPARE_t for this enum.

Enumerator
XMC_LEDTS_COMMON_COMPARE_DISABLE 

Disable common compare for touch-sense

XMC_LEDTS_COMMON_COMPARE_ENABLE 

Enable common compare for touch-sense

Defines External pull-up on touch-sense pin. Use type XMC_LEDTS_EXT_PULLUP_COLA_t for this enum.

Enumerator
XMC_LEDTS_EXT_PULLUP_COLA_DISABLE 

Disable external pull-up. Internal pull-up is active

XMC_LEDTS_EXT_PULLUP_COLA_ENABLE 

Enable external pull-up

Defines extended Touch-Sense output for pin-low-level. Use type XMC_LEDTS_EXTEND_TS_OUTPUT_t for this enum.

Enumerator
XMC_LEDTS_EXTEND_TS_OUTPUT_BY_1_CLK 

Extend Touch-Sense output for pin-low-level by 1 ledts_clk

XMC_LEDTS_EXTEND_TS_OUTPUT_BY_4_CLK 

Extend Touch-Sense output for pin-low-level by 4 ledts_clk

XMC_LEDTS_EXTEND_TS_OUTPUT_BY_8_CLK 

Extend Touch-Sense output for pin-low-level by 8 ledts_clk

XMC_LEDTS_EXTEND_TS_OUTPUT_BY_16_CLK 

Extend Touch-Sense output for pin-low-level by 16 ledts_clk

Defines return value for checking interrupt flag. Use type XMC_LEDTS_FLAG_STATUS_t for this enum.

Enumerator
XMC_LEDTS_FLAG_STATUS_NO 

Flag not raised

XMC_LEDTS_FLAG_STATUS_YES 

Flag is raised

Defines Enable or disable interrupts. Use type XMC_LEDTS_INTERRUPT_t for this enum.

Enumerator
XMC_LEDTS_INTERRUPT_TIMESLICE 

Enable or Disable time slice interrupt

XMC_LEDTS_INTERRUPT_TIMEFRAME 

Enable or Disable time frame interrupt

XMC_LEDTS_INTERRUPT_TIMEPERIOD 

Enable or Disable autoscan time period interrupt

Defines available LED columns. Use type XMC_LEDTS_LED_COLUMN_t for this enum.

Enumerator
XMC_LEDTS_LED_COLUMN_0 

Denotes LED Column 0

XMC_LEDTS_LED_COLUMN_1 

Denotes LED Column 1

XMC_LEDTS_LED_COLUMN_2 

Denotes LED Column 2

XMC_LEDTS_LED_COLUMN_3 

Denotes LED Column 3

XMC_LEDTS_LED_COLUMN_4 

Denotes LED Column 4

XMC_LEDTS_LED_COLUMN_5 

Denotes LED Column 5

XMC_LEDTS_LED_COLUMN_6 

Denotes LED Column 6

XMC_LEDTS_LED_COLUMN_A 

Denotes LED Column A

Defines LED function enable/disable. Use type XMC_LEDTS_LED_FUNC_t for this enum.

Enumerator
XMC_LEDTS_LED_FUNC_DISABLE 

Disable LED function

XMC_LEDTS_LED_FUNC_ENABLE 

Enable LED function

Defines Number of LED columns. Use type XMC_LEDTS_NUMBER_LED_COLUMNS_t for this enum.

Enumerator
XMC_LEDTS_NUMBER_LED_COLUMNS_1 

COLA only if TS is enabled, else COL0 only

XMC_LEDTS_NUMBER_LED_COLUMNS_2 

COLA,COL0 if TS is enabled, else COL0-1

XMC_LEDTS_NUMBER_LED_COLUMNS_3 

COLA,COL0-1 if TS is enabled, else COL0-2

XMC_LEDTS_NUMBER_LED_COLUMNS_4 

COLA,COL0-2 if TS is enabled, else COL0-3

XMC_LEDTS_NUMBER_LED_COLUMNS_5 

COLA,COL0-3 if TS is enabled, else COL0-4

XMC_LEDTS_NUMBER_LED_COLUMNS_6 

COLA,COL0-4 if TS is enabled, else COL0-5

XMC_LEDTS_NUMBER_LED_COLUMNS_7 

COLA,COL0-5 if TS is enabled, else COL0-6

XMC_LEDTS_NUMBER_LED_COLUMNS_8 

Only possible if TS is disabled; COLA,COL0-6 used

Defines number of Touch-Sense Input (for HW pad turn control). Use type XMC_LEDTS_NUMBER_TS_INPUT_t for this enum.

Enumerator
XMC_LEDTS_NUMBER_TS_INPUT_1 

Only TSIN0 is used

XMC_LEDTS_NUMBER_TS_INPUT_2 

TSIN0 & TSIN1 are used

XMC_LEDTS_NUMBER_TS_INPUT_3 

TSIN0-TSIN2 are used

XMC_LEDTS_NUMBER_TS_INPUT_4 

TSIN0-TSIN3 are used

XMC_LEDTS_NUMBER_TS_INPUT_5 

TSIN0-TSIN4 are used

XMC_LEDTS_NUMBER_TS_INPUT_6 

TSIN0-TSIN5 are used

XMC_LEDTS_NUMBER_TS_INPUT_7 

TSIN0-TSIN6 are used

XMC_LEDTS_NUMBER_TS_INPUT_8 

TSIN0-TSIN7 are used

Defines software control for Touch-Sense pad turn. Use type XMC_LEDTS_PAD_TURN_SW_CONTROL_t for this enum.

Enumerator
XMC_LEDTS_SW_CONTROL_DISABLE 

Disable software control. Auto hardware control

XMC_LEDTS_SW_CONTROL_ENABLE 

Enable software control for pad turn

Defines Touch-Sense TSIN pad turn. Use type XMC_LEDTS_PAD_TURN_t for this enum.

Enumerator
XMC_LEDTS_PAD_TURN_0 

TSIN0 is next or currently active

XMC_LEDTS_PAD_TURN_1 

TSIN1 is next or currently active

XMC_LEDTS_PAD_TURN_2 

TSIN2 is next or currently active

XMC_LEDTS_PAD_TURN_3 

TSIN3 is next or currently active

XMC_LEDTS_PAD_TURN_4 

TSIN4 is next or currently active

XMC_LEDTS_PAD_TURN_5 

TSIN5 is next or currently active

XMC_LEDTS_PAD_TURN_6 

TSIN6 is next or currently active

XMC_LEDTS_PAD_TURN_7 

TSIN7 is next or currently active

Defines return value of an API. Use type XMC_LEDTS_STATUS_t for this enum.

Enumerator
XMC_LEDTS_STATUS_SUCCESS 

API fulfills request

XMC_LEDTS_STATUS_RUNNING 

The kernel-counter is currently running

XMC_LEDTS_STATUS_ERROR 

API cannot fulfill request

XMC_LEDTS_STATUS_IDLE 

The kernel-counter is currently idle

Defines Suspend request configuration. Use type XMC_LEDTS_SUSPEND_t for this enum.

Enumerator
XMC_LEDTS_SUSPEND_DISABLE 

Ignore suspend request

XMC_LEDTS_SUSPEND_ENABLE 

Enable suspend according to request

Defines (Extended) Time frame interrupt flag status. Use type XMC_LEDTS_TF_INTERRUPT_FLAG_t for this enum.

Enumerator
XMC_LEDTS_TF_INTERRUPT_FLAG_INACTIVE 

(Extended) Time frame interrupt not active

XMC_LEDTS_TF_INTERRUPT_FLAG_ACTIVE 

(Extended) Time frame interrupt active

Defines Enable/disable of (extended) time frame validation. Use type XMC_LEDTS_TF_VALIDATION_t for this enum.

Enumerator
XMC_LEDTS_TF_VALIDATION_DISABLE 

Disable time frame validation

XMC_LEDTS_TF_VALIDATION_ENABLE 

Enable time frame validation

Defines enable/disable of autoscan time period synchronization. Use type XMC_LEDTS_TP_SYNC_t for this enum.

Enumerator
XMC_LEDTS_TP_SYNC_DISABLE 

Synchronization is disabled

XMC_LEDTS_TP_SYNC_ENABLE 

Synchronization enabled on Kernel0 autoscan time period

Defines enable/disable of Touch-Sense counter auto reset configuration. Use type XMC_LEDTS_TS_COUNTER_AUTO_RESET_t for this enum.

Enumerator
XMC_LEDTS_TS_COUNTER_AUTO_RESET_DISABLE 

Disable Touch-Sense counter automatic reset

XMC_LEDTS_TS_COUNTER_AUTO_RESET_ENABLE 

Enable Touch-Sense counter automatic reset to 0x00

Defines number of bits to mask for time frame event validation. Use type XMC_LEDTS_TS_COUNTER_MASK_t for this enum.

Enumerator
XMC_LEDTS_TS_COUNTER_MASK_1_LSB 

Mask LSB bit only

XMC_LEDTS_TS_COUNTER_MASK_2_LSB 

Mask 2 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_3_LSB 

Mask 3 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_4_LSB 

Mask 4 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_5_LSB 

Mask 5 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_6_LSB 

Mask 6 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_7_LSB 

Mask 7 LSB bits

XMC_LEDTS_TS_COUNTER_MASK_8_LSB 

Mask 8 LSB bits

Defines Touch-Sense counter overflow indication. Use type XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_t for this enum.

Enumerator
XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_NO 

Touch-sense counter has not overflowed

XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_YES 

Touch-sense counter has overflowed at least once

Defines enable/disable of Touch-Sense counter saturation configuration. Use type XMC_LEDTS_TS_COUNTER_SATURATION_t for this enum.

Enumerator
XMC_LEDTS_TS_COUNTER_SATURATION_DISABLE 

Disabled. Touch-Sense counter overflows when it reaches 0xFF

XMC_LEDTS_TS_COUNTER_SATURATION_ENABLE 

Enabled. Touch-Sense counter stops counting when it reaches 0xFF

Defines Touch-Sense function enable/disable. Use type XMC_LEDTS_TS_FUNC_t for this enum.

Enumerator
XMC_LEDTS_TS_FUNC_DISABLE 

Disable touch-sense function

XMC_LEDTS_TS_FUNC_ENABLE 

Enable touch-sense function

Defines available Touch-Sense inputs. Use type XMC_LEDTS_TS_INPUT_t for this enum.

Enumerator
XMC_LEDTS_TS_INPUT_0 

TSIN0 - Denotes touch-sense line 1

XMC_LEDTS_TS_INPUT_1 

TSIN1 - Denotes touch-sense line 2

XMC_LEDTS_TS_INPUT_2 

TSIN2 - Denotes touch-sense line 3

XMC_LEDTS_TS_INPUT_3 

TSIN3 - Denotes touch-sense line 4

XMC_LEDTS_TS_INPUT_4 

TSIN4 - Denotes touch-sense line 5

XMC_LEDTS_TS_INPUT_5 

TSIN5 - Denotes touch-sense line 6

XMC_LEDTS_TS_INPUT_6 

TSIN6 - Denotes touch-sense line 7

XMC_LEDTS_TS_INPUT_7 

TSIN7 - Denotes touch-sense line 8

Defines Interrupt flag status. Use type XMC_LEDTS_TS_INTERRUPT_FLAG_t for this enum.

Enumerator
XMC_LEDTS_INTERRUPT_FLAG_TIMESLICE 

Time slice interrupt flag status

XMC_LEDTS_INTERRUPT_FLAG_TIMEFRAME 

Time frame interrupt flag status

XMC_LEDTS_INTERRUPT_FLAG_TIMEPERIOD 

Time period interrupt flag status

XMC_LEDTS_INTERRUPT_FLAG_TSCOUNTER_OVERFLOW 

TS counter overflow flag status

Function Documentation

void XMC_LEDTS_ClearInterruptFlag ( XMC_LEDTS_t *const  ledts,
uint32_t  interrupt_mask 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
interrupt_maskmask value of XMC_LEDTS_INTERRUPT_t enum type.
Returns
None.
Description
Clears interrupt status flags in EVFR register as indicated by mask value interrupt_mask.
This API sets EVFR.CTSF, EVFR.CTFF, EVFR.CTPF bit fields to clear time slice, time frame or time period interrupts respectively.
Typically used along with XMC_LEDTS_ReadInterruptFlag() to figure out which event triggered the interrupt.
Note
Calling this API moves interrupt from pending/active state to inactive state. If the interrupt is pulsed, failing to clear the event bit might cause CPU to immediately re-enter the interrupt service routine(ISR).
Related API's
XMC_LEDTS_ReadInterruptFlag().
void XMC_LEDTS_DisableInterrupt ( XMC_LEDTS_t *const  ledts,
uint32_t  interrupt_mask 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
interrupt_maskmask value of XMC_LEDTS_INTERRUPT_t enum type.
Returns
None.
Description
Disables requested interrupt type by configuring GLOBCTL register with masked value interrupt_mask.
This API can be used to disable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.
Related API's
XMC_LEDTS_EnableInterrupt().
void XMC_LEDTS_EnableInterrupt ( XMC_LEDTS_t *const  ledts,
uint32_t  interrupt_mask 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
interrupt_maskmask value of XMC_LEDTS_INTERRUPT_t enum type.
Returns
None.
Description
Enables requested interrupt type by configuring GLOBCTL register with masked value interrupt_mask.
This API can be used to enable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.
Related API's
XMC_LEDTS_DisableInterrupt().
XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal ( XMC_LEDTS_t *const  ledts,
const XMC_LEDTS_GLOBAL_CONFIG_t config 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
configPointer to constant LEDTS Global configuration structure. Refer XMC_LEDTS_GLOBAL_CONFIG_t data structure.
Returns
XMC_LEDTS_STATUS_SUCCESS - on success.
XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active. Refer XMC_LEDTS_STATUS_t enum type.
Description
Initializes and configures GLOBCTL register of ledts with configuration data pointed by config.
This API selects clock source (GLOBCTL.CMTR), enables/disables auto scan sync(GLOBCTL.ENSYNC) & suspend config(GLOBCTL.SUSCFG).
Call this API to initialize global register fields common to both LED and touch-sense(TS).
Note
LEDTS should be stopped by using XMC_LEDTS_StopCounter()before calling this API.
Related API's
XMC_LEDTS_StopCounter()
XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED ( XMC_LEDTS_t *const  ledts,
const XMC_LEDTS_LED_CONFIG_t config 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
configPointer to constant LEDTS LED configuration structure. Refer XMC_LEDTS_LED_CONFIG_t data structure.
Returns
XMC_LEDTS_STATUS_SUCCESS - on success.
XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer XMC_LEDTS_STATUS_t enum type.
Description
Configures FNCTL register of ledts with configuration data pointed by config and enables LED functionality.
This API sets number of LED columns(FNCTL.NR_LEDCOL), column level(FNCTL.COLLEV) and enables LED functionality(GLOBCTL.LD_EN).
Call this API to Configure FNCTL & GLOBCTL registers for LED-driving function. Global initialization of LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.
Note
LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.
Related API's
XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()
XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced ( XMC_LEDTS_t *const  ledts,
const XMC_LEDTS_TS_CONFIG_ADVANCED_t config 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
configPointer to constant LEDTS TS advanced configuration structure. Refer XMC_LEDTS_TS_CONFIG_ADVANCED_t data structure.
Returns
XMC_LEDTS_STATUS_SUCCESS - on success.
XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer XMC_LEDTS_STATUS_t enum type.
Description
Configures FNCTL register of ledts for advanced touch sense functionality with configuration data pointed by config.
This API sets number of mask-bits for time frame validation(GLOBCTL.MASKVAL) & first touch input to be active(if pad turn control is set to S/W)(FNCTL.PADT).
Enables/disables time frame interrupt(GLOBCTL.ITF_EN), external pull up on touch pin(FNCTL.EPULL) & H/W or S/W control of pad turn(if set to H/W, touch input activation is done in round-robin sequence, starting from TSIN0) (FNCTL.PADTSW).
Call this API to initialize registers for advanced touch sense function. Before calling this API Call XMC_LEDTS_InitGlobal() to do Global initialization and XMC_LEDTS_InitTSBasic() to do basic init of touch-sense.
Note
LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.
Related API's
XMC_LEDTS_StopCounter(), XMC_LEDTS_InitTSBasic().
XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic ( XMC_LEDTS_t *const  ledts,
const XMC_LEDTS_TS_CONFIG_BASIC_t config 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
configPointer to constant LEDTS TS basic configuration structure. Refer XMC_LEDTS_TS_CONFIG_BASIC_t data structure.
Returns
XMC_LEDTS_STATUS_SUCCESS - on success.
XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer XMC_LEDTS_STATUS_t enum type.
Description
Configures FNCTL register of ledts for basic touch sense functionality with configuration data pointed by config and enables TS functionality.
This API sets number of touch inputs(FNCTL.NR_TSIN), accumulate count on touch input(FNCTL.ACCCNT).
This API Enables/disables common compare(FNCTL.TSCCMP), TS counter auto reset(FNCTL.TSCTRR), counter saturation(FNCTL.TSCTRSAT) and enables TS functionality(GLOBCTL.TS_EN).
Call this API to configure FNCTL & GLOBCTL registers for basic touch sense function. Global initialization of LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.
Note
LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.
Related API's
XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()
uint32_t XMC_LEDTS_ReadFNCOL ( XMC_LEDTS_t *const  ledts)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
Returns
uint32_t Previous active LED column number. Range: 0 to 7.
Description
Returns active LED column number in previous time-slice by reading FNCOL bit field of FNCTL register. Call this API to figure out active column during previous time slice.
uint32_t XMC_LEDTS_ReadInterruptFlag ( XMC_LEDTS_t *const  ledts)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
Returns
Status flags for events. Possible event flags are 0x01(time slice), 0x02(time frame), 0x04(time period), 0x08(TS counter overflow).
Description
Returns interrupt status flag by reading TSF(time slice), TFF(time frame), TPF(time period), TSCTROVF (touch sense counter overflow) fields of EVFR register.
Typically used in interrupt handler to find out which event has triggered the interrupt.
Note
These flags are set on event regardless of corresponding interrupt is enabled or not.
Related API's
XMC_LEDTS_ClearInterruptFlag().
uint16_t XMC_LEDTS_ReadTSVAL ( XMC_LEDTS_t *const  ledts)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
Returns
uint16_t Shadow touch sense counter value. Range: 0H to FFFFH.
Description
Returns latched touch sense counter value by reading the TSCTRVALR field of TSVAL register.
This API is typically called in time frame(TF) event handler to get oscillation count of the touch-sense input active in previous time frame.
Note
This is the latched value of the TS-counter(on every extended time frame event).
Related API's
XMC_LEDTS_ReadInterruptFlag().
void XMC_LEDTS_SetActivePADNo ( XMC_LEDTS_t *const  ledts,
XMC_LEDTS_NUMBER_TS_INPUT_t  pad_num 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
pad_numPad number. Range refer XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
Returns
None.
Description
Sets TSIN[x] (where x corresponds to active pad number to be set) field of TSIN[x](x = 0-7) .
This is the TSIN[x] pin that is next or currently active in pad turn.
Call this API to set the active pad turn.
Touch sense functionality should be initialized and configured before calling this API.
void XMC_LEDTS_SetColumnBrightness ( XMC_LEDTS_t *const  ledts,
XMC_LEDTS_LED_COLUMN_t  column,
const uint8_t  brightness 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
columnColumn number. Range refer XMC_LEDTS_LED_COLUMN_t enum type.
brightnessLED brightness level. Range: 0H(min brightness) to FFH(max brightness).
Returns
None.
Description
Programs CMP_LDx (where x denotes column number) field of LDCMPx(x = 0-1)register to the requested brightness level.
The LDCMPx registers hold the COMPARE values for their respective LED columns. These values are used for LED brightness control. Call this API to control brightness level of the LED.
LED functionality should be initialized and configured before calling this API.
void XMC_LEDTS_SetCommonOscillationWindow ( XMC_LEDTS_t *const  ledts,
const uint8_t  common_size 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
common_sizeRequested common oscillation window width. Range: FFH(min) to 00H.(max)
Returns
None.
Description
Programs the respective LDCMP1 register bit field CMP_LDA_TSCOM with common_size.
Call this API to adjust the size of the common oscillation window to increase/decrease the number of recorded number of oscillation counts for all touch-sense inputs.
void XMC_LEDTS_SetLEDLinePattern ( XMC_LEDTS_t *const  ledts,
XMC_LEDTS_LED_COLUMN_t  column,
const uint8_t  pattern 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
columnColumn number. Range refer XMC_LEDTS_LED_COLUMN_t enum type.
patternPattern to be displayed. Range: 0H to FFH.
Returns
None.
Description
Sets LINE_x (where x corresponds to column number) field of LINEx(x = 0-1) register to pattern value.
This value is output on LINE_x when LED column x is active.
Call this API to set desired LED pattern.
LED functionality should be initialized and configured before calling this API.
void XMC_LEDTS_SetNumOfLEDColumns ( XMC_LEDTS_t *const  ledts,
uint8_t  count 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure
countNumber of LED columns to be enabled. Range: 0 to 7.
Returns
None.
Description
Sets count number of LED columns active by programming NR_LEDCOL bit field of FNCTL register.
Call this API to set desired number of LED columns active.
Note
NR_LEDCOL bit field can only be modified when LEDTS counter is not running, use XMC_LEDTS_StopCounter() to stop LEDTS module before calling this API.
Related API's
XMC_LEDTS_StopCounter().
void XMC_LEDTS_SetOscillationWindow ( XMC_LEDTS_t *const  ledts,
XMC_LEDTS_NUMBER_TS_INPUT_t  touchpad,
const uint8_t  size 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
touchpadTouch-sense input pad number. Range refer XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
sizeRequested oscillation window width. Range: 0H(max) to FFH(min).
Returns
None.
Description
Sets the size of touchpad touch sense oscillation window to size.
This API programs the respective CMP_TSx(where x is touchpad number) bit fields of TSCMPx(x = 0-1) register. size value determines the size of the pad oscillation window for each pad input lines during their pad turn.
Call this API to increase/decrease recorded number of oscillation counts for the requested touch-sense input.
void XMC_LEDTS_StartCounter ( XMC_LEDTS_t *const  ledts,
const uint16_t  prescaler 
)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
prescalerConstant prescaler value. Range: 0H to FFFFH.
Returns
None.
Description
Kick-starts the LEDTS module by programming CLK_PS bit field of GLOBCTL register with prescaler value to start the LEDTS-counter.
To set LEDTS counter at least one of the touch-sense or LED function should be enabled. Call this API to start LEDTS counter.
Note
This should be called after all used modules have been initialized.
Related API's
XMC_LEDTS_StopCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().
void XMC_LEDTS_StopCounter ( XMC_LEDTS_t *const  ledts)
Parameters
ledtsConstant pointer to LEDTS module structure. Refer XMC_LEDTS_GLOBAL_t data structure.
Returns
None.
Description
Stops the LEDTS module by programming the CLK_PS bit field(with value = 0) of GLOBCTL register.
This could be done when it is required to change some module configuration which requires the LEDTS-counter to be stopped before the register bit/bit field can be programmed.
Call this API to stop LEDTS counter.
Related API's
XMC_LEDTS_StartCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by   doxygen 1.8.11