]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/ergodone/ergodone.h
Apply MAKEFLAGS to speed up CI
[qmk_firmware.git] / keyboards / ergodone / ergodone.h
1 #ifndef ERGODOX_ERGODONE_H
2 #define ERGODOX_ERGODONE_H
3
4 #include "quantum.h"
5 #include <stdint.h>
6 #include <stdbool.h>
7
8 #define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
9 #define CPU_16MHz       0x00
10
11 void init_ergodox(void);
12
13 inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<PB5); PORTB &= ~(1<<PB5); }
14 inline void ergodox_right_led_1_on(void) { DDRB |= (1<<PB5); PORTB |= (1<<PB5); }
15 inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<PB6); PORTB &= ~(1<<PB6); }
16 inline void ergodox_right_led_2_on(void) { DDRB |= (1<<PB6); PORTB |= (1<<PB6); }
17 inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<PB3); PORTB &= ~(1<<PB3); }
18 inline void ergodox_right_led_3_on(void) { DDRB |= (1<<PB3); PORTB |= (1<<PB3); }
19 inline void ergodox_right_led_on(uint8_t l) {
20     switch (l) {
21          case 1:
22              ergodox_right_led_1_on();
23              break;
24          case 2:
25              ergodox_right_led_2_on();
26              break;
27          case 3:
28              ergodox_right_led_3_on();
29              break;
30          default:
31              break;
32         }
33 }
34
35 inline void ergodox_right_led_off(uint8_t l) {
36     switch (l) {
37          case 1:
38              ergodox_right_led_1_off();
39              break;
40          case 2:
41              ergodox_right_led_2_off();
42              break;
43          case 3:
44              ergodox_right_led_3_off();
45              break;
46          default:
47              break;
48         }
49 }
50 inline void ergodox_board_led_off(void) { DDRB &= ~(1<<PB0); PORTB |= (1<<PB0); }
51 inline void ergodox_board_led_on(void) { DDRB |= (1<<PB0); PORTB &= ~(1<<PB0); }
52 inline void ergodox_led_all_on(void) {
53     ergodox_right_led_1_on();
54     ergodox_right_led_2_on();
55     ergodox_right_led_3_on();
56     ergodox_board_led_on();
57 }
58 inline void ergodox_led_all_off(void) {
59     ergodox_right_led_1_off();
60     ergodox_right_led_2_off();
61     ergodox_right_led_3_off();
62     ergodox_board_led_off();
63 }
64 inline void ergodox_right_led_1_set(uint8_t n)          {}
65 inline void ergodox_right_led_2_set(uint8_t n)          {}
66 inline void ergodox_right_led_3_set(uint8_t n)          {}
67 inline void ergodox_right_led_set(uint8_t l, uint8_t n) {}
68 inline void ergodox_led_all_set(uint8_t n)              {}
69
70 /*
71  *   LEFT HAND: LINES 76-83
72  *  RIGHT HAND: LINES 85-92
73  */
74 #define LAYOUT_ergodox(                                         \
75                                                                 \
76     k00,k01,k02,k03,k04,k05,k06,                                \
77     k10,k11,k12,k13,k14,k15,k16,                                \
78     k20,k21,k22,k23,k24,k25,                                    \
79     k30,k31,k32,k33,k34,k35,k36,                                \
80     k40,k41,k42,k43,k44,                                        \
81                             k55,k56,                            \
82                                 k54,                            \
83                         k53,k52,k51,                            \
84                                                                 \
85         k07,k08,k09,k0A,k0B,k0C,k0D,                            \
86         k17,k18,k19,k1A,k1B,k1C,k1D,                            \
87             k28,k29,k2A,k2B,k2C,k2D,                            \
88         k37,k38,k39,k3A,k3B,k3C,k3D,                            \
89                 k49,k4A,k4B,k4C,k4D,                            \
90     k57,k58,                                                    \
91     k59,                                                        \
92     k5C,k5B,k5A )                                               \
93                                                                 \
94    /* matrix positions */                                       \
95    {                                                            \
96     { k00,   k01, k02, k03, k04, k05,   k06,      k07,   k08,   k09, k0A, k0B, k0C, k0D    }, \
97     { k10,   k11, k12, k13, k14, k15,   k16,      k17,   k18,   k19, k1A, k1B, k1C, k1D    }, \
98     { k20,   k21, k22, k23, k24, k25,   KC_NO,    KC_NO, k28,   k29, k2A, k2B, k2C, k2D    }, \
99     { k30,   k31, k32, k33, k34, k35,   k36,      k37,   k38,   k39, k3A, k3B, k3C, k3D    }, \
100     { k40,   k41, k42, k43, k44, KC_NO, KC_NO,    KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D    }, \
101     { KC_NO, k51, k52, k53, k54, k55,   k56,      k57,   k58,   k59, k5A, k5B, k5C, KC_NO  }  \
102    }
103
104 /*
105  *   LEFT HAND: LINES 110-117
106  *  RIGHT HAND: LINES 119-126
107  */
108 #define LAYOUT_ergodox_80(                                      \
109                                                                 \
110     k00,k01,k02,k03,k04,k05,k06,                                \
111     k10,k11,k12,k13,k14,k15,k16,                                \
112     k20,k21,k22,k23,k24,k25,                                    \
113     k30,k31,k32,k33,k34,k35,k36,                                \
114     k40,k41,k42,k43,k44,                                        \
115                             k55,k56,                            \
116                         k45,k46,k54,                            \
117                         k53,k52,k51,                            \
118                                                                 \
119         k07,k08,k09,k0A,k0B,k0C,k0D,                            \
120         k17,k18,k19,k1A,k1B,k1C,k1D,                            \
121             k28,k29,k2A,k2B,k2C,k2D,                            \
122         k37,k38,k39,k3A,k3B,k3C,k3D,                            \
123                 k49,k4A,k4B,k4C,k4D,                            \
124     k57,k58,                                                    \
125     k59,k47,k48,                                                \
126     k5C,k5B,k5A )                                               \
127                                                                 \
128    /* matrix positions */                                       \
129    {                                                            \
130     { k00,   k01, k02, k03, k04, k05, k06,      k07,   k08, k09, k0A, k0B, k0C, k0D    }, \
131     { k10,   k11, k12, k13, k14, k15, k16,      k17,   k18, k19, k1A, k1B, k1C, k1D    }, \
132     { k20,   k21, k22, k23, k24, k25, KC_NO,    KC_NO, k28, k29, k2A, k2B, k2C, k2D    }, \
133     { k30,   k31, k32, k33, k34, k35, k36,      k37,   k38, k39, k3A, k3B, k3C, k3D    }, \
134     { k40,   k41, k42, k43, k44, k45, k45,      k47,   k48, k49, k4A, k4B, k4C, k4D    }, \
135     { KC_NO, k51, k52, k53, k54, k55, k56,      k57,   k58, k59, k5A, k5B, k5C, KC_NO  }  \
136    }
137
138 /*  ---------- LEFT HAND -----------       ---------- RIGHT HAND ---------- */
139 #define LAYOUT_ergodox_pretty(                                                  \
140                                                                                 \
141     L00,L01,L02,L03,L04,L05,L06,               R00,R01,R02,R03,R04,R05,R06,     \
142     L10,L11,L12,L13,L14,L15,L16,               R10,R11,R12,R13,R14,R15,R16,     \
143     L20,L21,L22,L23,L24,L25,                       R21,R22,R23,R24,R25,R26,     \
144     L30,L31,L32,L33,L34,L35,L36,               R30,R31,R32,R33,R34,R35,R36,     \
145     L40,L41,L42,L43,L44,                               R42,R43,R44,R45,R46,     \
146                             L55,L56,       R50,R51,                             \
147                                 L54,       R52,                                 \
148                         L53,L52,L51,       R55,R54,R53 )                        \
149                                                                                 \
150    /* matrix positions */                                                       \
151    {                                                                            \
152     {   L00,L01,L02,L03,L04,L05,L06,            R00,R01,R02,R03,R04,R05,R06  }, \
153     {   L10,L11,L12,L13,L14,L15,L16,            R10,R11,R12,R13,R14,R15,R16  }, \
154     {   L20,L21,L22,L23,L24,L25,KC_NO,        KC_NO,R21,R22,R23,R24,R25,R26  }, \
155     {   L30,L31,L32,L33,L34,L35,L36,            R30,R31,R32,R33,R34,R35,R36  }, \
156     { L40,L41,L42,L43,L44,KC_NO,KC_NO,    KC_NO,KC_NO,R42,R43,R44,R45,R46    }, \
157     { KC_NO,L51,L52,L53,L54,L55,L56,          R50,R51,R52,R53,R54,R55,KC_NO  }  \
158    }
159
160 /*  ---------- LEFT HAND -----------       ---------- RIGHT HAND ---------- */
161 #define LAYOUT_ergodox_pretty_80(                                              \
162                                                                                \
163     L00,L01,L02,L03,L04,L05,L06,               R00,R01,R02,R03,R04,R05,R06,    \
164     L10,L11,L12,L13,L14,L15,L16,               R10,R11,R12,R13,R14,R15,R16,    \
165     L20,L21,L22,L23,L24,L25,                       R21,R22,R23,R24,R25,R26,    \
166     L30,L31,L32,L33,L34,L35,L36,               R30,R31,R32,R33,R34,R35,R36,    \
167     L40,L41,L42,L43,L44,                               R42,R43,R44,R45,R46,    \
168                             L55,L56,       R50,R51,                            \
169                         L45,L46,L54,       R52,R40,R41,                        \
170                         L53,L52,L51,       R55,R54,R53 )                       \
171                                                                                \
172    /* matrix positions */                                                      \
173    {                                                                           \
174     {   L00,L01,L02,L03,L04,L05,L06,          R00,R01,R02,R03,R04,R05,R06   }, \
175     {   L10,L11,L12,L13,L14,L15,L16,          R10,R11,R12,R13,R14,R15,R16   }, \
176     {   L20,L21,L22,L23,L24,L25,KC_NO,      KC_NO,R21,R22,R23,R24,R25,R26   }, \
177     {   L30,L31,L32,L33,L34,L35,L36,          R30,R31,R32,R33,R34,R35,R36   }, \
178     {   L40,L41,L42,L43,L44,L45,L46,          R40,R41,R42,R43,R44,R45,R46   }, \
179     { KC_NO,L51,L52,L53,L54,L55,L56,          R50,R51,R52,R53,R54,R55,KC_NO }  \
180    }
181
182 #endif