qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

paw3222.h (1565B)


      1 /* Copyright 2024 Colin Lam (Ploopy Corporation)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 2 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15  */
     16 
     17 #pragma once
     18 
     19 #include <stdbool.h>
     20 #include <stdint.h>
     21 #include "pointing_device.h"
     22 
     23 #ifndef PAW3222_CS_PIN
     24 #    ifdef POINTING_DEVICE_CS_PIN
     25 #        define PAW3222_CS_PIN POINTING_DEVICE_CS_PIN
     26 #    else
     27 #        error "No chip select pin defined -- missing POINTING_DEVICE_CS_PIN or PAW3222_CS_PIN define"
     28 #    endif
     29 #endif
     30 
     31 #ifndef PAW3222_SPI_DIVISOR
     32 #    error "No PAW3222 SPI divisor defined -- missing PAW3222_SPI_DIVISOR"
     33 #endif
     34 
     35 typedef struct {
     36     int16_t dx;
     37     int16_t dy;
     38 } report_paw3222_t;
     39 
     40 extern const pointing_device_driver_t paw3222_pointing_device_driver;
     41 
     42 bool             paw3222_init(void);
     43 report_paw3222_t paw3222_read_burst(void);
     44 void             paw3222_set_cpi(uint16_t cpi);
     45 uint16_t         paw3222_get_cpi(void);
     46 report_mouse_t   paw3222_get_report(report_mouse_t mouse_report);
     47 bool             paw3222_check_signature(void);