annotate main.c @ 40:d4552f24e4ad

Finishing up the Epson QX-10 module - Typing and modifiers fully working - Still some features left to implement * Stop input * Diagnostic test * Setting interval before starting repeat rate * More comments * Handling LED stats
author Jacob Alexander <triplehaata@gmail.com>
date Sun, 11 Dec 2011 00:06:49 -0800
parents 8e11cdc1aee4
children 9ad7c1a28661
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
1 /* Copyright (C) 2011 by Jacob Alexander
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
2 *
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
4 * of this software and associated documentation files (the "Software"), to deal
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
5 * in the Software without restriction, including without limitation the rights
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
7 * copies of the Software, and to permit persons to whom the Software is
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
8 * furnished to do so, subject to the following conditions:
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
9 *
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
10 * The above copyright notice and this permission notice shall be included in
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
11 * all copies or substantial portions of the Software.
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
12 *
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
19 * THE SOFTWARE.
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
20 */
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
21
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
22 // ----- Includes -----
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
23
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
24 // AVR Includes
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
25 #include <avr/io.h>
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
26 #include <avr/interrupt.h>
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
27
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
28 // Project Includes
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
29 #include <macro.h>
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
30 #include <scan_loop.h>
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
31 #include <usb_com.h>
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
32
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
33 #include <led.h>
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
34 #include <print.h>
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
35
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
36
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
37
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
38 // ----- Defines -----
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
39
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
40 // Verified Keypress Defines
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
41 #define USB_TRANSFER_DIVIDER 10 // 1024 == 1 Send of keypresses per second, 1 == 1 Send of keypresses per ~1 millisecond
1
0f88e9aad77a Initial macro line filler design for multiple keyboards matrices.
Jacob Alexander <triplehaata@gmail.com>
parents: 0
diff changeset
42
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
43
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
44
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
45 // ----- Macros -----
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
46 #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
47
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
48
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
49
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
50 // ----- Variables -----
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
51
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
52 // Timer Interrupt for flagging a send of the sampled key detection data to the USB host
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
53 uint16_t sendKeypressCounter = 0;
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
54
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
55 // Flag generated by the timer interrupt
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
56 volatile uint8_t sendKeypresses = 0;
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
57
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
58
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
59
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
60 // ----- Functions -----
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
61
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
62 // Initial Pin Setup, make sure they are sane
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
63 inline void pinSetup(void)
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
64 {
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
65
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
66 // For each pin, 0=input, 1=output
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
67 #if defined(__AVR_AT90USB1286__)
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
68 DDRA = 0x00;
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
69 #endif
5
a8be29294c26 Updating for the latest pinout
Jacob Alexander <triplehaata@gmail.com>
parents: 4
diff changeset
70 DDRB = 0x00;
a8be29294c26 Updating for the latest pinout
Jacob Alexander <triplehaata@gmail.com>
parents: 4
diff changeset
71 DDRC = 0x00;
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
72 DDRD = 0x00;
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
73 DDRE = 0x00;
5
a8be29294c26 Updating for the latest pinout
Jacob Alexander <triplehaata@gmail.com>
parents: 4
diff changeset
74 DDRF = 0x00;
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
75
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
76
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
77 // Setting pins to either high or pull-up resistor
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
78 #if defined(__AVR_AT90USB1286__)
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
79 PORTA = 0x00;
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
80 #endif
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
81 PORTB = 0x00;
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
82 PORTC = 0x00;
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
83 PORTD = 0x00;
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
84 PORTE = 0x00;
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
85 PORTF = 0x00;
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
86 }
7
18e424630cbd Adding basic per line keypad detection
Jacob Alexander <haata@users.sf.net>
parents: 6
diff changeset
87
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
88 int main(void)
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
89 {
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
90 // Setup with 16 MHz clock
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
91 CPU_PRESCALE( 0 );
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
92
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
93 // Configuring Pins
2
c3b2eaa4a89d Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents: 1
diff changeset
94 pinSetup();
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
95 init_errorLED();
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
96
24
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
97 // Setup USB Module
2d65da455ef3 Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents: 18
diff changeset
98 usb_setup();
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
99
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
100 // Setup ISR Timer for flagging a kepress send to USB
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
101 // Set to 256 * 1024 (8 bit timer with Clock/1024 prescalar) timer
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
102 TCCR0A = 0x00;
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
103 TCCR0B = 0x03;
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
104 TIMSK0 = (1 << TOIE0);
4
b97797936037 Redefining pinouts and adding key sending code.
Jacob Alexander <triplehaata@gmail.com>
parents: 3
diff changeset
105
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
106 // Main Detection Loop
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
107 uint8_t ledTimer = 15; // Enable LED for a short time
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
108 while ( 1 )
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
109 {
26
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
110 // Setup the scanning module
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
111 scan_setup();
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
112
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
113 while ( 1 )
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
114 {
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
115 // Acquire Key Indices
26
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
116 // Loop continuously until scan_loop returns 0
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
117 cli();
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
118 while ( scan_loop() );
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
119 sei();
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
120
27
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
121 // Run Macros over Key Indices and convert to USB Keys
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
122 process_macros();
8b8cad3db8db Basic matrix module for the hall effect keypad now working.
Jacob Alexander <triplehaata@gmail.com>
parents: 26
diff changeset
123
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
124 // Send keypresses over USB if the ISR has signalled that it's time
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
125 if ( !sendKeypresses )
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
126 continue;
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
127
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
128 // Send USB Data
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
129 usb_send();
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
130
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
131 // Clear sendKeypresses Flag
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
132 sendKeypresses = 0;
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
133
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
134 // Indicate Error, if valid
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
135 errorLED( ledTimer );
26
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
136
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
137 if ( ledTimer > 0 )
c06a5ebb4fca Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents: 25
diff changeset
138 ledTimer--;
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
139 }
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
140
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
141 // Loop should never get here (indicate error)
25
c2ef3daf39e1 Cleaning up main.c
Jacob Alexander <haata@users.sf.net>
parents: 24
diff changeset
142 ledTimer = 255;
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
143
17
85bc68be98df Code re-factor now compiles.
Jacob Alexander <triplehaata@gmail.com>
parents: 16
diff changeset
144 // HID Debug Error message
85bc68be98df Code re-factor now compiles.
Jacob Alexander <triplehaata@gmail.com>
parents: 16
diff changeset
145 erro_print("Detection loop error, this is very bad...bug report!");
16
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
146 }
f74b797ac060 Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents: 15
diff changeset
147 }
0
43dfb6e4e697 Initial Commit
Jacob Alexander <triplehaata@gmail.com>
parents:
diff changeset
148
34
5425548818d3 Adding support for the Micro Switch 8304 Hall Effect Keyboard
Jacob Alexander <triplehaata@gmail.com>
parents: 27
diff changeset
149 // USB Keyboard Data Send Counter Interrupt
6
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
150 ISR( TIMER0_OVF_vect )
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
151 {
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
152 sendKeypressCounter++;
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
153 if ( sendKeypressCounter > USB_TRANSFER_DIVIDER ) {
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
154 sendKeypressCounter = 0;
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
155 sendKeypresses = 1;
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
156 }
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
157 }
9df636be6feb Keyboard functionally working with very very good debouncing.
Jacob Alexander <triplehaata@gmail.com>
parents: 5
diff changeset
158