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 to ANYMEAS 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, or 512. Defaults to 512.

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 the frequency 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.

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() and get_measure_adc() in sequence. Be sure to set the data_mode attribute to ANYMEAS 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 of 0 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 of 1 toggles that bit positive, and a bit of 0 toggles that bit negative.

Returns

A 2-byte bytearray that represents a signed short integer. If data_mode is not set to ANYMEAS, then this function returns None 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/or MUX_REF1) must be passed to anymeas_mode_config() in the mux_ctrl parameter, and their representative bits must be flagged in both bits_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

AnyMeas mode Gain

Allowed ADC gain configurations of AnyMeas mode. The percentages defined here are approximate values.

circuitpython_cirque_pinnacle.glidepoint.GAIN_100 : int

around 100% gain

circuitpython_cirque_pinnacle.glidepoint.GAIN_133 : int

around 133% gain

circuitpython_cirque_pinnacle.glidepoint.GAIN_166 : int

around 166% gain

circuitpython_cirque_pinnacle.glidepoint.GAIN_200 : int

around 200% gain

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).

circuitpython_cirque_pinnacle.glidepoint.FREQ_0 : int

frequency around 500,000Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_1 : int

frequency around 444,444Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_2 : int

frequency around 400,000Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_3 : int

frequency around 363,636Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_4 : int

frequency around 333,333Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_5 : int

frequency around 307,692Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_6 : int

frequency around 267,000Hz

circuitpython_cirque_pinnacle.glidepoint.FREQ_7 : int

frequency around 235,000Hz

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).

circuitpython_cirque_pinnacle.glidepoint.MUX_REF1 : int

enables a builtin capacitor (~0.5pF).

circuitpython_cirque_pinnacle.glidepoint.MUX_REF0 : int

enables a builtin capacitor (~0.25pF).

circuitpython_cirque_pinnacle.glidepoint.MUX_PNP : int

enable PNP sense line

circuitpython_cirque_pinnacle.glidepoint.MUX_NPN : int

enable NPN sense line

AnyMeas mode Control

These constants control the number of measurements performed in measure_adc(). The number of measurements can range [0, 63].

circuitpython_cirque_pinnacle.glidepoint.CRTL_REPEAT : int

required for more than 1 measurement

circuitpython_cirque_pinnacle.glidepoint.CRTL_PWR_IDLE : int

triggers low power mode (sleep) after completing measurements