By
default it is implemented Cosmic C
Compiler version 16K Free
(C:\Program Files\COSMIC\CXSTM8_16K)
In my case I installed the Cosmic C Compiler 32K Free, for this
reason is necessary click on the icon:
and then change the root path and set:
C:\Program
Files\COSMIC\CXSTM8_32K
As shown below.
At
this point you can compile the program
to give:
0 Errors 0 Warning
Now you can enter debugging,
but first we need to configure the
emulator we want to use.
To do this, press
the icon
and from the window that opens (see below) selected Swim ST-Link and then click Apply and OK.
Now that the development environment
is set up we are going to change the parameters of the Touch Button.
The parameters to be amended to change the sensitivity of the
Touch Button are:
SCKEY_DETECTTHRESHOLD_DEFAULT
Defines
the default detection threshold value for the Single-channel keys. The
key is determined "detected" if the Delta value is greater than this
threshold.
This parameter can take a value
between 1 to 127.
A Low value will result in a
high sensitivity during the detection.
A High value will result in a
low sensitivity during the detection.
Typical value: 15 (depends of
hardware and desired feeling on the key)
SCKEY_ENDDETECTTHRESHOLD_DEFAULT
Defines
the default end-detection threshold value for the Single-channel keys.
The key is determined "not detected" if the Delta value is lower than
this threshold.
This parameter can take a value
between 1 to 127.
A Low value will result in a low
sensitivity during the un-detection.
A High value will result in a
high sensitivity during the un-detection.
Typical value: half of detection
threshold (depends of hardware and desired feeling on the key)
SCKEY_RECALIBRATIONTHRESHOLD_DEFAULT
Defines
the default (re)calibration threshold value for the Single-channel
keys.
The key is (re)calibrated if the
Delta value is lower than this threshold.
This parameter can take a value
between -1 to -128.
A Low absolute value will result
in a high sensitivity for the (re)calibration.
A High absolute value will
result in a low sensitivity for the (re)calibration.
Typical value: minus
end-detection threshold (depends of hardware and desired feeling on the
key)
These
parameters are in the file (line 299
and up to 305):
discover/Include
FIles/stm8_tsl_rc_configuration.h
In my case I set the parameters
as shown below (in bold):
//
Thresholds
#define
SCKEY_DETECTTHRESHOLD_DEFAULT
(2)
// 15 /**< Single channel key
detection threshold (value from 1 to 127) */
#define
SCKEY_ENDDETECTTHRESHOLD_DEFAULT (1)
// 6 /**< Single channel
key end detection threshold (value from 1 to 127) */
#define SCKEY_RECALIBRATIONTHRESHOLD_DEFAULT (-2) // -6 /**< Single channel key
calibration threshold (value from -1 to -128) */
#define
MCKEY_DETECTTHRESHOLD_DEFAULT
(30)
/**< Multi channel key
detection threshold (value from 1 to 127) */
#define
MCKEY_ENDDETECTTHRESHOLD_DEFAULT
(20) /**< Multi channel key end
detection threshold (value from 1 to 127) */
#define MCKEY_RECALIBRATIONTHRESHOLD_DEFAULT (-20) /**< Multi channel key calibration
threshold (value from -1 to -128) */
With
the above parameters I obtained a reading distance, with insulation
made using post-it, of about 4 mm
over the plastic insulation already present in your STM8S Discovery.
Then I finished the post-it and
I could not go beyond with the test.
I recommend you read the documentation: