Component: ResistiveTouch (Graphical Library)

From Flowcode Help
Jump to navigationJump to search
Author
Version 1.0
Category Graphical Library


ResistiveTouch component

Routines for reading a simple resistive touch screen directly without interface IC.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_TouchScreen_Resistive.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_TouchScreen_Resistive.fcfx

Detailed description

No detailed description exists yet for this component

Examples

An example of how to calibrate and read a resistive touch display overlay using the component.

FC6 Icon.png Resistive Touch Demo


Calibration is stored into EEPROM memory so as to avoid having to repeat it on every power up.

Macro reference

Calibrate

Fc9-comp-macro.png Calibrate
Performs a calibration routine which draws a circle at the top left of the screen followed by the bottom right of the screen, from these coordinates the component can work out the corresponding X,Y pixel coordinate. 
Fc9-u16-icon.png - UINT Margin
Margin from the edge of the display, Range 0-63 
Fc9-u16-icon.png - UINT Radius
Radius of the calibration touch marker, should be <= margin 
Fc9-void-icon.png - VOID Return


GetCalibrationValues

Fc9-comp-macro.png GetCalibrationValues
Returns one of five calibration values used to configure the touchscreen. Populated automatically after running the calibration macro. Allows calibration data to be retrieved and stored into EEPROM by the user. 
Fc9-u8-icon.png - BYTE Index
Range: 0-4 Where 0=Xmin, 1=Xmax, 2=Ymin, 3=Ymax, 4=Flags 
Fc9-u16-icon.png - UINT Return


GetCoord

Fc9-comp-macro.png GetCoord
Gets the coordinate from the last valid touch event 
Fc9-u8-icon.png - BYTE Index
0=X, 1=Y 
Fc9-u16-icon.png - UINT Return


IsTouched

Fc9-comp-macro.png IsTouched
Check to see if display has been touched 
Fc9-bool-icon.png - BOOL Return


SetCalibrationValues

Fc9-comp-macro.png SetCalibrationValues
Sets the calibration values used to configure the touchscreen. Allows the touchscreen to be re-calibrated from EE memory after a power cycle without re-running the calibration macro. 
Fc9-u16-icon.png - UINT Xmin
Calibration value ADC representin Min X 
Fc9-u16-icon.png - UINT Xmax
Calibration value ADC representin Max X 
Fc9-u16-icon.png - UINT Ymin
Calibration value ADC representin Min Y 
Fc9-u16-icon.png - UINT Ymax
Calibration value ADC representin Max Y 
Fc9-u16-icon.png - UINT Flags
Flags variable containing margin and X/Y flip status 
Fc9-void-icon.png - VOID Return


SetOrientation

Fc9-comp-macro.png SetOrientation
Sets the orientation of the touchscreen to match the orientation of the graphical display. 
Fc9-u8-icon.png - BYTE Orientation
Range: 0-3 default = 0 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png LinkTo
 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png XP Pin
 
Fc9-type-5-icon.png XM Pin
 
Fc9-type-5-icon.png YP Pin
 
Fc9-type-5-icon.png YM Pin
 
Fc9-type-6-icon.png XM Analog Pin
 
Fc9-type-6-icon.png YP Analog Pin
 
Fc9-conn-icon.png Configuration
Fc9-type-21-icon.png X Pixel
 
Fc9-type-21-icon.png Y Pixel
 
Fc9-type-21-icon.png Trigger Pressure
Reading between X and Y which signifies a valid touch pressure. 
Fc9-type-21-icon.png Acceptable Noise
Amount of acceptable noise on the input between samples before we allow a valid touch to be recorded.  
Fc9-type-16-icon.png Sense Loop Count
Number of times to sample and compare the touch to confirm a valid touch press. 
Fc9-type-21-icon.png Average ADC Count
Number of ADC samples used to create an averaged ADC input reading to help reduce input noise. 
Fc9-type-21-icon.png Sample Timing (us)
Microsecond delay in between each of the averaged samples. 
Fc9-conn-icon.png ADC options
Fc9-type-16-icon.png VRef option
Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage VDD - Defines the microcontrollers power supply pin as the max reference, VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage. 
Fc9-type-16-icon.png Conversion speed
Clock setting to select how fast the ADC peripheral will perform an ADC conversion. The FRC setting is based on a RC time base and so will vary with temperature and pressure. Other settings are generally based on divisions of the master clock. 
Fc9-type-14-icon.png Acquisition cycles
Number of micro seconds to wait for the ADC input to charge before starting the analogue sample. 
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Enable Interrupt
 
Fc9-type-22-icon.png Interrupt Macro