Mercurial > louis > kiibohd-controller
annotate Scan/MBC-55X/scan_loop.c @ 450:48ede6680396 master
Updating MBC-55X scan module
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sun, 12 Jun 2016 15:53:25 -0700 |
parents | 9afed592bcb5 |
children |
rev | line source |
---|---|
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
1 /* Copyright (C) 2013,2014,2016 by Jacob Alexander |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
2 * |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
3 * Permission is hereby granted, free of charge, to any person obtaining a copy |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
4 * of this software and associated documentation files (the "Software"), to deal |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
5 * in the Software without restriction, including without limitation the rights |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
7 * copies of the Software, and to permit persons to whom the Software is |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
8 * furnished to do so, subject to the following conditions: |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
9 * |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
10 * The above copyright notice and this permission notice shall be included in |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
11 * all copies or substantial portions of the Software. |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
12 * |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
19 * THE SOFTWARE. |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
20 */ |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
21 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
22 // ----- Includes ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
23 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
24 // Compiler Includes |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
25 #include <Lib/ScanLib.h> |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
26 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
27 // Project Includes |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
28 #include <kll_defs.h> |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
29 #include <led.h> |
149
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
30 #include <macro.h> |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
31 #include <print.h> |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
32 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
33 // Local Includes |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
34 #include "scan_loop.h" |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
35 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
36 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
37 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
38 // ----- Defines ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
39 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
40 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
41 // ----- Macros ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
42 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
43 |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
44 // ----- Enums ----- |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
45 |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
46 // Keypress States |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
47 typedef enum KeyPosition { |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
48 KeyState_Off = 0, |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
49 KeyState_Press = 1, |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
50 KeyState_Hold = 2, |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
51 KeyState_Release = 3, |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
52 KeyState_Invalid, |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
53 } KeyPosition; |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
54 |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
55 |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
56 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
57 // ----- Variables ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
58 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
59 // Buffer used to inform the macro processing module which keys have been detected as pressed |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
60 volatile uint8_t KeyIndex_Buffer[KEYBOARD_BUFFER]; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
61 volatile uint8_t KeyIndex_BufferUsed; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
62 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
63 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
64 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
65 // ----- Function Declarations ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
66 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
67 void processKeyValue( uint8_t valueType ); |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
68 void removeKeyValue( uint8_t keyValue ); |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
69 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
70 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
71 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
72 // ----- Interrupt Functions ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
73 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
74 // UART Receive Buffer Full Interrupt |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
75 #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
76 ISR(USART1_RX_vect) |
263
9afed592bcb5
Preparing for mk20dx256vlh7
Jacob Alexander <haata@kiibohd.com>
parents:
149
diff
changeset
|
77 #elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
78 void uart0_status_isr(void) |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
79 #endif |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
80 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
81 cli(); // Disable Interrupts |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
82 |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
83 // Variable for UART data read |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
84 uint8_t keyValue = 0x00; |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
85 |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
86 #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
87 keyValue = UDR1; |
263
9afed592bcb5
Preparing for mk20dx256vlh7
Jacob Alexander <haata@kiibohd.com>
parents:
149
diff
changeset
|
88 #elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
89 // UART0_S1 must be read for the interrupt to be cleared |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
90 if ( UART0_S1 & UART_S1_RDRF ) |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
91 { |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
92 // Only doing single byte FIFO here |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
93 keyValue = UART0_D; |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
94 } |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
95 #endif |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
96 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
97 // Debug |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
98 char tmpStr[6]; |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
99 hexToStr( keyValue, tmpStr ); |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
100 dPrintStrs( tmpStr, " " ); // Debug |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
101 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
102 // Decipher scan value |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
103 processKeyValue( keyValue ); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
104 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
105 sei(); // Re-enable Interrupts |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
106 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
107 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
108 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
109 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
110 // ----- Functions ----- |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
111 |
149
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
112 // Reset Keyboard |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
113 void Scan_resetKeyboard( void ) |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
114 { |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
115 // Not a calculated valued... |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
116 _delay_ms( 50 ); |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
117 |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
118 KeyIndex_BufferUsed = 0; |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
119 } |
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
120 |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
121 // Setup |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
122 inline void Scan_setup() |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
123 #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
124 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
125 // Setup the the USART interface for keyboard data input |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
126 |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
127 // Setup baud rate - 1205 Baud |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
128 // 16 MHz / ( 16 * Baud ) = UBRR |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
129 // Baud: 1205 -> 16 MHz / ( 16 * 1205 ) = 829.8755 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
130 // Thus baud setting = 830 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
131 uint16_t baud = 830; // Max setting of 4095 |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
132 UBRR1H = (uint8_t)(baud >> 8); |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
133 UBRR1L = (uint8_t)baud; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
134 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
135 // Enable the receiver, and RX Complete Interrupt |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
136 UCSR1B = 0x90; |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
137 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
138 // Set frame format: 8 data, 1 stop bit, even parity |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
139 // Asynchrounous USART mode |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
140 UCSR1C = 0x26; |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
141 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
142 // Reset the keyboard before scanning, we might be in a wierd state |
149
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
143 Scan_resetKeyboard(); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
144 } |
263
9afed592bcb5
Preparing for mk20dx256vlh7
Jacob Alexander <haata@kiibohd.com>
parents:
149
diff
changeset
|
145 #elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
146 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
147 // Setup the the UART interface for keyboard data input |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
148 SIM_SCGC4 |= SIM_SCGC4_UART0; // Disable clock gating |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
149 |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
150 // Pin Setup for UART0 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
151 PORTB_PCR16 = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3); // RX Pin |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
152 PORTB_PCR17 = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3); // TX Pin |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
153 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
154 // Setup baud rate - 1205 Baud |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
155 // 48 MHz / ( 16 * Baud ) = BDH/L |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
156 // Baud: 1205 -> 48 MHz / ( 16 * 1205 ) = 2489.6266 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
157 // Thus baud setting = 2490 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
158 // NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
159 uint16_t baud = 2490; // Max setting of 8191 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
160 UART0_BDH = (uint8_t)(baud >> 8); |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
161 UART0_BDL = (uint8_t)baud; |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
162 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
163 // 8 bit, Even Parity, Idle Character bit after stop |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
164 // NOTE: For 8 bit with Parity you must enable 9 bit transmission (pg. 1065) |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
165 // You only need to use UART0_D for 8 bit reading/writing though |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
166 // UART_C1_M UART_C1_PE UART_C1_PT UART_C1_ILT |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
167 UART0_C1 = UART_C1_M | UART_C1_PE | UART_C1_ILT; |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
168 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
169 // Number of bytes in FIFO before TX Interrupt |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
170 UART0_TWFIFO = 1; |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
171 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
172 // Number of bytes in FIFO before RX Interrupt |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
173 UART0_RWFIFO = 1; |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
174 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
175 // TX FIFO Disabled, TX FIFO Size 1 (Max 8 datawords), RX FIFO Enabled, RX FIFO Size 1 (Max 8 datawords) |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
176 // TX/RX FIFO Size: |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
177 // 0x0 - 1 dataword |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
178 // 0x1 - 4 dataword |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
179 // 0x2 - 8 dataword |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
180 //UART0_PFIFO = UART_PFIFO_TXFE | /*TXFIFOSIZE*/ (0x0 << 4) | UART_PFIFO_RXFE | /*RXFIFOSIZE*/ (0x0); |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
181 |
74
91c9eb3967b1
Adding the MSBF register enable flag.
Jacob Alexander <triplehaata@gmail.com>
parents:
73
diff
changeset
|
182 // Reciever Inversion Disabled, LSBF |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
183 // UART_S2_RXINV UART_S2_MSBF |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
184 UART0_S2 |= 0x00; |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
185 |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
186 // Transmit Inversion Disabled |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
187 // UART_C3_TXINV |
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
188 UART0_C3 |= 0x00; |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
189 |
74
91c9eb3967b1
Adding the MSBF register enable flag.
Jacob Alexander <triplehaata@gmail.com>
parents:
73
diff
changeset
|
190 // TX Disabled, RX Enabled, RX Interrupt Enabled |
75
108076064e6c
UART0 on Teensy 3.0 now functional
Jacob Alexander <triplehaata@gmail.com>
parents:
74
diff
changeset
|
191 // UART_C2_TE UART_C2_RE UART_C2_RIE |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
192 UART0_C2 = UART_C2_RE | UART_C2_RIE; |
74
91c9eb3967b1
Adding the MSBF register enable flag.
Jacob Alexander <triplehaata@gmail.com>
parents:
73
diff
changeset
|
193 |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
194 // Add interrupt to the vector table |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
195 NVIC_ENABLE_IRQ( IRQ_UART0_STATUS ); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
196 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
197 // Reset the keyboard before scanning, we might be in a wierd state |
149
c127188dcc80
Adding compiler change detection.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
198 Scan_resetKeyboard(); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
199 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
200 #endif |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
201 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
202 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
203 // Main Detection Loop |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
204 inline uint8_t Scan_loop() |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
205 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
206 return 0; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
207 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
208 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
209 void processKeyValue( uint8_t keyValue ) |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
210 { |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
211 // XXX NOTE: The key processing is not complete for this keyboard |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
212 // Mostly due to laziness, and that the keyboard can't really be useful on a modern computer |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
213 // Basic typing will work, but some of the keys and the Graph mode changes things around |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
214 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
215 // Add key(s) to processing buffer |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
216 // First split out Shift and Ctrl |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
217 // Reserved Codes: |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
218 // Shift - 0xF5 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
219 // Ctrl - 0xF6 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
220 switch ( keyValue ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
221 { |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
222 // - Ctrl Keys - |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
223 // Exception keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
224 case 0x08: // ^H |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
225 case 0x09: // ^I |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
226 case 0x0D: // ^M |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
227 case 0x1B: // ^[ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
228 Macro_keyState( keyValue, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
229 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
230 // 0x40 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
231 // Add Ctrl key and offset to the lower alphabet |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
232 case 0x00: // ^@ |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
233 case 0x1C: // "^\" |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
234 case 0x1D: // ^] |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
235 case 0x1E: // ^^ |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
236 case 0x1F: // ^_ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
237 Macro_keyState( 0xF6, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
238 Macro_keyState( keyValue + 0x40, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
239 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
240 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
241 // - Add Shift key and offset to non-shifted key - |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
242 // 0x10 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
243 case 0x21: // ! |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
244 case 0x23: // # |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
245 case 0x24: // $ |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
246 case 0x25: // % |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
247 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
248 Macro_keyState( keyValue + 0x10, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
249 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
250 // 0x11 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
251 case 0x26: // & |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
252 case 0x28: // ( |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
253 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
254 Macro_keyState( keyValue + 0x11, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
255 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
256 // 0x07 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
257 case 0x29: // ) |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
258 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
259 Macro_keyState( keyValue + 0x07, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
260 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
261 // -0x0E Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
262 case 0x40: // @ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
263 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
264 Macro_keyState( keyValue - 0x0E, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
265 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
266 // 0x0E Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
267 case 0x2A: // * |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
268 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
269 Macro_keyState( keyValue + 0x0E, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
270 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
271 // 0x12 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
272 case 0x2B: // + |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
273 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
274 Macro_keyState( keyValue + 0x12, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
275 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
276 // 0x05 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
277 case 0x22: // " |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
278 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
279 Macro_keyState( keyValue + 0x05, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
280 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
281 // 0x01 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
282 case 0x3A: // : |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
283 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
284 Macro_keyState( keyValue + 0x01, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
285 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
286 // -0x10 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
287 case 0x3C: // < |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
288 case 0x3E: // > |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
289 case 0x3F: // ? |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
290 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
291 Macro_keyState( keyValue - 0x10, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
292 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
293 // -0x28 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
294 case 0x5E: // ^ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
295 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
296 Macro_keyState( keyValue - 0x28, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
297 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
298 // -0x32 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
299 case 0x5F: // _ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
300 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
301 Macro_keyState( keyValue - 0x32, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
302 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
303 // -0x20 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
304 case 0x7B: // { |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
305 case 0x7C: // | |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
306 case 0x7D: // } |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
307 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
308 Macro_keyState( keyValue - 0x20, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
309 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
310 // -0x1E Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
311 case 0x7E: // ~ |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
312 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
313 Macro_keyState( keyValue - 0x1E, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
314 break; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
315 // All other keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
316 default: |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
317 // Ctrl Characters are from 0x00 to 0x1F, excluding: |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
318 // 0x08 - Backspace |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
319 // 0x09 - [Horizontal] Tab |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
320 // 0x0D - [Carriage] Return |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
321 // 0x1B - Escape |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
322 // 0x7F - Delete (^?) (Doesn't need to be split out) |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
323 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
324 // 0x60 Offset Keys |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
325 // Add Ctrl key and offset to the lower alphabet |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
326 if ( keyValue >= 0x00 && keyValue <= 0x1F ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
327 { |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
328 Macro_keyState( 0xF6, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
329 Macro_keyState( keyValue + 0x60, KeyState_Press ); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
330 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
331 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
332 // Shift Characters are from 0x41 to 0x59 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
333 // No exceptions here :D |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
334 // Add Shift key and offset to the lower alphabet |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
335 else if ( keyValue >= 0x41 && keyValue <= 0x5A ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
336 { |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
337 Macro_keyState( 0xF5, KeyState_Press ); |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
338 Macro_keyState( keyValue + 0x20, KeyState_Press ); |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
339 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
340 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
341 // Everything else |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
342 else |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
343 { |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
344 Macro_keyState( keyValue, KeyState_Press ); |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
345 } |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
346 break; |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
347 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
348 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
349 |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
350 // Send data |
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
351 // NOTE: Example only, MBC-55X cannot receive user data |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
352 uint8_t Scan_sendData( uint8_t dataPayload ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
353 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
354 // Debug |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
355 char tmpStr[6]; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
356 hexToStr( dataPayload, tmpStr ); |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
357 info_dPrint( "Sending - ", tmpStr ); |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
358 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
359 #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
360 UDR1 = dataPayload; |
263
9afed592bcb5
Preparing for mk20dx256vlh7
Jacob Alexander <haata@kiibohd.com>
parents:
149
diff
changeset
|
361 #elif defined(_mk20dx128_) || defined(_mk20dx256_) // ARM |
73
872273398943
Adding initial ARM UART structure for UART0
Jacob Alexander <triplehaata@gmail.com>
parents:
70
diff
changeset
|
362 UART0_D = dataPayload; |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
363 #endif |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
364 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
365 return 0; |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
366 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
367 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
368 // Signal KeyIndex_Buffer that it has been properly read |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
369 void Scan_finishedWithMacro( uint8_t sentKeys ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
370 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
371 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
372 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
373 // Signal that the keys have been properly sent over USB |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
374 void Scan_finishedWithOutput( uint8_t sentKeys ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
375 { |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
376 cli(); // Disable Interrupts |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
377 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
378 // Reset the buffer counter |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
379 KeyIndex_BufferUsed = 0; |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
380 |
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
381 sei(); // Re-enable Interrupts |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
382 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
383 |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
384 // Reset/Hold keyboard |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
385 // NOTE: Does nothing with the MBC-55x |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
386 void Scan_lockKeyboard( void ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
387 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
388 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
389 |
77
a977fbfdb7a5
MBC-55x support virtually complete.
Jacob Alexander <triplehaata@gmail.com>
parents:
75
diff
changeset
|
390 // NOTE: Does nothing with the MBC-55x |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
77
diff
changeset
|
391 void Scan_unlockKeyboard( void ) |
70
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
392 { |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
393 } |
23600aaa5e15
Adding initial Teensy 3 support, compiles, but not fully functional yet.
Jacob Alexander <triplehaata@gmail.com>
parents:
diff
changeset
|
394 |
450
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
395 // NOTE: Does nothing with the MBC-55x |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
396 void Scan_currentChange( unsigned int current ) |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
397 { |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
398 } |
48ede6680396
Updating MBC-55X scan module
Jacob Alexander <haata@kiibohd.com>
parents:
263
diff
changeset
|
399 |