captouch module

Note

Because of a driver quirk, the top pad of the petal 5 is currently not working, resulting in that petal only reporting half of its supposed range.

class captouch.CaptouchPetalPadsState(*args, **kwargs)

Current state of pads on a captouch petal.

Not all petals have all pads. Top petals have a a base, cw and ccw pad. Bottom petals have a base and tip pad.

property base: bool

True if the petal’s base is currently touched.

property ccw: bool

True if the petal’s counter clockwise pad is currently touched.

property cw: bool

True if the petal’s clockwise pad is currently touched.

property tip: bool

True if the petals’s tip is currently touched.

class captouch.CaptouchPetalState(*args, **kwargs)
property bottom: bool

True if this is a bottom petal.

property pads: CaptouchPetalPadsState

State of individual pads of the petal.

property position: Tuple[int, int]

Polar coordinates of touch on petal in the form of a (distance, angle) tuple.

The units are arbitrary, but centered around (0, 0).

An increase in distance means the touch is further away from the centre of the badge.

An increase in angle means the touch is more clockwise.

property pressed: bool

True if any of the petal’s pads is currently touched.

property pressure: int

How strongly the petal is currently being touched, in arbitrary units.

property top: bool

True if this is a top petal.

class captouch.CaptouchState(*args, **kwargs)

State of captouch sensors, captured at some time.

property petals: List[CaptouchPetalState]

State of individual petals.

Contains 10 elements, with the zeroth element being the petal closest to the USB port. Then, every other petal in a clockwise direction.

Petals 0, 2, 4, 6, 8 are Top petals.

Petals 1, 3, 5, 7, 9 are Bottom petals.

captouch.calibration_active() bool

Returns true if the captouch system is current recalibrating.

captouch.calibration_request() None

Attempts to start calibration of captouch controllers. No-op if a calibration is already active.

captouch.read() CaptouchState

Reads current captouch state from hardware and returns a snapshot in time.