MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides driver for the Touch Sensing Input (TSI) module of MCUXpresso SDK devices.
Data Structures | |
struct | tsi_calibration_data_t |
TSI calibration data storage. More... | |
struct | tsi_config_t |
TSI configuration structure. More... | |
Macros | |
#define | ALL_FLAGS_MASK (TSI_GENCS_EOSF_MASK | TSI_GENCS_OUTRGF_MASK) |
TSI status flags macro collection. | |
#define | TSI_V4_EXTCHRG_RESISTOR_BIT_SHIFT TSI_GENCS_EXTCHRG_SHIFT |
resistor bit shift in EXTCHRG bit-field | |
#define | TSI_V4_EXTCHRG_FILTER_BITS_SHIFT (1U + TSI_GENCS_EXTCHRG_SHIFT) |
filter bits shift in EXTCHRG bit-field | |
#define | TSI_V4_EXTCHRG_RESISTOR_BIT_CLEAR ((uint32_t)((~(ALL_FLAGS_MASK | TSI_GENCS_EXTCHRG_MASK)) | (3U << TSI_V4_EXTCHRG_FILTER_BITS_SHIFT))) |
macro of clearing the resistor bit in EXTCHRG bit-field | |
#define | TSI_V4_EXTCHRG_FILTER_BITS_CLEAR ((uint32_t)((~(ALL_FLAGS_MASK | TSI_GENCS_EXTCHRG_MASK)) | (1U << TSI_V4_EXTCHRG_RESISTOR_BIT_SHIFT))) |
macro of clearing the filter bits in EXTCHRG bit-field | |
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 the 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 an interrupt flag. More... | |
void | TSI_ClearStatusFlags (TSI_Type *base, uint32_t mask) |
Clears the interrupt flag. 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 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) |
Sets the TSI low power STOP mode as enabled or disabled. More... | |
static void | TSI_EnableHardwareTriggerScan (TSI_Type *base, bool enable) |
Enables/disables the hardware trigger scan. More... | |
static void | TSI_StartSoftwareTrigger (TSI_Type *base) |
Starts a software trigger measurement (triggers a new measurement). More... | |
static void | TSI_SetMeasuredChannelNumber (TSI_Type *base, uint8_t channel) |
Sets the the measured channel number. More... | |
static uint8_t | TSI_GetMeasuredChannelNumber (TSI_Type *base) |
Gets the current measured channel number. More... | |
static void | TSI_EnableDmaTransfer (TSI_Type *base, bool enable) |
Enables/disables the DMA transfer. 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) |
Sets the TSI wake-up channel low threshold. More... | |
static void | TSI_SetHighThreshold (TSI_Type *base, uint16_t high_threshold) |
Sets the TSI wake-up channel high threshold. More... | |
static void | TSI_SetAnalogMode (TSI_Type *base, tsi_analog_mode_t mode) |
Sets the analog mode of the TSI module. More... | |
static uint8_t | TSI_GetNoiseModeResult (TSI_Type *base) |
Gets the noise mode result of the TSI module. 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 external electrode charge current. More... | |
static void | TSI_SetOscVoltageRails (TSI_Type *base, tsi_osc_voltage_rails_t dvolt) |
Sets the oscillator's voltage rails. More... | |
static void | TSI_SetElectrodeSeriesResistor (TSI_Type *base, tsi_series_resistor_t resistor) |
Sets the electrode series resistance value in EXTCHRG[0] bit. More... | |
static void | TSI_SetFilterBits (TSI_Type *base, tsi_filter_bits_t filter) |
Sets the electrode filter bits value in EXTCHRG[2:1] bits. More... | |
Driver version | |
#define | FSL_TSI_DRIVER_VERSION (MAKE_VERSION(2, 1, 2)) |
TSI driver version. | |
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_electrode_osc_prescaler_t | prescaler |
Prescaler. | |
tsi_external_osc_charge_current_t | extchrg |
Electrode charge current. | |
tsi_reference_osc_charge_current_t | refchrg |
Reference charge current. | |
tsi_n_consecutive_scans_t | nscn |
Number of scans. More... | |
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_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 |
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.
enum tsi_analog_mode_t |
Set up TSI analog modes in a TSI instance.
These constants define the TSI Reference oscillator charge current select in a TSI (REFCHRG) instance.
These bits indicate the oscillator's voltage rails.
These bits indicate the electrode oscillator charge and discharge current value in TSI (EXTCHRG) instance.
enum tsi_filter_bits_t |
These bits indicate the count of the filter bits in TSI noise mode EXTCHRG[2:1] bits
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 parameter configuration, such as sets prescalers, number of scans, clocks, delta voltage series resistor, filter bits, reference, and electrode charge current and threshold.
base | TSI peripheral base address. |
config | Pointer to TSI module 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 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 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 we can confirm 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 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 gets the TSI interrupt flags.
base | TSI peripheral base address. |
void TSI_ClearStatusFlags | ( | TSI_Type * | base, |
uint32_t | mask | ||
) |
This function clears the TSI interrupt flag, automatically cleared flags can't 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. |
prescaler | Prescaler value. |
|
inlinestatic |
base | TSI peripheral base address. |
number | Number of scans. |
|
inlinestatic |
base | TSI peripheral base address. |
enable | Choose whether to enable or disable module;
|
|
inlinestatic |
This enables the 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 ... 15. |
|
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. |
|
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. |
mode | Mode value. |
|
inlinestatic |
base | TSI peripheral base address. |
|
inlinestatic |
base | TSI peripheral base address. |
current | The reference oscillator charge current. |
|
inlinestatic |
base | TSI peripheral base address. |
current | External electrode charge current. |
|
inlinestatic |
base | TSI peripheral base address. |
dvolt | The voltage rails. |
|
inlinestatic |
base | TSI peripheral base address. |
resistor | Series resistance. |
|
inlinestatic |
base | TSI peripheral base address. |
filter | Series resistance. |