![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This section describes the programming interface of the TSI Peripheral driver.
This function group initializes the default configuration of the peripheral.
This function group implements the TSI functional APIs, including interrupts enable/disable, trigger method selection, and retrieve conversion counter value.
Data Structures | |
struct | tsi_calibration_data_t |
TSI calibration data storage. More... | |
struct | tsi_common_config_t |
TSI common configuration structure. More... | |
struct | tsi_selfCap_config_t |
TSI configuration structure for self-cap mode. More... | |
struct | tsi_mutualCap_config_t |
TSI configuration structure for mutual-cap mode. More... | |
Macros | |
#define | FSL_TSI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
TSI driver version. More... | |
#define | ALL_FLAGS_MASK (TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK) |
TSI status flags macro collection. | |
Functions | |
void | TSI_InitSelfCapMode (TSI_Type *base, const tsi_selfCap_config_t *config) |
Initialize hardware to Self-cap mode. More... | |
void | TSI_InitMutualCapMode (TSI_Type *base, const tsi_mutualCap_config_t *config) |
Initialize hardware to Mutual-cap mode. More... | |
void | TSI_Deinit (TSI_Type *base) |
De-initialize hardware. More... | |
void | TSI_GetSelfCapModeDefaultConfig (tsi_selfCap_config_t *userConfig) |
Get TSI self-cap mode user configure structure. More... | |
void | TSI_GetMutualCapModeDefaultConfig (tsi_mutualCap_config_t *userConfig) |
Get TSI mutual-cap mode default user configure structure. More... | |
void | TSI_SelfCapCalibrate (TSI_Type *base, tsi_calibration_data_t *calBuff) |
Hardware base counter value for calibration. More... | |
void | TSI_EnableInterrupts (TSI_Type *base, uint32_t mask) |
Enables TSI interrupt requests. More... | |
void | TSI_DisableInterrupts (TSI_Type *base, uint32_t mask) |
Disables TSI interrupt requests. More... | |
static uint32_t | TSI_GetStatusFlags (TSI_Type *base) |
Get interrupt flag. More... | |
void | TSI_ClearStatusFlags (TSI_Type *base, uint32_t mask) |
Clear interrupt flag. More... | |
static uint32_t | TSI_GetScanTriggerMode (TSI_Type *base) |
Get TSI scan trigger mode. More... | |
static bool | TSI_IsScanInProgress (TSI_Type *base) |
Get scan in progress flag. More... | |
static void | TSI_EnableModule (TSI_Type *base, bool enable) |
Enables the TSI Module or not. More... | |
static void | TSI_EnableLowPower (TSI_Type *base, bool enable) |
Sets the TSI low power STOP mode enable or not. More... | |
static void | TSI_EnableHardwareTriggerScan (TSI_Type *base, bool enable) |
Enable the hardware trigger scan or not. More... | |
static void | TSI_StartSoftwareTrigger (TSI_Type *base) |
Start one sotware trigger measurement (trigger a new measurement). More... | |
static void | TSI_SetSelfCapMeasuredChannel (TSI_Type *base, uint8_t channel) |
Set the measured channel number for self-cap mode. More... | |
static uint8_t | TSI_GetSelfCapMeasuredChannel (TSI_Type *base) |
Get the current measured channel number, in self-cap mode. More... | |
static void | TSI_EnableDmaTransfer (TSI_Type *base, bool enable) |
Enable DMA transfer or not. More... | |
static void | TSI_EnableEndOfScanDmaTransferOnly (TSI_Type *base, bool enable) |
Decide whether to enable End of Scan DMA transfer request only. More... | |
static uint16_t | TSI_GetCounter (TSI_Type *base) |
Gets the conversion counter value. More... | |
static void | TSI_SetLowThreshold (TSI_Type *base, uint16_t low_threshold) |
Set the TSI wake-up channel low threshold. More... | |
static void | TSI_SetHighThreshold (TSI_Type *base, uint16_t high_threshold) |
Set the TSI wake-up channel high threshold. More... | |
static void | TSI_SetMainClock (TSI_Type *base, tsi_main_clock_selection_t mainClock) |
Set the main clock of the TSI module. More... | |
static void | TSI_SetSensingMode (TSI_Type *base, tsi_sensing_mode_selection_t mode) |
Set the sensing mode of the TSI module. More... | |
static tsi_sensing_mode_selection_t | TSI_GetSensingMode (TSI_Type *base) |
Get the sensing mode of the TSI module. More... | |
static void | TSI_SetDvolt (TSI_Type *base, tsi_dvolt_option_t dvolt) |
Set the DVOLT settings. More... | |
static void | TSI_EnableNoiseCancellation (TSI_Type *base, bool enableCancellation) |
Enable self-cap mode noise cancellation function or not. More... | |
static void | TSI_SetMutualCapTxChannel (TSI_Type *base, tsi_mutual_tx_channel_t txChannel) |
Set the mutual-cap mode TX channel. More... | |
static tsi_mutual_tx_channel_t | TSI_GetTxMutualCapMeasuredChannel (TSI_Type *base) |
Get the current measured TX channel number, in mutual-cap mode. More... | |
static void | TSI_SetMutualCapRxChannel (TSI_Type *base, tsi_mutual_rx_channel_t rxChannel) |
Set the mutual-cap mode RX channel. More... | |
static tsi_mutual_rx_channel_t | TSI_GetRxMutualCapMeasuredChannel (TSI_Type *base) |
Get the current measured RX channel number, in mutual-cap mode. More... | |
static void | TSI_SetSscMode (TSI_Type *base, tsi_ssc_mode_t mode) |
Set the SSC clock mode of the TSI module. More... | |
static void | TSI_SetSscPrescaler (TSI_Type *base, tsi_ssc_prescaler_t prescaler) |
Set the SSC prescaler of the TSI module. More... | |
struct tsi_calibration_data_t |
Data Fields | |
uint16_t | calibratedData [FSL_FEATURE_TSI_CHANNEL_COUNT] |
TSI calibration data storage buffer. | |
struct tsi_common_config_t |
This structure contains the common settings for TSI self-cap or mutual-cap mode, configurations including the TSI module main clock, sensing mode, DVOLT options, SINC and SSC configurations.
Data Fields | |
tsi_main_clock_selection_t | mainClock |
Set main clock. More... | |
tsi_sensing_mode_selection_t | mode |
Choose sensing mode. More... | |
tsi_dvolt_option_t | dvolt |
DVOLT option value. More... | |
tsi_sinc_cutoff_div_t | cutoff |
Cutoff divider. More... | |
tsi_sinc_filter_order_t | order |
SINC filter order. More... | |
tsi_sinc_decimation_value_t | decimation |
SINC decimation value. More... | |
tsi_ssc_charge_num_t | chargeNum |
SSC High Width (t1), SSC output bit0's period setting. More... | |
tsi_ssc_prbs_outsel_t | prbsOutsel |
SSC High Random Width (t2), length of PRBS(Pseudo-RandomBinarySequence),SSC output bit2's period setting. More... | |
tsi_ssc_nocharge_num_t | noChargeNum |
SSC Low Width (t3), SSC output bit1's period setting. More... | |
tsi_ssc_mode_t | ssc_mode |
Clock mode selection (basic - from main clock by divider,advanced - using SSC(Switching Speed Clock) by three configurable intervals. More... | |
tsi_ssc_prescaler_t | ssc_prescaler |
Set clock divider for basic mode. More... | |
tsi_main_clock_selection_t tsi_common_config_t::mainClock |
tsi_sensing_mode_selection_t tsi_common_config_t::mode |
tsi_dvolt_option_t tsi_common_config_t::dvolt |
tsi_sinc_cutoff_div_t tsi_common_config_t::cutoff |
tsi_sinc_filter_order_t tsi_common_config_t::order |
tsi_sinc_decimation_value_t tsi_common_config_t::decimation |
tsi_ssc_charge_num_t tsi_common_config_t::chargeNum |
tsi_ssc_prbs_outsel_t tsi_common_config_t::prbsOutsel |
tsi_ssc_nocharge_num_t tsi_common_config_t::noChargeNum |
tsi_ssc_mode_t tsi_common_config_t::ssc_mode |
tsi_ssc_prescaler_t tsi_common_config_t::ssc_prescaler |
struct tsi_selfCap_config_t |
This structure contains the settings for the most common TSI self-cap configurations including the TSI module charge currents, sensitivity configuration and so on.
Data Fields | |
tsi_common_config_t | commonConfig |
Common settings. More... | |
bool | enableSensitivity |
Enable sensitivity boost of self-cap or not. More... | |
bool | enableShield |
Enable shield of self-cap mode or not. More... | |
tsi_sensitivity_xdn_option_t | xdn |
Sensitivity XDN option. More... | |
tsi_sensitivity_ctrim_option_t | ctrim |
Sensitivity CTRIM option. More... | |
tsi_current_multiple_input_t | inputCurrent |
Input current multiple. More... | |
tsi_current_multiple_charge_t | chargeCurrent |
Charge/Discharge current multiple. More... | |
tsi_common_config_t tsi_selfCap_config_t::commonConfig |
bool tsi_selfCap_config_t::enableSensitivity |
bool tsi_selfCap_config_t::enableShield |
tsi_sensitivity_xdn_option_t tsi_selfCap_config_t::xdn |
tsi_sensitivity_ctrim_option_t tsi_selfCap_config_t::ctrim |
tsi_current_multiple_input_t tsi_selfCap_config_t::inputCurrent |
tsi_current_multiple_charge_t tsi_selfCap_config_t::chargeCurrent |
struct tsi_mutualCap_config_t |
This structure contains the settings for the most common TSI mutual-cap configurations including the TSI module generator settings, sensitivity related current settings and so on.
Data Fields | |
tsi_common_config_t | commonConfig |
Common settings. More... | |
tsi_mutual_pre_current_t | preCurrent |
Vref generator current. More... | |
tsi_mutual_pre_resistor_t | preResistor |
Vref generator resistor. More... | |
tsi_mutual_sense_resistor_t | senseResistor |
I-sense generator resistor. More... | |
tsi_mutual_sense_boost_current_t | boostCurrent |
Sensitivity boost current setting. More... | |
tsi_mutual_tx_drive_mode_t | txDriveMode |
TX drive mode control setting. More... | |
tsi_mutual_pmos_current_left_t | pmosLeftCurrent |
Pmos current mirror on the left side. More... | |
tsi_mutual_pmos_current_right_t | pmosRightCurrent |
Pmos current mirror on the right side. More... | |
bool | enableNmosMirror |
Enable Nmos current mirror setting or not. More... | |
tsi_mutual_nmos_current_t | nmosCurrent |
Nmos current mirror setting. More... | |
tsi_common_config_t tsi_mutualCap_config_t::commonConfig |
tsi_mutual_pre_current_t tsi_mutualCap_config_t::preCurrent |
tsi_mutual_pre_resistor_t tsi_mutualCap_config_t::preResistor |
tsi_mutual_sense_resistor_t tsi_mutualCap_config_t::senseResistor |
tsi_mutual_sense_boost_current_t tsi_mutualCap_config_t::boostCurrent |
tsi_mutual_tx_drive_mode_t tsi_mutualCap_config_t::txDriveMode |
tsi_mutual_pmos_current_left_t tsi_mutualCap_config_t::pmosLeftCurrent |
tsi_mutual_pmos_current_right_t tsi_mutualCap_config_t::pmosRightCurrent |
bool tsi_mutualCap_config_t::enableNmosMirror |
tsi_mutual_nmos_current_t tsi_mutualCap_config_t::nmosCurrent |
#define FSL_TSI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
Version 2.1.0
These constants set the tsi main clock.
enum tsi_dvolt_option_t |
These bits indicate the comparator vp, vm and dvolt voltage.
These constants define the tsi sensitivity ajustment in self-cap mode, when TSI_MODE[S_SEN] = 1.
These constants define the tsi sensitivity ajustment in self-cap mode, when TSI_MODE[S_SEN] = 1.
These constants set the tsi charge/discharge current multiple in self-cap mode.
These constants Choose the current used in vref generator.
These constants Choose the resistor used in pre-charge.
These constants Choose the resistor used in I-sense generator.
These constants Choose the TX channel used in mutual-cap mode.
These constants Choose the RX channel used in mutual-cap mode.
These constants set the sensitivity boost current.
These constants set the Pmos current mirror on the left side used in mutual-cap mode.
These constants set the Pmos current mirror on the right side used in mutual-cap mode.
These constants set the Nmos current mirror used in mutual-cap mode.
These bits set the SINC cutoff divider.
These bits set the SINC decimation value.
enum tsi_ssc_charge_num_t |
These bits set the SSC output bit0's period setting.
These bits set the SSC output bit1's period setting.
These bits set the SSC PRBS length.
enum tsi_status_flags_t |
enum tsi_ssc_mode_t |
enum tsi_ssc_prescaler_t |
These constants set select the divider ratio for the clock used for generating the SSC output bit.
void TSI_InitSelfCapMode | ( | TSI_Type * | base, |
const tsi_selfCap_config_t * | config | ||
) |
Initialize the peripheral to the targeted state specified by parameter config, such as sets sensitivity adjustment, current settings.
base | TSI peripheral base address. |
config | Pointer to TSI self-cap configuration structure. |
void TSI_InitMutualCapMode | ( | TSI_Type * | base, |
const tsi_mutualCap_config_t * | config | ||
) |
Initialize the peripheral to the targeted state specified by parameter config, such as sets Vref generator setting, sensitivity boost settings, Pmos/Nmos settings.
base | TSI peripheral base address. |
config | Pointer to TSI mutual-cap configuration structure. |
void TSI_Deinit | ( | TSI_Type * | base | ) |
De-initialize the peripheral to default state.
base | TSI peripheral base address. |
void TSI_GetSelfCapModeDefaultConfig | ( | tsi_selfCap_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 a value:
userConfig | Pointer to TSI user configure structure. |
void TSI_GetMutualCapModeDefaultConfig | ( | tsi_mutualCap_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 a value:
userConfig | Pointer to TSI user configure structure. |
void TSI_SelfCapCalibrate | ( | TSI_Type * | base, |
tsi_calibration_data_t * | calBuff | ||
) |
Calibrate the peripheral to fetch the initial counter value of the enabled channels. This API is mostly used at initial application setup, it shall be called after the TSI_Init API, then user can use the calibrated counter values to setup applications(such as to determine under which counter value we can confirm a touch event occurrs).
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 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 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 clear tsi interrupt flag, automatically cleared flags can not be cleared by this function.
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. |
enable | Choose whether to enable or disable module;
|
|
inlinestatic |
This enables TSI module function in low power modes.
base | TSI peripheral base address. |
enable | Choose to enable or disable STOP mode.
|
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose to enable hardware trigger or software trigger scan.
|
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
channel | Channel number 0 ... 24. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose to enable DMA transfer or not.
|
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose whether to enable End of Scan DMA transfer request only.
|
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
low_threshold | Low counter threshold. |
|
inlinestatic |
base | TSI peripheral base address. |
high_threshold | High counter threshold. |
|
inlinestatic |
base | TSI peripheral base address. |
mainClock | clock option value. |
|
inlinestatic |
base | TSI peripheral base address. |
mode | Mode value. |
|
inlinestatic |
base | TSI peripheral base address. |
mode | Mode value. |
|
inlinestatic |
base | TSI peripheral base address. |
dvolt | The voltage rails. |
|
inlinestatic |
base | TSI peripheral base address. |
enableCancellation | Choose whether to enable noise cancellation in self-cap mode
|
|
inlinestatic |
base | TSI peripheral base address. |
txChannel | Mutual-cap mode TX channel number |
|
inlinestatic |
base | TSI peripheral base address; |
|
inlinestatic |
base | TSI peripheral base address. |
rxChannel | Mutual-cap mode RX channel number |
|
inlinestatic |
base | TSI peripheral base address; |
|
inlinestatic |
base | TSI peripheral base address. |
mode | SSC mode option value. |
|
inlinestatic |
base | TSI peripheral base address. |
prescaler | SSC prescaler option value. |