qmk_firmware

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

sync_timer.h (1924B)


      1 /*
      2 Copyright (C) 2020 Ryan Caltabiano <https://github.com/XScorpion2>
      3 
      4 Permission is hereby granted, free of charge, to any person obtaining a copy of
      5 this software and associated documentation files (the "Software"), to deal in
      6 the Software without restriction, including without limitation the rights to
      7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
      8 of the Software, and to permit persons to whom the Software is furnished to do
      9 so, subject to the following conditions:
     10 
     11 The above copyright notice and this permission notice shall be included in all
     12 copies or substantial portions of the Software.
     13 
     14 If you happen to meet one of the copyright holders in a bar you are obligated
     15 to buy them one pint of beer.
     16 
     17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     23 SOFTWARE.
     24 */
     25 
     26 #pragma once
     27 
     28 #include <stdint.h>
     29 #include "timer.h"
     30 
     31 #ifdef __cplusplus
     32 extern "C" {
     33 #endif
     34 
     35 #if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER)
     36 void     sync_timer_init(void);
     37 void     sync_timer_update(uint32_t time);
     38 uint16_t sync_timer_read(void);
     39 uint32_t sync_timer_read32(void);
     40 uint16_t sync_timer_elapsed(uint16_t last);
     41 uint32_t sync_timer_elapsed32(uint32_t last);
     42 #else
     43 #    define sync_timer_init()
     44 #    define sync_timer_clear()
     45 #    define sync_timer_update(t)
     46 #    define sync_timer_read() timer_read()
     47 #    define sync_timer_read32() timer_read32()
     48 #    define sync_timer_elapsed(t) timer_elapsed(t)
     49 #    define sync_timer_elapsed32(t) timer_elapsed32(t)
     50 #endif
     51 
     52 #ifdef __cplusplus
     53 }
     54 #endif