diff options
| author | markspanbroek <mark@spanbroek.net> | 2018-10-22 21:37:03 +0200 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-10-22 12:37:03 -0700 |
| commit | 6d7745a110daad815fe5edbb35a2e33702f24aaa (patch) | |
| tree | d18512753edbec9668e8b0b4cdf4f688e2a39971 /tmk_core/protocol/xt.h | |
| parent | bf57587e6203e3bcabbc161c1d45b9a6cc7abfaa (diff) | |
| download | qmk_firmware-6d7745a110daad815fe5edbb35a2e33702f24aaa.tar.gz qmk_firmware-6d7745a110daad815fe5edbb35a2e33702f24aaa.zip | |
Keyboard: Port of TMK XT USB Converter (#3619)
* Converter: add XT USB converter from TMK
* Converter: port TMK code for USB converter to QMK
* Apply requested changes after code review by @drashna
- use "pragma once" instead of include guards
- use LAYOUT instead of KEYMAP
- allow customisation with matrix_init_user() and matrix_scan_user()
- set BOOTLOADER instead of BOOTLOADER_SIZE
- Add XT_ENABLE to OPT_DEFS
* Remove unnecessary lines
Diffstat (limited to 'tmk_core/protocol/xt.h')
| -rw-r--r-- | tmk_core/protocol/xt.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tmk_core/protocol/xt.h b/tmk_core/protocol/xt.h new file mode 100644 index 000000000..93bc5daf8 --- /dev/null +++ b/tmk_core/protocol/xt.h | |||
| @@ -0,0 +1,71 @@ | |||
| 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 | #ifndef XT_H | ||
| 40 | #define XT_H | ||
| 41 | |||
| 42 | #define XT_DATA_IN() do { \ | ||
| 43 | XT_DATA_DDR &= ~(1<<XT_DATA_BIT); \ | ||
| 44 | XT_DATA_PORT |= (1<<XT_DATA_BIT); \ | ||
| 45 | } while (0) | ||
| 46 | |||
| 47 | #define XT_DATA_READ() (XT_DATA_PIN&(1<<XT_DATA_BIT)) | ||
| 48 | |||
| 49 | #define XT_DATA_LO() do { \ | ||
| 50 | XT_DATA_PORT &= ~(1<<XT_DATA_BIT); \ | ||
| 51 | XT_DATA_DDR |= (1<<XT_DATA_BIT); \ | ||
| 52 | } while (0) | ||
| 53 | |||
| 54 | |||
| 55 | #define XT_CLOCK_IN() do { \ | ||
| 56 | XT_CLOCK_DDR &= ~(1<<XT_CLOCK_BIT); \ | ||
| 57 | XT_CLOCK_PORT |= (1<<XT_CLOCK_BIT); \ | ||
| 58 | } while (0) | ||
| 59 | |||
| 60 | #define XT_CLOCK_READ() (XT_CLOCK_PIN&(1<<XT_CLOCK_BIT)) | ||
| 61 | |||
| 62 | #define XT_CLOCK_LO() do { \ | ||
| 63 | XT_CLOCK_PORT &= ~(1<<XT_CLOCK_BIT); \ | ||
| 64 | XT_CLOCK_DDR |= (1<<XT_CLOCK_BIT); \ | ||
| 65 | } while (0) | ||
| 66 | |||
| 67 | |||
| 68 | void xt_host_init(void); | ||
| 69 | uint8_t xt_host_recv(void); | ||
| 70 | |||
| 71 | #endif | ||
