Kinetis SDK v.2.0 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
The KSDK provides a driver for the Touch Sensing Input (TSI) module of Kinetis devices.
Files | |
file | fsl_tsi_v2.h |
Data Structures | |
struct | tsi_calibration_data_t |
TSI calibration data storage. More... | |
struct | tsi_config_t |
TSI configuration structure. More... | |
Functions | |
void | TSI_Init (TSI_Type *base, const tsi_config_t *config) |
Initializes hardware. More... | |
void | TSI_Deinit (TSI_Type *base) |
De-initializes hardware. More... | |
void | TSI_GetNormalModeDefaultConfig (tsi_config_t *userConfig) |
Gets TSI normal mode user configuration structure. More... | |
void | TSI_GetLowPowerModeDefaultConfig (tsi_config_t *userConfig) |
Gets the TSI low power mode default user configuration structure. More... | |
void | TSI_Calibrate (TSI_Type *base, tsi_calibration_data_t *calBuff) |
Hardware calibration. More... | |
void | TSI_EnableInterrupts (TSI_Type *base, uint32_t mask) |
Enables the TSI interrupt requests. More... | |
void | TSI_DisableInterrupts (TSI_Type *base, uint32_t mask) |
Disables the TSI interrupt requests. More... | |
static uint32_t | TSI_GetStatusFlags (TSI_Type *base) |
Gets the interrupt flags. More... | |
void | TSI_ClearStatusFlags (TSI_Type *base, uint32_t mask) |
Clears the interrupt flags. More... | |
static uint32_t | TSI_GetScanTriggerMode (TSI_Type *base) |
Gets the TSI scan trigger mode. More... | |
static bool | TSI_IsScanInProgress (TSI_Type *base) |
Gets the scan in progress flag. More... | |
static void | TSI_SetElectrodeOSCPrescaler (TSI_Type *base, tsi_electrode_osc_prescaler_t prescaler) |
Sets the electrode oscillator prescaler. More... | |
static void | TSI_SetNumberOfScans (TSI_Type *base, tsi_n_consecutive_scans_t number) |
Sets the number of scans (NSCN). More... | |
static void | TSI_EnableModule (TSI_Type *base, bool enable) |
Enables/disables the TSI module. More... | |
static void | TSI_EnableLowPower (TSI_Type *base, bool enable) |
Enables/disables the TSI module in low power stop mode. More... | |
static void | TSI_EnablePeriodicalScan (TSI_Type *base, bool enable) |
Enables/disables the periodical (hardware) trigger scan. More... | |
static void | TSI_StartSoftwareTrigger (TSI_Type *base) |
Starts a measurement (trigger a new measurement). More... | |
static void | TSI_SetLowPowerScanInterval (TSI_Type *base, tsi_low_power_scan_interval_t interval) |
Sets a low power scan interval. More... | |
static void | TSI_SetLowPowerClock (TSI_Type *base, uint32_t clock) |
Sets a low power clock. More... | |
static void | TSI_SetReferenceChargeCurrent (TSI_Type *base, tsi_reference_osc_charge_current_t current) |
Sets the reference oscillator charge current. More... | |
static void | TSI_SetElectrodeChargeCurrent (TSI_Type *base, tsi_external_osc_charge_current_t current) |
Sets the electrode charge current. More... | |
static void | TSI_SetScanModulo (TSI_Type *base, uint32_t modulo) |
Sets the scan modulo value. More... | |
static void | TSI_SetActiveModeSource (TSI_Type *base, uint32_t source) |
Sets the active mode source. More... | |
static void | TSI_SetActiveModePrescaler (TSI_Type *base, tsi_active_mode_prescaler_t prescaler) |
Sets the active mode prescaler. More... | |
static void | TSI_SetLowPowerChannel (TSI_Type *base, uint16_t channel) |
Sets the low power channel. More... | |
static uint32_t | TSI_GetLowPowerChannel (TSI_Type *base) |
Gets the enabled channel in low power modes. More... | |
static void | TSI_EnableChannel (TSI_Type *base, uint16_t channel, bool enable) |
Enables/disables a channel. More... | |
static void | TSI_EnableChannels (TSI_Type *base, uint16_t channelsMask, bool enable) |
Enables/disables channels. More... | |
static bool | TSI_IsChannelEnabled (TSI_Type *base, uint16_t channel) |
Returns if a channel is enabled. More... | |
static uint16_t | TSI_GetEnabledChannels (TSI_Type *base) |
Returns the mask of enabled channels. More... | |
static uint16_t | TSI_GetWakeUpChannelCounter (TSI_Type *base) |
Gets the wake up channel counter for low-power mode usage. More... | |
static uint16_t | TSI_GetNormalModeCounter (TSI_Type *base, uint16_t channel) |
Gets the TSI conversion counter of a specific channel in normal mode. More... | |
static void | TSI_SetLowThreshold (TSI_Type *base, uint16_t low_threshold) |
Sets a low threshold. More... | |
static void | TSI_SetHighThreshold (TSI_Type *base, uint16_t high_threshold) |
Sets a high threshold. More... | |
Driver version | |
#define | FSL_TSI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
TSI driver version 2.0.0. More... | |
struct tsi_calibration_data_t |
Data Fields | |
uint16_t | calibratedData [FSL_FEATURE_TSI_CHANNEL_COUNT] |
TSI calibration data storage buffer. | |
struct tsi_config_t |
This structure contains the settings for the most common TSI configurations including the TSI module charge currents, number of scans, thresholds, and so on.
Data Fields | |
uint16_t | thresh |
High threshold. More... | |
uint16_t | thresl |
Low threshold. More... | |
tsi_low_power_clock_source_t | lpclks |
Low power clock. More... | |
tsi_low_power_scan_interval_t | lpscnitv |
Low power scan interval. More... | |
tsi_active_mode_clock_source_t | amclks |
Active mode clock source. More... | |
tsi_active_mode_prescaler_t | ampsc |
Active mode prescaler. More... | |
tsi_electrode_osc_prescaler_t | ps |
Electrode Oscillator Prescaler. | |
tsi_external_osc_charge_current_t | extchrg |
External Oscillator charge current. More... | |
tsi_reference_osc_charge_current_t | refchrg |
Reference Oscillator charge current. More... | |
tsi_n_consecutive_scans_t | nscn |
Number of scans. More... | |
tsi_electrode_osc_prescaler_t | prescaler |
Prescaler. | |
tsi_analog_mode_t | mode |
TSI mode of operation. More... | |
tsi_osc_voltage_rails_t | dvolt |
Oscillator's voltage rails. More... | |
tsi_series_resistor_t | resistor |
Series resistance value. | |
tsi_filter_bits_t | filter |
Noise mode filter bits. | |
uint16_t tsi_config_t::thresh |
uint16_t tsi_config_t::thresl |
tsi_low_power_clock_source_t tsi_config_t::lpclks |
tsi_low_power_scan_interval_t tsi_config_t::lpscnitv |
tsi_active_mode_clock_source_t tsi_config_t::amclks |
tsi_active_mode_prescaler_t tsi_config_t::ampsc |
tsi_external_osc_charge_current_t tsi_config_t::extchrg |
Electrode charge current.
tsi_reference_osc_charge_current_t tsi_config_t::refchrg |
Reference charge current.
tsi_n_consecutive_scans_t tsi_config_t::nscn |
tsi_analog_mode_t tsi_config_t::mode |
tsi_osc_voltage_rails_t tsi_config_t::dvolt |
#define FSL_TSI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
These constants define the TSI number of consecutive scans in a TSI instance for each electrode.
These constants define the TSI electrode oscillator prescaler in a TSI instance.
These constants define the TSI low power scan intervals in a TSI instance.
These constants define the TSI Reference oscillator charge current select in a TSI instance.
These constants define the TSI External oscillator charge current select in a TSI instance.
These constants define the active mode clock source in a TSI instance.
These constants define the TSI active mode prescaler in a TSI instance.
enum tsi_status_flags_t |
void TSI_Init | ( | TSI_Type * | base, |
const tsi_config_t * | config | ||
) |
Initializes the peripheral to the targeted state specified by the parameter configuration, such as initialize and set prescalers, number of scans, clocks, delta voltage capacitance trimmer, reference, and electrode charge current and threshold.
base | TSI peripheral base address. |
config | Pointer to the TSI peripheral configuration structure. |
void TSI_Deinit | ( | TSI_Type * | base | ) |
De-initializes the peripheral to default state.
base | TSI peripheral base address. |
void TSI_GetNormalModeDefaultConfig | ( | tsi_config_t * | userConfig | ) |
This interface sets the userConfig structure to a default value. The configuration structure only includes the settings for the whole TSI. The user configure is set to these values:
userConfig | Pointer to the TSI user configuration structure. |
void TSI_GetLowPowerModeDefaultConfig | ( | tsi_config_t * | userConfig | ) |
This interface sets userConfig structure to a default value. The configuration structure only includes the settings for the whole TSI. The user configure is set to these values:
userConfig | Pointer to the TSI user configuration structure. |
void TSI_Calibrate | ( | TSI_Type * | base, |
tsi_calibration_data_t * | calBuff | ||
) |
Calibrates the peripheral to fetch the initial counter value of the enabled electrodes. This API is mostly used at the initial application setup. Call this function after the TSI_Init API and use the calibrated counter values to set up applications (such as to determine under which counter value a touch event occurs).
base | TSI peripheral base address. |
calBuff | Data buffer that store the calibrated counter value. |
void TSI_EnableInterrupts | ( | TSI_Type * | base, |
uint32_t | mask | ||
) |
base | TSI peripheral base address. |
mask | interrupt source The parameter can be a combination of the following source if defined:
|
void TSI_DisableInterrupts | ( | TSI_Type * | base, |
uint32_t | mask | ||
) |
base | TSI peripheral base address. |
mask | interrupt source The parameter can be a combination of the following source if defined:
|
|
inlinestatic |
This function get TSI interrupt flags.
base | TSI peripheral base address. |
void TSI_ClearStatusFlags | ( | TSI_Type * | base, |
uint32_t | mask | ||
) |
This function clears the TSI interrupt flags.
base | TSI peripheral base address. |
mask | the status flags to clear. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
prescaler | Prescaler value. |
|
inlinestatic |
base | TSI peripheral base address. |
number | Number of scans. |
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose whether to enable TSI module.
|
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose whether to enable TSI module in low power modes.
|
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose whether to enable periodical trigger scan.
|
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
interval | Interval for low power scan. |
|
inlinestatic |
base | TSI peripheral base address. |
clock | Low power clock selection. |
|
inlinestatic |
base | TSI peripheral base address. |
current | The reference oscillator charge current. |
|
inlinestatic |
base | TSI peripheral base address. |
current | The external electrode charge current. |
|
inlinestatic |
base | TSI peripheral base address. |
modulo | Scan modulo value. |
|
inlinestatic |
base | TSI peripheral base address. |
source | Active mode clock source (LPOSCCLK, MCGIRCLK, OSCERCLK). |
|
inlinestatic |
base | TSI peripheral base address. |
prescaler | Prescaler value. |
|
inlinestatic |
Only one channel can be enabled in low power mode.
base | TSI peripheral base address. |
channel | Channel number. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
channel | Channel to be enabled. |
enable | Choose whether to enable specific channel.
|
|
inlinestatic |
The function enables or disables channels by mask. It can enable/disable all channels at once.
base | TSI peripheral base address. |
channelsMask | Channels mask that indicate channels that are to be enabled/disabled. |
enable | Choose to enable or disable the specified channels.
|
|
inlinestatic |
base | TSI peripheral base address. |
channel | Channel to be checked. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
channel | Index of the specific TSI channel. |
|
inlinestatic |
base | TSI peripheral base address. |
low_threshold | Low counter threshold. |
|
inlinestatic |
base | TSI peripheral base address. |
high_threshold | High counter threshold. |