AnyMeas mode API¶
-
PinnacleTouch.anymeas_mode_config(gain: int =
0
, frequency: int =2
, sample_length: int =512
, mux_ctrl: int =4
, apperture_width: int =500
, ctrl_pwr_cnt: int =1
)[source]¶ This function configures the Pinnacle ASIC to output raw ADC measurements.
Be sure to set the
data_mode
attribute toANYMEAS
before calling this function otherwise it will do nothing.- Parameters¶
- gain: int =
0
¶ Sets the sensitivity of the ADC matrix. Valid values are the constants defined in AnyMeas mode Gain. Defaults to
GAIN_200
.- frequency: int =
2
¶ Sets the frequency of measurements made by the ADC matrix. Valid values are the constants defined in AnyMeas mode Frequencies. Defaults
FREQ_0
.- sample_length: int =
512
¶ Sets the maximum bit length of the measurements made by the ADC matrix. Valid values are
128
,256
, or512
. Defaults to512
.- mux_ctrl: int =
4
¶ The Pinnacle ASIC can employ different bipolar junctions and/or reference capacitors. Valid values are the constants defined in AnyMeas mode Muxing. Additional combination of these constants is also allowed. Defaults to
MUX_PNP
.- apperture_width: int =
500
¶ Sets the window of time (in nanoseconds) to allow for the ADC to take a measurement. Valid values are multiples of 125 in range [
250
,1875
]. Erroneous values are clamped/truncated to this range.Note
The
apperture_width
parameter has a inverse relationship/affect on thefrequency
parameter. The approximated frequencies described in this documentation are based on an aperture width of 500 nanoseconds, and they will shrink as the apperture width grows or grow as the aperture width shrinks.- ctrl_pwr_cnt: int =
1
¶ Configure the Pinnacle to perform a number of measurements for each call to
measure_adc()
. Defaults to 1. Constants defined in AnyMeas mode Control can be used to specify if is sleep is allowed (CRTL_PWR_IDLE
– this is not default) or if repetitive measurements is allowed (CRTL_REPEAT
) if number of measurements is more than 1.Warning
There is no bounds checking on the number of measurements specified here. Specifying more than 63 will trigger sleep mode after performing measurements.
Tip
Be aware that allowing the Pinnacle to enter sleep mode after taking measurements will slow consecutive calls to
measure_adc()
as the Pinnacle requires about 300 milliseconds to wake up.
- gain: int =
- PinnacleTouch.measure_adc(bits_to_toggle: int, toggle_polarity: int) bytearray [source]¶
This blocking function instigates and returns the measurements (a signed short) from the Pinnacle ASIC’s ADC (Analog to Digital Converter) matrix.
Internally this function calls
start_measure_adc()
andget_measure_adc()
in sequence. Be sure to set thedata_mode
attribute toANYMEAS
before calling this function otherwise it will do nothing.- Parameters’ Context¶
Each of the parameters are a 4-byte integer (see format table below) in which each bit corresponds to a capacitance sensing electrode in the sensor’s matrix (12 electrodes for Y-axis, 16 electrodes for X-axis). They are used to compensate for varying capacitances in the electrodes during measurements. It is highly recommended that the trackpad be installed in a finished/prototyped housing when determining what electrodes to manipulate. See AnyMeas mode example to understand how to use these 4-byte integers.
- Parameters¶
- bits_to_toggle: int¶
A bit of
1
flags that electrode’s output for toggling, and a bit of0
signifies that the electrode’s output should remain unaffected.- toggle_polarity: int¶
This specifies which polarity the output of the electrode(s) (specified with corresponding bits in
bits_to_toggle
parameter) should be toggled (forced). A bit of1
toggles that bit positive, and a bit of0
toggles that bit negative.
- Returns¶
A 2-byte
bytearray
that represents a signed short integer. Ifdata_mode
is not set toANYMEAS
, then this function returnsNone
and does nothing.
- 4-byte Integer Format¶
Bits 31 & 30 are not used and should remain
0
. Bits 29 and 28 represent the optional implementation of reference capacitors built into the Pinnacle ASIC. To use these capacitors, the corresponding constants (MUX_REF0
and/orMUX_REF1
) must be passed toanymeas_mode_config()
in themux_ctrl
parameter, and their representative bits must be flagged in bothbits_to_toggle
&toggle_polarity
parameters.byte 3 (MSByte)¶ bit position
31
30
29
28
27
26
25
24
representation
N/A
N/A
Ref1
Ref0
Y11
Y10
Y9
Y8
byte 2¶ bit position
23
22
21
20
19
18
17
16
representation
Y7
Y6
Y5
Y4
Y3
Y2
Y1
Y0
byte 1¶ bit position
15
14
13
12
11
10
9
8
representation
X15
X14
X13
X12
X11
X10
X9
X8
byte 0 (LSByte)¶ bit position
7
6
5
4
3
2
1
0
representation
X7
X6
X5
X4
X3
X2
X1
X0
- PinnacleTouch.start_measure_adc(bits_to_toggle: int, toggle_polarity: int)[source]¶
A non-blocking function that starts measuring ADC values in AnyMeas mode.
See the parameters and table in
measure_adc()
as this is its helper function, and all parameters there are used the same way here.
- PinnacleTouch.get_measure_adc() bytearray | None [source]¶
A non-blocking function that returns ADC measurement on completion.
This function is only meant ot be used in conjunction with
start_measure_adc()
for non-blocking application.- Returns¶
None
ifdata_mode
is not set toANYMEAS
or if the “data ready” pin’s signal is not active (whiledata_mode
is set toANYMEAS
) meaning the Pinnacle ASIC is still computing the ADC measurements based on the 4-byte polynomials passed tostart_measure_adc()
.a
bytearray
that represents a signed 16-bit integer upon completed ADC measurements based on the 4-byte polynomials passed tostart_measure_adc()
.
AnyMeas mode Gain¶
Allowed ADC gain configurations of AnyMeas mode. The percentages defined here are approximate values.
AnyMeas mode Frequencies¶
Allowed frequency configurations of AnyMeas mode. The frequencies defined here are
approximated based on an aperture width of 500 nanoseconds. If the aperture_width
parameter to anymeas_mode_config()
specified is less than 500 nanoseconds, then the
frequency will be larger than what is described here (& vice versa).
AnyMeas mode Muxing¶
Allowed muxing gate polarity and reference capacitor configurations of AnyMeas mode.
Combining these values (with +
operator) is allowed.
Note
The sign of the measurements taken in AnyMeas mode is inverted depending on which muxing gate is specified (when specifying an individual gate polarity).
AnyMeas mode Control¶
These constants control the number of measurements performed in measure_adc()
.
The number of measurements can range [0, 63].