Mercurial > louis > kiibohd-controller
annotate main.c @ 412:e7a3be42ae1e
Debug code for interconnect cable debugging
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sat, 20 Feb 2016 13:27:49 -0800 |
parents | b29c291ad130 |
children |
rev | line source |
---|---|
106
15961894eaeb
Adding basic CLI functionality.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
1 /* Copyright (C) 2011-2014 by Jacob Alexander |
15961894eaeb
Adding basic CLI functionality.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
2 * |
0 | 3 * Permission is hereby granted, free of charge, to any person obtaining a copy |
4 * of this software and associated documentation files (the "Software"), to deal | |
5 * in the Software without restriction, including without limitation the rights | |
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
7 * copies of the Software, and to permit persons to whom the Software is | |
8 * furnished to do so, subject to the following conditions: | |
106
15961894eaeb
Adding basic CLI functionality.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
9 * |
0 | 10 * The above copyright notice and this permission notice shall be included in |
11 * all copies or substantial portions of the Software. | |
106
15961894eaeb
Adding basic CLI functionality.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
12 * |
0 | 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
19 * THE SOFTWARE. | |
20 */ | |
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 |
67
9ad7c1a28661
Preparing for Teensy 3 (ARM) integration, abstracting code hierarchy
Jacob Alexander <triplehaata@gmail.com>
parents:
40
diff
changeset
|
24 // Compiler Includes |
9ad7c1a28661
Preparing for Teensy 3 (ARM) integration, abstracting code hierarchy
Jacob Alexander <triplehaata@gmail.com>
parents:
40
diff
changeset
|
25 #include <Lib/MainLib.h> |
24
2d65da455ef3
Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents:
18
diff
changeset
|
26 |
2d65da455ef3
Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents:
18
diff
changeset
|
27 // Project Includes |
25 | 28 #include <macro.h> |
29 #include <scan_loop.h> | |
105
3764d78996a8
More renaming for the USB to Output Module renaming
Jacob Alexander <haata@kiibohd.com>
parents:
72
diff
changeset
|
30 #include <output_com.h> |
2
c3b2eaa4a89d
Significant progress made.
Jacob Alexander <triplehaata@gmail.com>
parents:
1
diff
changeset
|
31 |
106
15961894eaeb
Adding basic CLI functionality.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
32 #include <cli.h> |
25 | 33 #include <led.h> |
34 #include <print.h> | |
0 | 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 // ----- Functions ----- |
2d65da455ef3
Formalizing code module structure and inheritance (Large Commit)
Jacob Alexander <triplehaata@gmail.com>
parents:
18
diff
changeset
|
39 |
174
848e1ef8966c
McHCK now working with UART.
Jacob Alexander <haata@kiibohd.com>
parents:
169
diff
changeset
|
40 int main() |
0 | 41 { |
220
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
42 // AVR - Teensy Set Clock speed to 16 MHz |
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
43 #if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) |
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
44 CLKPR = 0x80; |
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
45 CLKPR = 0x00; |
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
46 #endif |
1697eff231dc
Putting prescalar settings back in for AVR.
Jacob Alexander <haata@kiibohd.com>
parents:
219
diff
changeset
|
47 |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
48 // Enable CLI |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
49 CLI_init(); |
0 | 50 |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
51 // Setup Modules |
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
52 Output_setup(); |
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
53 Macro_setup(); |
132
e08d7b586ea3
Adding analog.c lib from teensyduino.
Jacob Alexander <haata@kiibohd.com>
parents:
125
diff
changeset
|
54 Scan_setup(); |
105
3764d78996a8
More renaming for the USB to Output Module renaming
Jacob Alexander <haata@kiibohd.com>
parents:
72
diff
changeset
|
55 |
0 | 56 // Main Detection Loop |
25 | 57 while ( 1 ) |
58 { | |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
59 // Process CLI |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
60 CLI_process(); |
26
c06a5ebb4fca
Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents:
25
diff
changeset
|
61 |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
62 // Acquire Key Indices |
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
63 // Loop continuously until scan_loop returns 0 |
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
64 cli(); |
140
98e4f0bc2a5b
Added support for IBM 50key, better DPH debug, cleanup
Jacob Alexander <haata@kiibohd.com>
parents:
132
diff
changeset
|
65 while ( Scan_loop() ); |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
66 sei(); |
25 | 67 |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
122
diff
changeset
|
68 // Run Macros over Key Indices and convert to USB Keys |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
69 Macro_process(); |
26
c06a5ebb4fca
Tandy 1000 Converter, basicly works, except for packet mismatches
Jacob Alexander <triplehaata@gmail.com>
parents:
25
diff
changeset
|
70 |
219
3a7d978b800e
Removing USB timer, no longer necessary.
Jacob Alexander <haata@kiibohd.com>
parents:
208
diff
changeset
|
71 // Sends USB data only if changed |
125
8dab4014c398
Major code cleanup and preparation for PartialMap Macro Module
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
72 Output_send(); |
16
f74b797ac060
Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents:
15
diff
changeset
|
73 } |
f74b797ac060
Parts of the upcoming rewrite
Jacob Alexander <triplehaata@gmail.com>
parents:
15
diff
changeset
|
74 } |
0 | 75 |