qmk_firmware

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

usb_descriptor_common.h (1860B)


      1 /* Copyright 2020 Nick Brassel (tzarc)
      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 // Prefix string literal with L for descriptors
     20 #define USBCONCAT(a, b) a##b
     21 #define USBSTR(s) USBCONCAT(L, s)
     22 
     23 #define HID_VALUE_16(v) ((uint8_t)(v & 0xFF)), ((uint8_t)(v >> 8))
     24 
     25 /////////////////////
     26 // RAW Usage page and ID configuration
     27 
     28 #ifndef RAW_USAGE_PAGE
     29 #    define RAW_USAGE_PAGE 0xFF60
     30 #endif
     31 
     32 #ifndef RAW_USAGE_ID
     33 #    define RAW_USAGE_ID 0x61
     34 #endif
     35 
     36 /////////////////////
     37 // Hires Scroll Defaults
     38 
     39 #ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
     40 #    ifdef POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER
     41 #        if POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER > 127 || POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER < 1
     42 #            error "POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER must be between 1 and 127, inclusive!"
     43 #        endif
     44 #    else
     45 #        define POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER 120
     46 #    endif
     47 #    ifdef POINTING_DEVICE_HIRES_SCROLL_EXPONENT
     48 #        if POINTING_DEVICE_HIRES_SCROLL_EXPONENT > 127 || POINTING_DEVICE_HIRES_SCROLL_EXPONENT < 0
     49 #            error "POINTING_DEVICE_HIRES_SCROLL_EXPONENT must be between 0 and 127, inclusive!"
     50 #        endif
     51 #    else
     52 #        define POINTING_DEVICE_HIRES_SCROLL_EXPONENT 0
     53 #    endif
     54 #endif