reform

MNT Reform: Open Source Portable Computer
Log (Feed) | Files | Refs (Tags) | README

azoteq.h (1647B)


      1 /*
      2   azoteq.h -- Azoteq IQS550 mappings
      3   Copyright 2023 Valtteri Koskivuori <vkoskiv@gmail.com>
      4   License: GPLv3
      5 */
      6 
      7 #pragma once
      8 
      9 #include <stdint.h>
     10 #include <stdbool.h>
     11 
     12 struct azoteq_gesture_events {
     13   uint8_t ges_unused_0 : 2;
     14   bool ges_swipe_y_minus : 1;
     15   bool ges_swipe_y_plus : 1;
     16   bool ges_swipe_x_plus : 1;
     17   bool ges_swipe_x_minus : 1;
     18   bool ges_press_and_hold : 1;
     19   bool ges_single_tap : 1;
     20 
     21   uint8_t ges_unused_1 : 5;
     22   bool ges_zoom: 1;
     23   bool ges_scroll: 1;
     24   bool ges_2_finger_tap: 1;
     25 };
     26 
     27 struct azoteq_sysinfo {
     28   bool sys_show_reset : 1;
     29   bool sys_alp_reati_occurred : 1;
     30   bool sys_alp_ati_error : 1;
     31   bool sys_reati_occurred : 1;
     32   bool sys_ati_error : 1;
     33   uint8_t sys_charging_mode : 3;
     34 
     35   uint8_t sys_unused: 2;
     36   bool sys_switch_state : 1;
     37   bool sys_snap_toggle : 1;
     38   bool sys_rr_missed : 1;
     39   bool sys_too_many_fingers : 1;
     40   bool sys_palm_detect : 1;
     41   bool sys_tp_movement : 1;
     42 };
     43 
     44 struct azoteq_header {
     45   uint16_t product_number;
     46   uint16_t project_number;
     47   uint8_t major_version;
     48   uint8_t minor_version;
     49   uint8_t bootloader_status;
     50   uint8_t unused_0[4];
     51   uint8_t max_touch_column : 4;
     52   uint8_t max_touch_row : 4;
     53   uint8_t prev_cycle_time_ms;
     54   struct azoteq_gesture_events ges_events;
     55   struct azoteq_sysinfo sys;
     56 };
     57 
     58 struct azoteq_finger {
     59   uint16_t abs_x;
     60   uint16_t abs_y;
     61   uint16_t touch_strength;
     62   uint8_t  touch_area;
     63 };
     64 
     65 // Starts at 0x0000, 57 bytes
     66 struct azoteq_data {
     67   struct azoteq_header header;
     68   uint8_t num_fingers;
     69   int16_t relative_x;
     70   int16_t relative_y;
     71   struct azoteq_finger fingers[5];
     72 };
     73 
     74 #define ADDR_SENSOR (0x74<<1)
     75 
     76 void read_azoteq_data(struct azoteq_data *data);