diff options
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 188 |
1 files changed, 182 insertions, 6 deletions
@@ -241,6 +241,7 @@ You can also add extra options at the end of the make command line, after the ta | |||
241 | * `make COLOR=false` - turns off color output | 241 | * `make COLOR=false` - turns off color output |
242 | * `make SILENT=true` - turns off output besides errors/warnings | 242 | * `make SILENT=true` - turns off output besides errors/warnings |
243 | * `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug) | 243 | * `make VERBOSE=true` - outputs all of the gcc stuff (not interesting, unless you need to debug) |
244 | * `make EXTRAFLAGS=-E` - Preprocess the code without doing any compiling (useful if you are trying to debug #define commands) | ||
244 | 245 | ||
245 | The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option. | 246 | The make command itself also has some additional options, type `make --help` for more information. The most useful is probably `-jx`, which specifies that you want to compile using more than one CPU, the `x` represents the number of CPUs that you want to use. Setting that can greatly reduce the compile times, especially if you are compiling many keyboards/keymaps. I usually set it to one less than the number of CPUs that I have, so that I have some left for doing other things while it's compiling. Note that not all operating systems and make versions supports that option. |
246 | 247 | ||
@@ -347,6 +348,10 @@ This allows you output audio on the C6 pin (needs abstracting). See the [audio s | |||
347 | 348 | ||
348 | Use this to debug changes to variable values, see the [tracing variables](#tracing-variables) section for more information. | 349 | Use this to debug changes to variable values, see the [tracing variables](#tracing-variables) section for more information. |
349 | 350 | ||
351 | `API_SYSEX_ENABLE` | ||
352 | |||
353 | This enables using the Quantum SYSEX API to send strings (somewhere?) | ||
354 | |||
350 | ### Customizing Makefile options on a per-keymap basis | 355 | ### Customizing Makefile options on a per-keymap basis |
351 | 356 | ||
352 | If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard. | 357 | If your keymap directory has a file called `Makefile` (note the filename), any Makefile options you set in that file will take precedence over other Makefile options for your particular keyboard. |
@@ -910,7 +915,33 @@ In `quantum/keymap_extras/`, you'll see various language files - these work the | |||
910 | 915 | ||
911 | ## Unicode support | 916 | ## Unicode support |
912 | 917 | ||
913 | You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout, see [this article](http://www.poynton.com/notes/misc/mac-unicode-hex-input.html) to learn more) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. | 918 | There are three Unicode keymap definition method available in QMK: |
919 | |||
920 | ### UNICODE_ENABLE | ||
921 | |||
922 | Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in | ||
923 | keymap file, where *n* is a 4 digit hexadecimal. | ||
924 | |||
925 | ### UNICODEMAP_ENABLE | ||
926 | |||
927 | Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping | ||
928 | table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. | ||
929 | The keycode function is `X(n)` where *n* is the array index of the mapping | ||
930 | table. | ||
931 | |||
932 | ### UCIS_ENABLE | ||
933 | |||
934 | TBD | ||
935 | |||
936 | Unicode input in QMK works by inputing a sequence of characters to the OS, | ||
937 | sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted. | ||
938 | |||
939 | This is the current list of Unicode input method in QMK: | ||
940 | |||
941 | * UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex. | ||
942 | * UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else. | ||
943 | * UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead. | ||
944 | * UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows. | ||
914 | 945 | ||
915 | ## Backlight Breathing | 946 | ## Backlight Breathing |
916 | 947 | ||
@@ -1135,12 +1166,12 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring | |||
1135 | 1166 | ||
1136 | RGBLIGHT_ENABLE = yes | 1167 | RGBLIGHT_ENABLE = yes |
1137 | 1168 | ||
1138 | In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile). | 1169 | In order to use the underglow animation functions, you need to have `#define RGBLIGHT_ANIMATIONS` in your `config.h`. |
1139 | 1170 | ||
1140 | Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: | 1171 | Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: |
1141 | 1172 | ||
1142 | #define RGB_DI_PIN F4 // The pin your RGB strip is wired to | 1173 | #define RGB_DI_PIN F4 // The pin your RGB strip is wired to |
1143 | #define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio) | 1174 | #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) |
1144 | #define RGBLED_NUM 14 // Number of LEDs | 1175 | #define RGBLED_NUM 14 // Number of LEDs |
1145 | #define RGBLIGHT_HUE_STEP 10 | 1176 | #define RGBLIGHT_HUE_STEP 10 |
1146 | #define RGBLIGHT_SAT_STEP 17 | 1177 | #define RGBLIGHT_SAT_STEP 17 |
@@ -1156,20 +1187,165 @@ The firmware supports 5 different light effects, and the color (hue, saturation, | |||
1156 | 1187 | ||
1157 | Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20. | 1188 | Please note the USB port can only supply a limited amount of power to the keyboard (500mA by standard, however, modern computer and most usb hubs can provide 700+mA.). According to the data of NeoPixel from Adafruit, 30 WS2812 LEDs require a 5V 1A power supply, LEDs used in this mod should not more than 20. |
1158 | 1189 | ||
1190 | ## PS/2 Mouse Support | ||
1191 | |||
1192 | Its possible to hook up a PS/2 mouse (for example touchpads or trackpoints) to your keyboard as a composite device. | ||
1193 | |||
1194 | Then, decide whether to use USART (best), interrupts (better) or busywait (not recommended), and enable the relevant option. | ||
1195 | |||
1196 | ### Busywait version | ||
1197 | |||
1198 | Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible. | ||
1199 | |||
1200 | In rules.mk: | ||
1201 | |||
1202 | ``` | ||
1203 | PS2_MOUSE_ENABLE = yes | ||
1204 | PS2_USE_BUSYWAIT = yes | ||
1205 | ``` | ||
1206 | |||
1207 | In your keyboard config.h: | ||
1208 | |||
1209 | ``` | ||
1210 | #ifdef PS2_USE_BUSYWAIT | ||
1211 | # define PS2_CLOCK_PORT PORTD | ||
1212 | # define PS2_CLOCK_PIN PIND | ||
1213 | # define PS2_CLOCK_DDR DDRD | ||
1214 | # define PS2_CLOCK_BIT 1 | ||
1215 | # define PS2_DATA_PORT PORTD | ||
1216 | # define PS2_DATA_PIN PIND | ||
1217 | # define PS2_DATA_DDR DDRD | ||
1218 | # define PS2_DATA_BIT 2 | ||
1219 | #endif | ||
1220 | ``` | ||
1221 | |||
1222 | ### Interrupt version | ||
1223 | |||
1224 | The following example uses D2 for clock and D5 for data. You can use any INT or PCINT pin for clock, and any pin for data. | ||
1225 | |||
1226 | In rules.mk: | ||
1227 | |||
1228 | ``` | ||
1229 | PS2_MOUSE_ENABLE = yes | ||
1230 | PS2_USE_INT = yes | ||
1231 | ``` | ||
1232 | |||
1233 | In your keyboard config.h: | ||
1234 | |||
1235 | ``` | ||
1236 | #ifdef PS2_USE_INT | ||
1237 | #define PS2_CLOCK_PORT PORTD | ||
1238 | #define PS2_CLOCK_PIN PIND | ||
1239 | #define PS2_CLOCK_DDR DDRD | ||
1240 | #define PS2_CLOCK_BIT 2 | ||
1241 | #define PS2_DATA_PORT PORTD | ||
1242 | #define PS2_DATA_PIN PIND | ||
1243 | #define PS2_DATA_DDR DDRD | ||
1244 | #define PS2_DATA_BIT 5 | ||
1245 | |||
1246 | #define PS2_INT_INIT() do { \ | ||
1247 | EICRA |= ((1<<ISC21) | \ | ||
1248 | (0<<ISC20)); \ | ||
1249 | } while (0) | ||
1250 | #define PS2_INT_ON() do { \ | ||
1251 | EIMSK |= (1<<INT2); \ | ||
1252 | } while (0) | ||
1253 | #define PS2_INT_OFF() do { \ | ||
1254 | EIMSK &= ~(1<<INT2); \ | ||
1255 | } while (0) | ||
1256 | #define PS2_INT_VECT INT2_vect | ||
1257 | #endif | ||
1258 | ``` | ||
1259 | |||
1260 | ### USART version | ||
1261 | |||
1262 | To use USART on the ATMega32u4, you have to use PD5 for clock and PD2 for data. If one of those are unavailable, you need to use interrupt version. | ||
1263 | |||
1264 | In rules.mk: | ||
1265 | |||
1266 | ``` | ||
1267 | PS2_MOUSE_ENABLE = yes | ||
1268 | PS2_USE_USART = yes | ||
1269 | ``` | ||
1270 | |||
1271 | In your keyboard config.h: | ||
1272 | |||
1273 | ``` | ||
1274 | #ifdef PS2_USE_USART | ||
1275 | #define PS2_CLOCK_PORT PORTD | ||
1276 | #define PS2_CLOCK_PIN PIND | ||
1277 | #define PS2_CLOCK_DDR DDRD | ||
1278 | #define PS2_CLOCK_BIT 5 | ||
1279 | #define PS2_DATA_PORT PORTD | ||
1280 | #define PS2_DATA_PIN PIND | ||
1281 | #define PS2_DATA_DDR DDRD | ||
1282 | #define PS2_DATA_BIT 2 | ||
1283 | |||
1284 | /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */ | ||
1285 | /* set DDR of CLOCK as input to be slave */ | ||
1286 | #define PS2_USART_INIT() do { \ | ||
1287 | PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \ | ||
1288 | PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \ | ||
1289 | UCSR1C = ((1 << UMSEL10) | \ | ||
1290 | (3 << UPM10) | \ | ||
1291 | (0 << USBS1) | \ | ||
1292 | (3 << UCSZ10) | \ | ||
1293 | (0 << UCPOL1)); \ | ||
1294 | UCSR1A = 0; \ | ||
1295 | UBRR1H = 0; \ | ||
1296 | UBRR1L = 0; \ | ||
1297 | } while (0) | ||
1298 | #define PS2_USART_RX_INT_ON() do { \ | ||
1299 | UCSR1B = ((1 << RXCIE1) | \ | ||
1300 | (1 << RXEN1)); \ | ||
1301 | } while (0) | ||
1302 | #define PS2_USART_RX_POLL_ON() do { \ | ||
1303 | UCSR1B = (1 << RXEN1); \ | ||
1304 | } while (0) | ||
1305 | #define PS2_USART_OFF() do { \ | ||
1306 | UCSR1C = 0; \ | ||
1307 | UCSR1B &= ~((1 << RXEN1) | \ | ||
1308 | (1 << TXEN1)); \ | ||
1309 | } while (0) | ||
1310 | #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1)) | ||
1311 | #define PS2_USART_RX_DATA UDR1 | ||
1312 | #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1))) | ||
1313 | #define PS2_USART_RX_VECT USART1_RX_vect | ||
1314 | #endif | ||
1315 | #endif | ||
1316 | #endif | ||
1317 | ``` | ||
1318 | |||
1159 | ## Safety Considerations | 1319 | ## Safety Considerations |
1160 | 1320 | ||
1161 | You probably don't want to "brick" your keyboard, making it impossible | 1321 | You probably don't want to "brick" your keyboard, making it impossible |
1162 | to rewrite firmware onto it. Here are some of the parameters to show | 1322 | to rewrite firmware onto it. Here are some of the parameters to show |
1163 | what things are (and likely aren't) too risky. | 1323 | what things are (and likely aren't) too risky. |
1164 | 1324 | ||
1165 | - If a keyboard map does not include RESET, then, to get into DFU | 1325 | - If your keyboard map does not include RESET, then, to get into DFU |
1166 | mode, you will need to press the reset button on the PCB, which | 1326 | mode, you will need to press the reset button on the PCB, which |
1167 | requires unscrewing some bits. | 1327 | requires unscrewing the bottom. |
1168 | - Messing with tmk_core / common files might make the keyboard | 1328 | - Messing with tmk_core / common files might make the keyboard |
1169 | inoperable | 1329 | inoperable |
1170 | - Too large a .hex file is trouble; `make dfu` will erase the block, | 1330 | - Too large a .hex file is trouble; `make dfu` will erase the block, |
1171 | test the size (oops, wrong order!), which errors out, failing to | 1331 | test the size (oops, wrong order!), which errors out, failing to |
1172 | flash the keyboard | 1332 | flash the keyboard, leaving it in DFU mode. |
1333 | - To this end, note that the maximum .hex file size on Planck is | ||
1334 | 7000h (28672 decimal) | ||
1335 | ```Linking: .build/planck_rev4_cbbrowne.elf [OK] | ||
1336 | Creating load file for Flash: .build/planck_rev4_cbbrowne.hex [OK] | ||
1337 | |||
1338 | Size after: | ||
1339 | text data bss dec hex filename | ||
1340 | 0 22396 0 22396 577c planck_rev4_cbbrowne.hex | ||
1341 | ``` | ||
1342 | - The above file is of size 22396/577ch, which is less than | ||
1343 | 28672/7000h | ||
1344 | - As long as you have a suitable alternative .hex file around, you | ||
1345 | can retry, loading that one | ||
1346 | - Some of the options you might specify in your keyboard's Makefile | ||
1347 | consume extra memory; watch out for BOOTMAGIC_ENABLE, | ||
1348 | MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, CONSOLE_ENABLE, API_SYSEX_ENABLE | ||
1173 | - DFU tools do /not/ allow you to write into the bootloader (unless | 1349 | - DFU tools do /not/ allow you to write into the bootloader (unless |
1174 | you throw in extra fruitsalad of options), so there is little risk | 1350 | you throw in extra fruitsalad of options), so there is little risk |
1175 | there. | 1351 | there. |