project for a (works on my devices) demo
This commit is contained in:
20
headers/input/touch/touch_controller_L1_builder.h
Normal file
20
headers/input/touch/touch_controller_L1_builder.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "touch_data.h"
|
||||
|
||||
/* yes int instead of uint */
|
||||
void TC_L1_builder_set_tracking_id( int64_t tracking_id);
|
||||
|
||||
void TC_L1_builder_set_position_x( uint64_t x_coord);
|
||||
|
||||
void TC_L1_builder_set_position_y( uint64_t y_coord);
|
||||
|
||||
void TC_L1_builder_set_major_axis( uint64_t width);
|
||||
|
||||
void TC_L1_builder_set_approaching_major_axis( uint64_t width);
|
||||
|
||||
void TC_L1_builder_set_slot_number( uint64_t number);
|
||||
|
||||
void TC_L1_builder_copy_tracked_events( touch_event ***store, uint8_t *count);
|
||||
|
||||
void TC_L1_builder_destroy_copy( touch_event **store, uint8_t count);
|
||||
9
headers/input/touch/touch_controller_L2.h
Normal file
9
headers/input/touch/touch_controller_L2.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "touch_data.h"
|
||||
|
||||
touch_coordinates* TC_L2_getAABB( touch_event **events, uint8_t count);
|
||||
|
||||
float TC_L2_get_width( touch_event **events, uint8_t count);
|
||||
|
||||
float TC_L2_get_angle( touch_event **events, uint8_t count);
|
||||
|
||||
touch_coordinates* TC_L2_get_midpoint( touch_event **events, uint8_t count);
|
||||
13
headers/input/touch/touch_controller_L3.h
Normal file
13
headers/input/touch/touch_controller_L3.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "touch_controller_L2.h"
|
||||
|
||||
void TC_L3_get_position_deltas(
|
||||
touch_event **previous, uint8_t previous_count,
|
||||
touch_event **current, uint8_t current_count,
|
||||
touch_coordinates **deltas, uint8_t *count
|
||||
);
|
||||
|
||||
float TC_L3_get_angle_delta( float previous_angle, float current_angle);
|
||||
|
||||
touch_coordinates* TC_L3_get_midpoint_delta( touch_coordinates previous, touch_coordinates current);
|
||||
22
headers/input/touch/touch_controller_L3_deltas_compute.h
Normal file
22
headers/input/touch/touch_controller_L3_deltas_compute.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t state; /* entered unchanged exited */
|
||||
uint8_t old_index;
|
||||
uint8_t new_index;
|
||||
uint64_t tracking_id;
|
||||
} tracked_delta;
|
||||
|
||||
/* could also resort to TRANSIENT / PERSISTENT */
|
||||
static const uint8_t TRACKED_DELTA_ENTERED = 0;
|
||||
static const uint8_t TRACKED_DELTA_UNCHANGED = 1;
|
||||
static const uint8_t TRACKED_DELTA_EXITED = 2;
|
||||
|
||||
|
||||
void touch_events_sorted_ids_deltas(
|
||||
tracked_delta **endbuffer, uint16_t *endcount,
|
||||
uint64_t *previous_ids, uint8_t previous_count,
|
||||
uint64_t *current_ids, uint8_t current_count
|
||||
);
|
||||
30
headers/input/touch/touch_data.h
Normal file
30
headers/input/touch/touch_data.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
int64_t x; /* touch horizontal center */
|
||||
int64_t y; /* touch vertical center */
|
||||
} touch_coordinates;
|
||||
|
||||
/* using ultrawide ints (narrowing later) */
|
||||
typedef struct {
|
||||
uint64_t slot_number;
|
||||
uint64_t tracking_id; /* this increases with each new touch */
|
||||
touch_coordinates position;
|
||||
/* ignoring ABS_MT_TOUCH_MAJOR
|
||||
and ABS_MT_WIDTH_MAJOR
|
||||
*/
|
||||
} touch_event;
|
||||
|
||||
touch_event* touch_event_new();
|
||||
|
||||
void touch_event_copy( touch_event *dst, touch_event *src);
|
||||
|
||||
touch_coordinates* new_touch_coordinates_buffer( uint8_t count);
|
||||
|
||||
void free_touch_coordinates_buffer( touch_coordinates* buffer);
|
||||
|
||||
void touch_events_array_copy( touch_event ***dst, touch_event **src, uint8_t count);
|
||||
|
||||
void free_touch_events_array( touch_event **buffer, uint8_t count);
|
||||
21
headers/input/touch/two_fingers_simultaneous.event
Normal file
21
headers/input/touch/two_fingers_simultaneous.event
Normal file
@@ -0,0 +1,21 @@
|
||||
ABS_MT_TRACKING_ID [UNIQUE ID OF INITIATED CONTACT] 100
|
||||
ABS_MT_POSITION_X [CENTER X TOUCH POSITION] 288
|
||||
ABS_MT_POSITION_Y [CENTER Y TOUCH POSITION] 1028
|
||||
ABS_MT_TOUCH_MAJOR [MAJOR AXIS OF TOUCH ELLIPSE] 40
|
||||
ABS_MT_WIDTH_MAJOR [MINOR AXIS OF APPROACHING ELLIPSE] 40
|
||||
|
||||
ABS_MT_SLOT [MULTITOUCH SLOT MODIFIED] 1
|
||||
ABS_MT_TRACKING_ID [UNIQUE ID OF INITIATED CONTACT] 101
|
||||
ABS_MT_POSITION_X [CENTER X TOUCH POSITION] 866
|
||||
ABS_MT_POSITION_Y [CENTER Y TOUCH POSITION] 660
|
||||
ABS_MT_TOUCH_MAJOR [MAJOR AXIS OF TOUCH ELLIPSE] 49
|
||||
ABS_MT_WIDTH_MAJOR [MINOR AXIS OF APPROACHING ELLIPSE] 49
|
||||
TOUCH EVENT BEGIN
|
||||
separator for 0 : 0
|
||||
|
||||
ABS_MT_SLOT [MULTITOUCH SLOT MODIFIED] 0
|
||||
ABS_MT_TRACKING_ID [UNIQUE ID OF INITIATED CONTACT] -1
|
||||
ABS_MT_SLOT [MULTITOUCH SLOT MODIFIED] 1
|
||||
ABS_MT_TRACKING_ID [UNIQUE ID OF INITIATED CONTACT] -1
|
||||
TOUCH EVENT END
|
||||
separator for 0 : 0
|
||||
Reference in New Issue
Block a user