qmk_firmware

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

xt.h (2721B)


      1 /*
      2 Copyright 2018 Jun WAKO <wakojun@gmail.com>
      3 Copyright 2016 Ethan Apodaca <papodaca@gmail.com>
      4 
      5 This software is licensed with a Modified BSD License.
      6 All of this is supposed to be Free Software, Open Source, DFSG-free,
      7 GPL-compatible, and OK to use in both free and proprietary applications.
      8 Additions and corrections to this file are welcome.
      9 
     10 
     11 Redistribution and use in source and binary forms, with or without
     12 modification, are permitted provided that the following conditions are met:
     13 
     14 * Redistributions of source code must retain the above copyright
     15   notice, this list of conditions and the following disclaimer.
     16 
     17 * Redistributions in binary form must reproduce the above copyright
     18   notice, this list of conditions and the following disclaimer in
     19   the documentation and/or other materials provided with the
     20   distribution.
     21 
     22 * Neither the name of the copyright holders nor the names of
     23   contributors may be used to endorse or promote products derived
     24   from this software without specific prior written permission.
     25 
     26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36 POSSIBILITY OF SUCH DAMAGE.
     37 */
     38 
     39 #pragma once
     40 
     41 #include <stdint.h>
     42 #include "gpio.h"
     43 
     44 #define XT_DATA_IN()               \
     45     do {                           \
     46         gpio_set_pin_input(XT_DATA_PIN);  \
     47         gpio_write_pin_high(XT_DATA_PIN); \
     48     } while (0)
     49 
     50 #define XT_DATA_READ() gpio_read_pin(XT_DATA_PIN)
     51 
     52 #define XT_DATA_LO()               \
     53     do {                           \
     54         gpio_write_pin_low(XT_DATA_PIN);  \
     55         gpio_set_pin_output(XT_DATA_PIN); \
     56     } while (0)
     57 
     58 #define XT_CLOCK_IN()               \
     59     do {                            \
     60         gpio_set_pin_input(XT_CLOCK_PIN);  \
     61         gpio_write_pin_high(XT_CLOCK_PIN); \
     62     } while (0)
     63 
     64 #define XT_CLOCK_READ() gpio_read_pin(XT_CLOCK_PIN)
     65 
     66 #define XT_CLOCK_LO()               \
     67     do {                            \
     68         gpio_write_pin_low(XT_CLOCK_PIN);  \
     69         gpio_set_pin_output(XT_CLOCK_PIN); \
     70     } while (0)
     71 
     72 void xt_host_init(void);
     73 
     74 uint8_t xt_host_recv(void);