aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/_summary.md3
-rw-r--r--docs/audio_driver.md221
-rw-r--r--docs/compatible_microcontrollers.md5
-rw-r--r--docs/config_options.md14
-rw-r--r--docs/data_driven_config.md91
-rw-r--r--docs/feature_audio.md149
-rw-r--r--docs/feature_backlight.md24
-rw-r--r--docs/feature_macros.md113
-rw-r--r--docs/feature_mouse_keys.md31
-rw-r--r--docs/feature_pointing_device.md2
-rw-r--r--docs/feature_rgb_matrix.md22
-rw-r--r--docs/feature_rgblight.md13
-rw-r--r--docs/feature_split_keyboard.md10
-rw-r--r--docs/getting_started_make_guide.md4
-rw-r--r--docs/ja/compatible_microcontrollers.md5
-rw-r--r--docs/ja/feature_audio.md6
-rw-r--r--docs/ja/feature_macros.md113
-rw-r--r--docs/ja/feature_mouse_keys.md3
-rw-r--r--docs/ja/getting_started_make_guide.md4
-rw-r--r--docs/ja/proton_c_conversion.md1
-rw-r--r--docs/proton_c_conversion.md1
-rw-r--r--docs/reference_info_json.md158
-rw-r--r--docs/reference_keymap_extras.md2
-rw-r--r--docs/serial_driver.md1
-rw-r--r--docs/spi_driver.md12
-rw-r--r--docs/uart_driver.md90
26 files changed, 804 insertions, 294 deletions
diff --git a/docs/_summary.md b/docs/_summary.md
index 5af0046ab..acbfcfaed 100644
--- a/docs/_summary.md
+++ b/docs/_summary.md
@@ -133,11 +133,13 @@
133 * [Compatible Microcontrollers](compatible_microcontrollers.md) 133 * [Compatible Microcontrollers](compatible_microcontrollers.md)
134 * [Drivers](hardware_drivers.md) 134 * [Drivers](hardware_drivers.md)
135 * [ADC Driver](adc_driver.md) 135 * [ADC Driver](adc_driver.md)
136 * [Audio Driver](audio_driver.md)
136 * [I2C Driver](i2c_driver.md) 137 * [I2C Driver](i2c_driver.md)
137 * [SPI Driver](spi_driver.md) 138 * [SPI Driver](spi_driver.md)
138 * [WS2812 Driver](ws2812_driver.md) 139 * [WS2812 Driver](ws2812_driver.md)
139 * [EEPROM Driver](eeprom_driver.md) 140 * [EEPROM Driver](eeprom_driver.md)
140 * ['serial' Driver](serial_driver.md) 141 * ['serial' Driver](serial_driver.md)
142 * [UART Driver](uart_driver.md)
141 * [GPIO Controls](internals_gpio_control.md) 143 * [GPIO Controls](internals_gpio_control.md)
142 * [Keyboard Guidelines](hardware_keyboard_guidelines.md) 144 * [Keyboard Guidelines](hardware_keyboard_guidelines.md)
143 145
@@ -159,6 +161,7 @@
159 * [Contributing to QMK](contributing.md) 161 * [Contributing to QMK](contributing.md)
160 * [Translating the QMK Docs](translating.md) 162 * [Translating the QMK Docs](translating.md)
161 * [Config Options](config_options.md) 163 * [Config Options](config_options.md)
164 * [Data Driven Configuration](data_driven_config.md)
162 * [Make Documentation](getting_started_make_guide.md) 165 * [Make Documentation](getting_started_make_guide.md)
163 * [Documentation Best Practices](documentation_best_practices.md) 166 * [Documentation Best Practices](documentation_best_practices.md)
164 * [Documentation Templates](documentation_templates.md) 167 * [Documentation Templates](documentation_templates.md)
diff --git a/docs/audio_driver.md b/docs/audio_driver.md
new file mode 100644
index 000000000..7cd5a98d9
--- /dev/null
+++ b/docs/audio_driver.md
@@ -0,0 +1,221 @@
1# Audio Driver :id=audio-driver
2
3The [Audio feature](feature_audio.md) breaks the hardware specifics out into separate, exchangeable driver units, with a common interface to the audio-"core" - which itself handles playing songs and notes while tracking their progress in an internal state, initializing/starting/stopping the driver as needed.
4
5Not all MCUs support every available driver, either the platform-support is not there (yet?) or the MCU simply does not have the required hardware peripheral.
6
7
8## AVR :id=avr
9
10Boards built around an Atmega32U4 can use two sets of PWM capable pins, each driving a separate speaker.
11The possible configurations are:
12
13| | Timer3 | Timer1 |
14|--------------|-------------|--------------|
15| one speaker | C4,C5 or C6 | |
16| one speaker | | B4, B5 or B7 |
17| two speakers | C4,C5 or C6 | B4, B5 or B7 |
18
19Currently there is only one/default driver for AVR based boards, which is automatically configured to:
20
21```make
22AUDIO_DRIVER = pwm_hardware
23```
24
25
26## ARM :id=arm
27
28For Arm based boards, QMK depends on ChibiOS - hence any MCU supported by the later is likely usable, as long as certain hardware peripherals are available.
29
30Supported wiring configurations, with their ChibiOS/MCU peripheral requirement are listed below;
31piezo speakers are marked with :one: for the first/primary and :two: for the secondary.
32
33 | driver | GPTD6<br>Tim6 | GPTD7<br>Tim7 | GPTD8<br>Tim8 | PWMD1<sup>1</sup><br>Tim1_Ch1 |
34 |--------------|------------------------------------------|------------------------|---------------|-------------------------------|
35 | dac_basic | A4+DACD1 = :one: | A5+DACD2 = :one: | state | |
36 | | A4+DACD1 = :one: + Gnd | A5+DACD2 = :two: + Gnd | state | |
37 | | A4+DACD1 = :two: + Gnd | A5+DACD2 = :one: + Gnd | state | |
38 | | A4+DACD1 = :one: + Gnd | | state | |
39 | | | A5+DACD2 = :one: + Gnd | state | |
40 | dac_additive | A4+DACD1 = :one: + Gnd | | | |
41 | | A5+DACD2 = :one: + Gnd | | | |
42 | | A4+DACD1 + A5+DACD2 = :one: <sup>2</sup> | | | |
43 | pwm_software | state-update | | | any = :one: |
44 | pwm hardware | state-update | | | A8 = :one: <sup>3</sup> |
45
46
47<sup>1</sup>: the routing and alternate functions for PWM differ sometimes between STM32 MCUs, if in doubt consult the data-sheet
48<sup>2</sup>: one piezo connected to A4 and A5, with AUDIO_PIN_ALT_AS_NEGATIVE set
49<sup>3</sup>: TIM1_CH1 = A8 on STM32F103C8, other combinations are possible, see Data-sheet. configured with: AUDIO_PWM_DRIVER and AUDIO_PWM_CHANNEL
50
51
52
53### DAC basic :id=dac-basic
54
55The default driver for ARM boards, in absence of an overriding configuration.
56This driver needs one Timer per enabled/used DAC channel, to trigger conversion; and a third timer to trigger state updates with the audio-core.
57
58Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timers 6, 7 and 8:
59
60``` c
61//halconf.h:
62#define HAL_USE_DAC TRUE
63#define HAL_USE_GPT TRUE
64#include_next <halconf.h>
65```
66
67``` c
68// mcuconf.h:
69#include_next <mcuconf.h>
70#undef STM32_DAC_USE_DAC1_CH1
71#define STM32_DAC_USE_DAC1_CH1 TRUE
72#undef STM32_DAC_USE_DAC1_CH2
73#define STM32_DAC_USE_DAC1_CH2 TRUE
74#undef STM32_GPT_USE_TIM6
75#define STM32_GPT_USE_TIM6 TRUE
76#undef STM32_GPT_USE_TIM7
77#define STM32_GPT_USE_TIM7 TRUE
78#undef STM32_GPT_USE_TIM8
79#define STM32_GPT_USE_TIM8 TRUE
80```
81
82?> Note: DAC1 (A4) uses TIM6, DAC2 (A5) uses TIM7, and the audio state timer uses TIM8 (configurable).
83
84You can also change the timer used for the overall audio state by defining the driver. For instance:
85
86```c
87#define AUDIO_STATE_TIMER GPTD9
88```
89
90### DAC additive :id=dac-additive
91
92only needs one timer (GPTD6, Tim6) to trigger the DAC unit to do a conversion; the audio state updates are in turn triggered during the DAC callback.
93
94Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timer 6:
95
96``` c
97//halconf.h:
98#define HAL_USE_DAC TRUE
99#define HAL_USE_GPT TRUE
100#include_next <halconf.h>
101```
102
103``` c
104// mcuconf.h:
105#include_next <mcuconf.h>
106#undef STM32_DAC_USE_DAC1_CH1
107#define STM32_DAC_USE_DAC1_CH1 TRUE
108#undef STM32_DAC_USE_DAC1_CH2
109#define STM32_DAC_USE_DAC1_CH2 TRUE
110#undef STM32_GPT_USE_TIM6
111#define STM32_GPT_USE_TIM6 TRUE
112```
113
114### DAC Config
115
116| Define | Defaults | Description --------------------------------------------------------------------------------------------- |
117| `AUDIO_DAC_SAMPLE_MAX` | `4095U` | Highest value allowed. Lower value means lower volume. And 4095U is the upper limit, since this is limited to a 12 bit value. Only effects non-pregenerated samples. |
118| `AUDIO_DAC_OFF_VALUE` | `AUDIO_DAC_SAMPLE_MAX / 2` | The value of the DAC when notplaying anything. Some setups may require a high (`AUDIO_DAC_SAMPLE_MAX`) or low (`0`) value here. |
119| `AUDIO_MAX_SIMULTANEOUS_TONES` | __see next table__ | The number of tones that can be played simultaneously. A value that is too high may freeze the controller or glitch out when too many tones are being played. |
120| `AUDIO_DAC_SAMPLE_RATE` | __see next table__ | Effective bit rate of the DAC (in hertz), higher limits simultaneous tones, and lower sacrifices quality. |
121
122There are a number of predefined quality settings that you can use, with "sane minimum" being the default. You can use custom values by simply defining the sample rate and number of simultaneous tones, instead of using one of the listed presets.
123
124| Define | Sample Rate | Simultaneous tones |
125| `AUDIO_DAC_QUALITY_VERY_LOW` | `11025U` | `8` |
126| `AUDIO_DAC_QUALITY_LOW` | `22040U` | `4` |
127| `AUDIO_DAC_QUALITY_HIGH` | `44100U` | `2` |
128| `AUDIO_DAC_QUALITY_VERY_HIGH` | `88200U` | `1` |
129| `AUDIO_DAC_QUALITY_SANE_MINIMUM` | `16384U` | `8` |
130
131
132```c
133 /* zero crossing (or approach, whereas zero == DAC_OFF_VALUE, which can be configured to anything from 0 to DAC_SAMPLE_MAX)
134 * ============================*=*========================== AUDIO_DAC_SAMPLE_MAX
135 * * *
136 * * *
137 * ---------------------------------------------------------
138 * * * } AUDIO_DAC_SAMPLE_MAX/100
139 * --------------------------------------------------------- AUDIO_DAC_OFF_VALUE
140 * * * } AUDIO_DAC_SAMPLE_MAX/100
141 * ---------------------------------------------------------
142 * *
143 * * *
144 * * *
145 * =====*=*================================================= 0x0
146 */
147```
148
149
150### PWM hardware :id=pwm-hardware
151
152This driver uses the ChibiOS-PWM system to produce a square-wave on specific output pins that are connected to the PWM hardware.
153The hardware directly toggles the pin via its alternate function. See your MCU's data-sheet for which pin can be driven by what timer - looking for TIMx_CHy and the corresponding alternate function.
154
155A configuration example for the STM32F103C8 would be:
156``` c
157//halconf.h:
158#define HAL_USE_PWM TRUE
159#define HAL_USE_PAL TRUE
160#define HAL_USE_GPT TRUE
161#include_next <halconf.h>
162```
163
164``` c
165// mcuconf.h:
166#include_next <mcuconf.h>
167#undef STM32_PWM_USE_TIM1
168#define STM32_PWM_USE_TIM1 TRUE
169#undef STM32_GPT_USE_TIM4
170#define STM32_GPT_USE_TIM4 TRUE
171```
172
173If we now target pin A8, looking through the data-sheet of the STM32F103C8, for the timers and alternate functions
174- TIM1_CH1 = PA8 <- alternate0
175- TIM1_CH2 = PA9
176- TIM1_CH3 = PA10
177- TIM1_CH4 = PA11
178
179with all this information, the configuration would contain these lines:
180``` c
181//config.h:
182#define AUDIO_PIN A8
183#define AUDIO_PWM_DRIVER PWMD1
184#define AUDIO_PWM_CHANNEL 1
185#define AUDIO_STATE_TIMER GPTD4
186```
187
188ChibiOS uses GPIOv1 for the F103, which only knows of one alternate function.
189On 'larger' STM32s, GPIOv2 or GPIOv3 are used; with them it is also necessary to configure `AUDIO_PWM_PAL_MODE` to the correct alternate function for the selected pin, timer and timer-channel.
190
191
192### PWM software :id=pwm-software
193
194This driver uses the PWM callbacks from PWMD1 with TIM1_CH1 to toggle the selected AUDIO_PIN in software.
195During the same callback, with AUDIO_PIN_ALT_AS_NEGATIVE set, the AUDIO_PIN_ALT is toggled inversely to AUDIO_PIN. This is useful for setups that drive a piezo from two pins (instead of one and Gnd).
196
197You can also change the timer used for software PWM by defining the driver. For instance:
198
199```c
200#define AUDIO_STATE_TIMER GPTD8
201```
202
203
204### Testing Notes :id=testing-notes
205
206While not an exhaustive list, the following table provides the scenarios that have been partially validated:
207
208| | DAC basic | DAC additive | PWM hardware | PWM software |
209|--------------------------|--------------------|--------------------|--------------------|--------------------|
210| Atmega32U4 | :o: | :o: | :heavy_check_mark: | :o: |
211| STM32F103C8 (bluepill) | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: |
212| STM32F303CCT6 (proton-c) | :heavy_check_mark: | :heavy_check_mark: | ? | :heavy_check_mark: |
213| STM32F405VG | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
214| L0xx | :x: (no Tim8) | ? | ? | ? |
215
216
217:heavy_check_mark: : works and was tested
218:o: : does not apply
219:x: : not supported by MCU
220
221*Other supported ChibiOS boards and/or pins may function, it will be highly chip and configuration dependent.*
diff --git a/docs/compatible_microcontrollers.md b/docs/compatible_microcontrollers.md
index 1bf707224..47a4844e7 100644
--- a/docs/compatible_microcontrollers.md
+++ b/docs/compatible_microcontrollers.md
@@ -9,6 +9,7 @@ The following use [LUFA](https://www.fourwalledcubicle.com/LUFA.php) as the USB
9* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2) 9* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2)
10* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4) 10* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
11* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286) 11* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286)
12* [AT90USB162](https://www.microchip.com/wwwproducts/en/AT90USB162)
12 13
13Certain MCUs which do not have native USB will use [V-USB](https://www.obdev.at/products/vusb/index.html) instead: 14Certain MCUs which do not have native USB will use [V-USB](https://www.obdev.at/products/vusb/index.html) instead:
14 15
@@ -25,6 +26,10 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
25 * [STM32F0x2](https://www.st.com/en/microcontrollers-microprocessors/stm32f0x2.html) 26 * [STM32F0x2](https://www.st.com/en/microcontrollers-microprocessors/stm32f0x2.html)
26 * [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html) 27 * [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)
27 * [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html) 28 * [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html)
29 * [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)
30 * [STM32F411](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html)
31 * [STM32G431](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x1.html)
32 * [STM32G474](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x4.html)
28 33
29### NXP (Kinetis) 34### NXP (Kinetis)
30 35
diff --git a/docs/config_options.md b/docs/config_options.md
index a3262b418..aeaaf47aa 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -67,16 +67,22 @@ This is a C header file that is one of the first things included, and will persi
67 * turns on the alternate audio voices (to cycle through) 67 * turns on the alternate audio voices (to cycle through)
68* `#define C4_AUDIO` 68* `#define C4_AUDIO`
69 * enables audio on pin C4 69 * enables audio on pin C4
70 * Deprecated. Use `#define AUDIO_PIN C4`
70* `#define C5_AUDIO` 71* `#define C5_AUDIO`
71 * enables audio on pin C5 72 * enables audio on pin C5
73 * Deprecated. Use `#define AUDIO_PIN C5`
72* `#define C6_AUDIO` 74* `#define C6_AUDIO`
73 * enables audio on pin C6 75 * enables audio on pin C6
76 * Deprecated. Use `#define AUDIO_PIN C6`
74* `#define B5_AUDIO` 77* `#define B5_AUDIO`
75 * enables audio on pin B5 (duophony is enables if one of B[5-7]\_AUDIO is enabled along with one of C[4-6]\_AUDIO) 78 * enables audio on pin B5 (duophony is enabled if one of B pins is enabled along with one of C pins)
79 * Deprecated. Use `#define AUDIO_PIN B5`, or use `#define AUDIO_PIN_ALT B5` if a `C` pin is enabled with `AUDIO_PIN`
76* `#define B6_AUDIO` 80* `#define B6_AUDIO`
77 * enables audio on pin B6 (duophony is enables if one of B[5-7]\_AUDIO is enabled along with one of C[4-6]\_AUDIO) 81 * enables audio on pin B5 (duophony is enabled if one of B pins is enabled along with one of C pins)
82 * Deprecated. Use `#define AUDIO_PIN B6`, or use `#define AUDIO_PIN_ALT B6` if a `C` pin is enabled with `AUDIO_PIN`
78* `#define B7_AUDIO` 83* `#define B7_AUDIO`
79 * enables audio on pin B7 (duophony is enables if one of B[5-7]\_AUDIO is enabled along with one of C[4-6]\_AUDIO) 84 * enables audio on pin B5 (duophony is enabled if one of B pins is enabled along with one of C pins)
85 * Deprecated. Use `#define AUDIO_PIN B7`, or use `#define AUDIO_PIN_ALT B7` if a `C` pin is enabled with `AUDIO_PIN`
80* `#define BACKLIGHT_PIN B7` 86* `#define BACKLIGHT_PIN B7`
81 * pin of the backlight 87 * pin of the backlight
82* `#define BACKLIGHT_LEVELS 3` 88* `#define BACKLIGHT_LEVELS 3`
@@ -97,6 +103,8 @@ This is a C header file that is one of the first things included, and will persi
97 * sets the maximum power (in mA) over USB for the device (default: 500) 103 * sets the maximum power (in mA) over USB for the device (default: 500)
98* `#define USB_POLLING_INTERVAL_MS 10` 104* `#define USB_POLLING_INTERVAL_MS 10`
99 * sets the USB polling rate in milliseconds for the keyboard, mouse, and shared (NKRO/media keys) interfaces 105 * sets the USB polling rate in milliseconds for the keyboard, mouse, and shared (NKRO/media keys) interfaces
106* `#define USB_SUSPEND_WAKEUP_DELAY 200`
107 * set the number of milliseconde to pause after sending a wakeup packet
100* `#define F_SCL 100000L` 108* `#define F_SCL 100000L`
101 * sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`. 109 * sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`.
102 110
diff --git a/docs/data_driven_config.md b/docs/data_driven_config.md
new file mode 100644
index 000000000..c2ad4fed8
--- /dev/null
+++ b/docs/data_driven_config.md
@@ -0,0 +1,91 @@
1# Data Driven Configuration
2
3This page describes how QMK's data driven JSON configuration system works. It is aimed at developers who want to work on QMK itself.
4
5## History
6
7Historically QMK has been configured through a combination of two mechanisms- `rules.mk` and `config.h`. While this worked well when QMK was only a handful of keyboards we've grown to encompass nearly 1500 supported keyboards. That extrapolates out to 6000 configuration files under `keyboards/` alone! The freeform nature of these files and the unique patterns people have used to avoid duplication have made ongoing maintenance a challenge, and a large number of our keyboards follow patterns that are outdated and sometimes harder to understand.
8
9We have also been working on bringing the power of QMK to people who aren't comformable with a CLI, and other projects such as VIA are working to make using QMK as easy as installing a program. These tools need information about how a keyboard is laid out or what pins and features are available so that users can take full advantage of QMK. We introduced `info.json` as a first step towards this. The QMK API is an effort to combine these 3 sources of information- `config.h`, `rules.mk`, and `info.json`- into a single source of truth that end-user tools can use.
10
11Now we have support for generating `rules.mk` and `config.h` values from `info.json`, allowing us to have a single source of truth. This will allow us to use automated tooling to maintain keyboards saving a lot of time and maintenance work.
12
13## Overview
14
15On the C side of things nothing changes. When you need to create a new rule or define you follow the same process:
16
171. Add it to `docs/config_options.md`
181. Set a default in the appropriate core file
191. Add your ifdef statements as needed
20
21You will then need to add support for your new configuration to `info.json`. The basic process is:
22
231. Add it to the schema in `data/schemas/keyboards.jsonschema`
241. Add a mapping in `data/maps`
251. (optional and discoraged) Add code to extract/generate it to:
26 * `lib/python/qmk/info.py`
27 * `lib/python/qmk/cli/generate/config_h.py`
28 * `lib/python/qmk/cli/generate/rules_mk.py`
29
30## Adding an option to info.json
31
32This section describes adding support for a `config.h`/`rules.mk` value to info.json.
33
34### Add it to the schema
35
36QMK maintains [jsonschema](https://json-schema.org/) files in `data/schemas`. The values that go into keyboard-specific `info.json` files are kept in `keyboard.jsonschema`. Any value you want to make available to end users to edit must go in here.
37
38In some cases you can simply add a new top-level key. Some examples to follow are `keyboard_name`, `maintainer`, `processor`, and `url`. This is appropriate when your option is self-contained and not directly related to other options.
39
40In other cases you should group like options together in an `object`. This is particularly true when adding support for a feature. Some examples to follow for this are `indicators`, `matrix_pins`, and `rgblight`. If you are not sure how to integrate your new option(s) [open an issue](https://github.com/qmk/qmk_firmware/issues/new?assignees=&labels=cli%2C+python&template=other_issues.md&title=) or [join #cli on Discord](https://discord.gg/heQPAgy) and start a conversation there.
41
42### Add a mapping
43
44In most cases you can add a simple mapping. These are maintained as JSON files in `data/mappings/info_config.json` and `data/mappings/info_rules.json`, and control mapping for `config.h` and `rules.mk`, respectively. Each mapping is keyed by the `config.h` or `rules.mk` variable, and the value is a hash with the following keys:
45
46* `info_key`: (required) The location within `info.json` for this value. See below.
47* `value_type`: (optional) Default `str`. The format for this variable's value. See below.
48* `to_json`: (optional) Default `true`. Set to `false` to exclude this mapping from info.json
49* `to_c`: (optional) Default `true`. Set to `false` to exclude this mapping from config.h
50* `warn_duplicate`: (optional) Default `true`. Set to `false` to turn off warning when a value exists in both places
51
52#### Info Key
53
54We use JSON dot notation to address variables within info.json. For example, to access `info_json["rgblight"]["split_count"]` I would specify `rgblight.split_count`. This allows you to address deeply nested keys with a simple string.
55
56Under the hood we use [Dotty Dict](https://dotty-dict.readthedocs.io/en/latest/), you can refer to that documentation for how these strings are converted to object access.
57
58#### Value Types
59
60By default we treat all values as simple strings. If your value is more complex you can use one of these types to intelligently parse the data:
61
62* `array`: A comma separated array of strings
63* `array.int`: A comma separated array of integers
64* `int`: An integer
65* `hex`: A number formatted as hex
66* `list`: A space separate array of strings
67* `mapping`: A hash of key/value pairs
68
69### Add code to extract it
70
71Most use cases can be solved by the mapping files described above. If yours can't you can instead write code to extract your config values.
72
73Whenever QMK generates a complete `info.json` it extracts information from `config.h` and `rules.mk`. You will need to add code for your new config value to `lib/python/qmk/info.py`. Typically this means adding a new `_extract_<feature>()` function and then calling your function in either `_extract_config_h()` or `_extract_rules_mk()`.
74
75If you are not sure how to edit this file or are not comfortable with Python [open an issue](https://github.com/qmk/qmk_firmware/issues/new?assignees=&labels=cli%2C+python&template=other_issues.md&title=) or [join #cli on Discord](https://discord.gg/heQPAgy) and someone can help you with this part.
76
77### Add code to generate it
78
79The final piece of the puzzle is providing your new option to the build system. This is done by generating two files:
80
81* `.build/obj_<keyboard>/src/info_config.h`
82* `.build/obj_<keyboard>/src/rules.mk`
83
84These two files are generated by the code here:
85
86* `lib/python/qmk/cli/generate/config_h.py`
87* `lib/python/qmk/cli/generate/rules_mk.py`
88
89For `config.h` values you'll need to write a function for your rule(s) and call that function in `generate_config_h()`.
90
91If you have a new top-level `info.json` key for `rules.mk` you can simply add your keys to `info_to_rules` at the top of `lib/python/qmk/cli/generate/rules_mk.py`. Otherwise you'll need to create a new if block for your feature in `generate_rules_mk()`.
diff --git a/docs/feature_audio.md b/docs/feature_audio.md
index 5132dfe97..9e7ba75f5 100644
--- a/docs/feature_audio.md
+++ b/docs/feature_audio.md
@@ -1,21 +1,117 @@
1# Audio 1# Audio
2 2
3Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to certain PWM-capable pins, you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes. 3Your keyboard can make sounds! If you've got a spare pin you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
4 4
5Up to two simultaneous audio voices are supported, one driven by timer 1 and another driven by timer 3. The following pins can be defined as audio outputs in config.h: 5To activate this feature, add `AUDIO_ENABLE = yes` to your `rules.mk`.
6 6
7Timer 1: 7## AVR based boards
8`#define B5_AUDIO` 8On Atmega32U4 based boards, up to two simultaneous tones can be rendered.
9`#define B6_AUDIO` 9With one speaker connected to a PWM capable pin on PORTC driven by timer 3 and the other on one of the PWM pins on PORTB driven by timer 1.
10`#define B7_AUDIO`
11 10
12Timer 3: 11The following pins can be configured as audio outputs in `config.h` - for one speaker set eiter one out of:
13`#define C4_AUDIO`
14`#define C5_AUDIO`
15`#define C6_AUDIO`
16 12
17If you add `AUDIO_ENABLE = yes` to your `rules.mk`, there's a couple different sounds that will automatically be enabled without any other configuration: 13* `#define AUDIO_PIN C4`
14* `#define AUDIO_PIN C5`
15* `#define AUDIO_PIN C6`
16* `#define AUDIO_PIN B5`
17* `#define AUDIO_PIN B6`
18* `#define AUDIO_PIN B7`
18 19
20and *optionally*, for a second speaker, one of:
21* `#define AUDIO_PIN_ALT B5`
22* `#define AUDIO_PIN_ALT B6`
23* `#define AUDIO_PIN_ALT B7`
24
25### Wiring
26per speaker is - for example with a piezo buzzer - the black lead to Ground, and the red lead connected to the selected AUDIO_PIN for the primary; and similarly with AUDIO_PIN_ALT for the secondary.
27
28
29## ARM based boards
30for more technical details, see the notes on [Audio driver](audio_driver.md).
31
32<!-- because I'm not sure where to fit this in: https://waveeditonline.com/ -->
33### DAC (basic)
34Most STM32 MCUs have DAC peripherals, with a notable exception of the STM32F1xx series. Generally, the DAC peripheral drives pins A4 or A5. To enable DAC-based audio output on STM32 devices, add `AUDIO_DRIVER = dac_basic` to `rules.mk` and set in `config.h` either:
35
36`#define AUDIO_PIN A4` or `#define AUDIO_PIN A5`
37
38the other DAC channel can optionally be used with a secondary speaker, just set:
39
40`#define AUDIO_PIN_ALT A4` or `#define AUDIO_PIN_ALT A5`
41
42Do note though that the dac_basic driver is only capable of reproducing one tone per speaker/channel at a time, for more tones simultaneously, try the dac_additive driver.
43
44#### Wiring:
45for two piezos, for example configured as `AUDIO_PIN A4` and `AUDIO_PIN_ALT A5` would be: red lead to A4 and black to Ground, and similarly with the second one: A5 = red, and Ground = black
46
47another alternative is to drive *one* piezo with both DAC pins - for an extra "push".
48wiring red to A4 and black to A5 (or the other way round) and add `#define AUDIO_PIN_ALT_AS_NEGATIVE` to `config.h`
49
50##### Proton-C Example:
51The Proton-C comes (optionally) with one 'builtin' piezo, which is wired to A4+A5.
52For this board `config.h` would include these defines:
53
54```c
55#define AUDIO_PIN A5
56#define AUDIO_PIN_ALT A4
57#define AUDIO_PIN_ALT_AS_NEGATIVE
58```
59
60### DAC (additive)
61Another option, besides dac_basic (which produces sound through a square-wave), is to use the DAC to do additive wave synthesis.
62With a number of predefined wave-forms or by providing your own implementation to generate samples on the fly.
63To use this feature set `AUDIO_DRIVER = dac_additive` in your `rules.mk`, and select in `config.h` EITHER `#define AUDIO_PIN A4` or `#define AUDIO_PIN A5`.
64
65The used waveform *defaults* to sine, but others can be selected by adding one of the following defines to `config.h`:
66
67* `#define AUDIO_DAC_SAMPLE_WAVEFORM_SINE`
68* `#define AUDIO_DAC_SAMPLE_WAVEFORM_TRIANGLE`
69* `#define AUDIO_DAC_SAMPLE_WAVEFORM_TRAPEZOID`
70* `#define AUDIO_DAC_SAMPLE_WAVEFORM_SQUARE`
71
72Should you rather choose to generate and use your own sample-table with the DAC unit, implement `uint16_t dac_value_generate(void)` with your keyboard - for an example implementation see keyboards/planck/keymaps/synth_sample or keyboards/planck/keymaps/synth_wavetable
73
74
75### PWM (software)
76if the DAC pins are unavailable (or the MCU has no usable DAC at all, like STM32F1xx); PWM can be an alternative.
77Note that there is currently only one speaker/pin supported.
78
79set in `rules.mk`:
80
81`AUDIO_DRIVER = pwm_software` and in `config.h`:
82`#define AUDIO_PIN C13` (can be any pin) to have the selected pin output a pwm signal, generated from a timer callback which toggles the pin in software.
83
84#### Wiring
85the usual piezo wiring: red goes to the selected AUDIO_PIN, black goes to ground.
86
87OR if you can chose to drive one piezo with two pins, for example `#define AUDIO_PIN B1`, `#define AUDIO_PIN_ALT B2` in `config.h`, with `#define AUDIO_PIN_ALT_AS_NEGATIVE` - then the red lead could go to B1, the black to B2.
88
89### PWM (hardware)
90STM32F1xx have to fall back to using PWM, but can do so in hardware; but again on currently only one speaker/pin.
91
92`AUDIO_DRIVER = pwm_hardware` in `rules.mk`, and in `config.h`:
93`#define AUDIO_PIN A8`
94`#define AUDIO_PWM_DRIVER PWMD1`
95`#define AUDIO_PWM_CHANNEL 1`
96(as well as `#define AUDIO_PWM_PAL_MODE 42` if you are on STM32F2 or larger)
97which will use Timer 1 to directly drive pin PA8 through the PWM hardware (TIM1_CH1 = PA8).
98Should you want to use the pwm-hardware on another pin and timer - be ready to dig into the STM32 data-sheet to pick the right TIMx_CHy and pin-alternate function.
99
100
101## Tone Multiplexing
102Since most drivers can only render one tone per speaker at a time (with the one exception: arm dac-additive) there also exists a "workaround-feature" that does time-slicing/multiplexing - which does what the name implies: cycle through a set of active tones (e.g. when playing chords in Music Mode) at a given rate, and put one tone at a time out through the one/few speakers that are available.
103
104To enable this feature, and configure a starting-rate, add the following defines to `config.h`:
105```c
106#define AUDIO_ENABLE_TONE_MULTIPLEXING
107#define AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT 10
108```
109
110The audio core offers interface functions to get/set/change the tone multiplexing rate from within `keymap.c`.
111
112
113## Songs
114There's a couple of different sounds that will automatically be enabled without any other configuration:
19``` 115```
20STARTUP_SONG // plays when the keyboard starts up (audio.c) 116STARTUP_SONG // plays when the keyboard starts up (audio.c)
21GOODBYE_SONG // plays when you press the RESET key (quantum.c) 117GOODBYE_SONG // plays when you press the RESET key (quantum.c)
@@ -67,15 +163,34 @@ The available keycodes for audio are:
67* `AU_OFF` - Turn Audio Feature off 163* `AU_OFF` - Turn Audio Feature off
68* `AU_TOG` - Toggle Audio Feature state 164* `AU_TOG` - Toggle Audio Feature state
69 165
70!> These keycodes turn all of the audio functionality on and off. Turning it off means that audio feedback, audio clicky, music mode, etc. are disabled, completely. 166!> These keycodes turn all of the audio functionality on and off. Turning it off means that audio feedback, audio clicky, music mode, etc. are disabled, completely.
167
168## Tempo
169the 'speed' at which SONGs are played is dictated by the set Tempo, which is measured in beats-per-minute. Note lenghts are defined relative to that.
170The initial/default tempo is set to 120 bpm, but can be configured by setting `TEMPO_DEFAULT` in `config.c`.
171There is also a set of functions to modify the tempo from within the user/keymap code:
172```c
173void audio_set_tempo(uint8_t tempo);
174void audio_increase_tempo(uint8_t tempo_change);
175void audio_decrease_tempo(uint8_t tempo_change);
176```
71 177
72## ARM Audio Volume 178## ARM Audio Volume
73 179
74For ARM devices, you can adjust the DAC sample values. If your board is too loud for you or your coworkers, you can set the max using `DAC_SAMPLE_MAX` in your `config.h`: 180For ARM devices, you can adjust the DAC sample values. If your board is too loud for you or your coworkers, you can set the max using `AUDIO_DAC_SAMPLE_MAX` in your `config.h`:
75 181
76```c 182```c
77#define DAC_SAMPLE_MAX 65535U 183#define AUDIO_DAC_SAMPLE_MAX 4095U
78``` 184```
185the DAC usually runs in 12Bit mode, hence a volume of 100% = 4095U
186
187Note: this only adjusts the volume aka 'works' if you stick to WAVEFORM_SQUARE, since its samples are generated on the fly - any other waveform uses a hardcoded/precomputed sample-buffer.
188
189## Voices
190Aka "audio effects", different ones can be enabled by setting in `config.h` these defines:
191`#define AUDIO_VOICES` to enable the feature, and `#define AUDIO_VOICE_DEFAULT something` to select a specific effect
192for details see quantum/audio/voices.h and .c
193
79 194
80## Music Mode 195## Music Mode
81 196
@@ -215,12 +330,6 @@ This is still a WIP, but check out `quantum/process_keycode/process_midi.c` to s
215 AU_OFF, 330 AU_OFF,
216 AU_TOG, 331 AU_TOG,
217 332
218 #ifdef FAUXCLICKY_ENABLE
219 FC_ON,
220 FC_OFF,
221 FC_TOG,
222 #endif
223
224 // Music mode on/off/toggle 333 // Music mode on/off/toggle
225 MU_ON, 334 MU_ON,
226 MU_OFF, 335 MU_OFF,
diff --git a/docs/feature_backlight.md b/docs/feature_backlight.md
index a558af64e..2adb16e4a 100644
--- a/docs/feature_backlight.md
+++ b/docs/feature_backlight.md
@@ -93,18 +93,18 @@ BACKLIGHT_DRIVER = pwm
93 93
94On AVR boards, QMK automatically decides which driver to use according to the following table: 94On AVR boards, QMK automatically decides which driver to use according to the following table:
95 95
96|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328/P| 96|Backlight Pin|AT90USB64/128|AT90USB162|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328/P|
97|-------------|-------------|-------------|-------------|---------|-----------| 97|-------------|-------------|----------|-------------|-------------|---------|-----------|
98|`B1` | | | | |Timer 1 | 98|`B1` | | | | | |Timer 1 |
99|`B2` | | | | |Timer 1 | 99|`B2` | | | | | |Timer 1 |
100|`B5` |Timer 1 |Timer 1 | | | | 100|`B5` |Timer 1 | |Timer 1 | | | |
101|`B6` |Timer 1 |Timer 1 | | | | 101|`B6` |Timer 1 | |Timer 1 | | | |
102|`B7` |Timer 1 |Timer 1 |Timer 1 | | | 102|`B7` |Timer 1 |Timer 1 |Timer 1 |Timer 1 | | |
103|`C4` |Timer 3 | | | | | 103|`C4` |Timer 3 | | | | | |
104|`C5` |Timer 3 | |Timer 1 | | | 104|`C5` |Timer 3 |Timer 1 | |Timer 1 | | |
105|`C6` |Timer 3 |Timer 3 |Timer 1 | | | 105|`C6` |Timer 3 |Timer 1 |Timer 3 |Timer 1 | | |
106|`D4` | | | |Timer 1 | | 106|`D4` | | | | |Timer 1 | |
107|`D5` | | | |Timer 1 | | 107|`D5` | | | | |Timer 1 | |
108 108
109All other pins will use timer-assisted software PWM: 109All other pins will use timer-assisted software PWM:
110 110
diff --git a/docs/feature_macros.md b/docs/feature_macros.md
index 36fa761d2..aa1ebc337 100644
--- a/docs/feature_macros.md
+++ b/docs/feature_macros.md
@@ -4,7 +4,7 @@ Macros allow you to send multiple keystrokes when pressing just one key. QMK has
4 4
5!> **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor. 5!> **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets a hold of your keyboard will be able to access that information by opening a text editor.
6 6
7## The New Way: `SEND_STRING()` & `process_record_user` 7## `SEND_STRING()` & `process_record_user`
8 8
9Sometimes you want a key to type out words or phrases. For the most common situations, we've provided `SEND_STRING()`, which will type out a string (i.e. a sequence of characters) for you. All ASCII characters that are easily translatable to a keycode are supported (e.g. `qmk 123\n\t`). 9Sometimes you want a key to type out words or phrases. For the most common situations, we've provided `SEND_STRING()`, which will type out a string (i.e. a sequence of characters) for you. All ASCII characters that are easily translatable to a keycode are supported (e.g. `qmk 123\n\t`).
10 10
@@ -262,15 +262,15 @@ This will clear all keys besides the mods currently pressed.
262This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows. 262This macro will register `KC_LALT` and tap `KC_TAB`, then wait for 1000ms. If the key is tapped again, it will send another `KC_TAB`; if there is no tap, `KC_LALT` will be unregistered, thus allowing you to cycle through windows.
263 263
264```c 264```c
265bool is_alt_tab_active = false; # ADD this near the begining of keymap.c 265bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
266uint16_t alt_tab_timer = 0; # we will be using them soon. 266uint16_t alt_tab_timer = 0; // we will be using them soon.
267 267
268enum custom_keycodes { # Make sure have the awesome keycode ready 268enum custom_keycodes { // Make sure have the awesome keycode ready
269 ALT_TAB = SAFE_RANGE, 269 ALT_TAB = SAFE_RANGE,
270}; 270};
271 271
272bool process_record_user(uint16_t keycode, keyrecord_t *record) { 272bool process_record_user(uint16_t keycode, keyrecord_t *record) {
273 switch (keycode) { # This will do most of the grunt work with the keycodes. 273 switch (keycode) { // This will do most of the grunt work with the keycodes.
274 case ALT_TAB: 274 case ALT_TAB:
275 if (record->event.pressed) { 275 if (record->event.pressed) {
276 if (!is_alt_tab_active) { 276 if (!is_alt_tab_active) {
@@ -287,7 +287,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
287 return true; 287 return true;
288} 288}
289 289
290void matrix_scan_user(void) { # The very important timer. 290void matrix_scan_user(void) { // The very important timer.
291 if (is_alt_tab_active) { 291 if (is_alt_tab_active) {
292 if (timer_elapsed(alt_tab_timer) > 1000) { 292 if (timer_elapsed(alt_tab_timer) > 1000) {
293 unregister_code(KC_LALT); 293 unregister_code(KC_LALT);
@@ -296,104 +296,3 @@ void matrix_scan_user(void) { # The very important timer.
296 } 296 }
297} 297}
298``` 298```
299
300---
301
302## **(DEPRECATED)** The Old Way: `MACRO()` & `action_get_macro`
303
304!> This is inherited from TMK, and hasn't been updated - it's recommended that you use `SEND_STRING` and `process_record_user` instead.
305
306By default QMK assumes you don't have any macros. To define your macros you create an `action_get_macro()` function. For example:
307
308```c
309const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
310 if (record->event.pressed) {
311 switch(id) {
312 case 0:
313 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
314 case 1:
315 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
316 }
317 }
318 return MACRO_NONE;
319};
320```
321
322This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement:
323
324 if (!record->event.pressed) {
325
326### Macro Commands
327
328A macro can include the following commands:
329
330* I() change interval of stroke in milliseconds.
331* D() press key.
332* U() release key.
333* T() type key(press and release).
334* W() wait (milliseconds).
335* END end mark.
336
337### Mapping a Macro to a Key
338
339Use the `M()` function within your keymap to call a macro. For example, here is the keymap for a 2-key keyboard:
340
341```c
342const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
343 [0] = LAYOUT(
344 M(0), M(1)
345 ),
346};
347
348const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
349 if (record->event.pressed) {
350 switch(id) {
351 case 0:
352 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
353 case 1:
354 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
355 }
356 }
357 return MACRO_NONE;
358};
359```
360
361When you press the key on the left it will type "Hi!" and when you press the key on the right it will type "Bye!".
362
363### Naming Your Macros
364
365If you have a bunch of macros you want to refer to from your keymap while keeping the keymap easily readable you can name them using `#define` at the top of your file.
366
367```c
368#define M_HI M(0)
369#define M_BYE M(1)
370
371const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
372 [0] = LAYOUT(
373 M_HI, M_BYE
374 ),
375};
376```
377
378
379## Advanced Example:
380
381### Single-Key Copy/Paste
382
383This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released.
384
385```c
386const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
387 switch(id) {
388 case 0: {
389 if (record->event.pressed) {
390 return MACRO( D(LCTL), T(C), U(LCTL), END );
391 } else {
392 return MACRO( D(LCTL), T(V), U(LCTL), END );
393 }
394 break;
395 }
396 }
397 return MACRO_NONE;
398};
399```
diff --git a/docs/feature_mouse_keys.md b/docs/feature_mouse_keys.md
index ffde13389..8e2a3a4cd 100644
--- a/docs/feature_mouse_keys.md
+++ b/docs/feature_mouse_keys.md
@@ -29,6 +29,9 @@ In your keymap you can use the following keycodes to map key presses to mouse ac
29|`KC_MS_BTN3` |`KC_BTN3`|Press button 3 | 29|`KC_MS_BTN3` |`KC_BTN3`|Press button 3 |
30|`KC_MS_BTN4` |`KC_BTN4`|Press button 4 | 30|`KC_MS_BTN4` |`KC_BTN4`|Press button 4 |
31|`KC_MS_BTN5` |`KC_BTN5`|Press button 5 | 31|`KC_MS_BTN5` |`KC_BTN5`|Press button 5 |
32|`KC_MS_BTN6` |`KC_BTN6`|Press button 6 |
33|`KC_MS_BTN7` |`KC_BTN7`|Press button 7 |
34|`KC_MS_BTN8` |`KC_BTN8`|Press button 8 |
32|`KC_MS_WH_UP` |`KC_WH_U`|Move wheel up | 35|`KC_MS_WH_UP` |`KC_WH_U`|Move wheel up |
33|`KC_MS_WH_DOWN` |`KC_WH_D`|Move wheel down | 36|`KC_MS_WH_DOWN` |`KC_WH_D`|Move wheel down |
34|`KC_MS_WH_LEFT` |`KC_WH_L`|Move wheel left | 37|`KC_MS_WH_LEFT` |`KC_WH_L`|Move wheel left |
@@ -42,6 +45,7 @@ In your keymap you can use the following keycodes to map key presses to mouse ac
42Mouse keys supports three different modes to move the cursor: 45Mouse keys supports three different modes to move the cursor:
43 46
44* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed. 47* **Accelerated (default):** Holding movement keys accelerates the cursor until it reaches its maximum speed.
48* **Kinetic:** Holding movement keys accelerates the cursor with its speed following a quadratic curve until it reaches its maximum speed.
45* **Constant:** Holding movement keys moves the cursor at constant speeds. 49* **Constant:** Holding movement keys moves the cursor at constant speeds.
46* **Combined:** Holding movement keys accelerates the cursor until it reaches its maximum speed, but holding acceleration and movement keys simultaneously moves the cursor at constant speeds. 50* **Combined:** Holding movement keys accelerates the cursor until it reaches its maximum speed, but holding acceleration and movement keys simultaneously moves the cursor at constant speeds.
47 51
@@ -56,7 +60,8 @@ This is the default mode. You can adjust the cursor and scrolling acceleration u
56|Define |Default|Description | 60|Define |Default|Description |
57|----------------------------|-------|---------------------------------------------------------| 61|----------------------------|-------|---------------------------------------------------------|
58|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement| 62|`MOUSEKEY_DELAY` |300 |Delay between pressing a movement key and cursor movement|
59|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements | 63|`MOUSEKEY_INTERVAL` |50 |Time between cursor movements in milliseconds |
64|`MOUSEKEY_MOVE_DELTA` |5 |Step size |
60|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops | 65|`MOUSEKEY_MAX_SPEED` |10 |Maximum cursor speed at which acceleration stops |
61|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached | 66|`MOUSEKEY_TIME_TO_MAX` |20 |Time until maximum cursor speed is reached |
62|`MOUSEKEY_WHEEL_DELAY` |300 |Delay between pressing a wheel key and wheel movement | 67|`MOUSEKEY_WHEEL_DELAY` |300 |Delay between pressing a wheel key and wheel movement |
@@ -73,6 +78,30 @@ Tips:
73 78
74Cursor acceleration uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys). 79Cursor acceleration uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys).
75 80
81### Kinetic Mode
82
83This is an extension of the accelerated mode. The kinetic mode uses a quadratic curve on the cursor speed which allows precise movements at the beginning and allows to cover large distances by increasing cursor speed quickly thereafter. You can adjust the cursor and scrolling acceleration using the following settings in your keymap’s `config.h` file:
84
85|Define |Default |Description |
86|--------------------------------------|---------|---------------------------------------------------------------|
87|`MK_KINETIC_SPEED` |undefined|Enable kinetic mode |
88|`MOUSEKEY_DELAY` |8 |Delay between pressing a movement key and cursor movement |
89|`MOUSEKEY_INTERVAL` |8 |Time between cursor movements in milliseconds |
90|`MOUSEKEY_MOVE_DELTA` |25 |Step size for accelerating from initial to base speed |
91|`MOUSEKEY_INITIAL_SPEED` |100 |Initial speed of the cursor in pixel per second |
92|`MOUSEKEY_BASE_SPEED` |1000 |Maximum cursor speed at which acceleration stops |
93|`MOUSEKEY_DECELERATED_SPEED` |400 |Decelerated cursor speed |
94|`MOUSEKEY_ACCELERATED_SPEED` |3000 |Accelerated cursor speed |
95|`MOUSEKEY_WHEEL_INITIAL_MOVEMENTS` |16 |Initial number of movements of the mouse wheel |
96|`MOUSEKEY_WHEEL_BASE_MOVEMENTS` |32 |Maximum number of movements at which acceleration stops |
97|`MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS`|48 |Accelerated wheel movements |
98|`MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS`|8 |Decelerated wheel movements |
99
100Tips:
101
102* The smoothness of the cursor movement depends on the `MOUSEKEY_INTERVAL` setting. The shorter the interval is set the smoother the movement will be. Setting the value too low makes the cursor unresponsive. Lower settings are possible if the micro processor is fast enough. For example: At an interval of `8` milliseconds, `125` movements per second will be initiated. With a base speed of `1000` each movement will move the cursor by `8` pixels.
103* Mouse wheel movements are implemented differently from cursor movements. While it's okay for the cursor to move multiple pixels at once for the mouse wheel this would lead to jerky movements. Instead, the mouse wheel operates at step size `1`. Setting mouse wheel speed is done by adjusting the number of wheel movements per second.
104
76### Constant mode 105### Constant mode
77 106
78In this mode you can define multiple different speeds for both the cursor and the mouse wheel. There is no acceleration. `KC_ACL0`, `KC_ACL1` and `KC_ACL2` change the cursor and scroll speed to their respective setting. 107In this mode you can define multiple different speeds for both the cursor and the mouse wheel. There is no acceleration. `KC_ACL0`, `KC_ACL1` and `KC_ACL2` change the cursor and scroll speed to their respective setting.
diff --git a/docs/feature_pointing_device.md b/docs/feature_pointing_device.md
index 37edac5e6..905c2a8f9 100644
--- a/docs/feature_pointing_device.md
+++ b/docs/feature_pointing_device.md
@@ -19,7 +19,7 @@ Keep in mind that a report_mouse_t (here "mouseReport") has the following proper
19* `mouseReport.y` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing movement (+ upward, - downward) on the y axis. 19* `mouseReport.y` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing movement (+ upward, - downward) on the y axis.
20* `mouseReport.v` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing vertical scrolling (+ upward, - downward). 20* `mouseReport.v` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing vertical scrolling (+ upward, - downward).
21* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left). 21* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left).
22* `mouseReport.buttons` - this is a uint8_t in which the last 5 bits are used. These bits represent the mouse button state - bit 3 is mouse button 5, and bit 7 is mouse button 1. 22* `mouseReport.buttons` - this is a uint8_t in which all 8 bits are used. These bits represent the mouse button state - bit 0 is mouse button 1, and bit 7 is mouse button 8.
23 23
24Once you have made the necessary changes to the mouse report, you need to send it: 24Once you have made the necessary changes to the mouse report, you need to send it:
25 25
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index f5abd327c..fd866bd57 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -129,6 +129,28 @@ Configure the hardware via your `config.h`:
129 129
130--- 130---
131 131
132### APA102 :id=apa102
133
134There is basic support for APA102 based addressable LED strands. To enable it, add this to your `rules.mk`:
135
136```makefile
137RGB_MATRIX_ENABLE = yes
138RGB_MATRIX_DRIVER = APA102
139```
140
141Configure the hardware via your `config.h`:
142
143```c
144// The pin connected to the data pin of the LEDs
145#define RGB_DI_PIN D7
146// The pin connected to the clock pin of the LEDs
147#define RGB_CI_PIN D6
148// The number of LEDs connected
149#define DRIVER_LED_TOTAL 70
150```
151
152---
153
132From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example: 154From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example:
133 155
134```c 156```c
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 755fd769e..b5a2b179d 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -10,6 +10,7 @@ Currently QMK supports the following addressable LEDs (however, the white LED in
10 10
11 * WS2811, WS2812, WS2812B, WS2812C, etc. 11 * WS2811, WS2812, WS2812B, WS2812C, etc.
12 * SK6812, SK6812MINI, SK6805 12 * SK6812, SK6812MINI, SK6805
13 * APA102
13 14
14These LEDs are called "addressable" because instead of using a wire per color, each LED contains a small microchip that understands a special protocol sent over a single wire. The chip passes on the remaining data to the next LED, allowing them to be chained together. In this way, you can easily control the color of the individual LEDs. 15These LEDs are called "addressable" because instead of using a wire per color, each LED contains a small microchip that understands a special protocol sent over a single wire. The chip passes on the remaining data to the next LED, allowing them to be chained together. In this way, you can easily control the color of the individual LEDs.
15 16
@@ -21,11 +22,19 @@ On keyboards with onboard RGB LEDs, it is usually enabled by default. If it is n
21RGBLIGHT_ENABLE = yes 22RGBLIGHT_ENABLE = yes
22``` 23```
23 24
24At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your `config.h`. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won't need to modify these. 25For APA102 LEDs, add the following to your `rules.mk`:
26
27```make
28RGBLIGHT_ENABLE = yes
29RGBLIGHT_DRIVER = APA102
30```
31
32At minimum you must define the data pin your LED strip is connected to, and the number of LEDs in the strip, in your `config.h`. For APA102 LEDs, you must also define the clock pin. If your keyboard has onboard RGB LEDs, and you are simply creating a keymap, you usually won't need to modify these.
25 33
26|Define |Description | 34|Define |Description |
27|---------------|---------------------------------------------------------------------------------------------------------| 35|---------------|---------------------------------------------------------------------------------------------------------|
28|`RGB_DI_PIN` |The pin connected to the data pin of the LEDs | 36|`RGB_DI_PIN` |The pin connected to the data pin of the LEDs |
37|`RGB_CI_PIN` |The pin connected to the clock pin of the LEDs (APA102 only) |
29|`RGBLED_NUM` |The number of LEDs connected | 38|`RGBLED_NUM` |The number of LEDs connected |
30|`RGBLED_SPLIT` |(Optional) For split keyboards, the number of LEDs connected on each half directly wired to `RGB_DI_PIN` | 39|`RGBLED_SPLIT` |(Optional) For split keyboards, the number of LEDs connected on each half directly wired to `RGB_DI_PIN` |
31 40
@@ -139,7 +148,7 @@ The following options are used to tweak the various animations:
139|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by | 148|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by |
140|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls | 149|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls |
141|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation | 150|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation |
142|`RGBLIGHT_EFFECT_TWINKLE_LIFE` |`75` |Adjusts how quickly each LED brightens and dims when twinkling (in animation steps) | 151|`RGBLIGHT_EFFECT_TWINKLE_LIFE` |`200` |Adjusts how quickly each LED brightens and dims when twinkling (in animation steps) |
143|`RGBLIGHT_EFFECT_TWINKLE_PROBABILITY`|`1/127` |Adjusts how likely each LED is to twinkle (on each animation step) | 152|`RGBLIGHT_EFFECT_TWINKLE_PROBABILITY`|`1/127` |Adjusts how likely each LED is to twinkle (on each animation step) |
144 153
145### Example Usage to Reduce Memory Footprint 154### Example Usage to Reduce Memory Footprint
diff --git a/docs/feature_split_keyboard.md b/docs/feature_split_keyboard.md
index b23411420..c285e353d 100644
--- a/docs/feature_split_keyboard.md
+++ b/docs/feature_split_keyboard.md
@@ -181,6 +181,16 @@ If you're having issues with serial communication, you can change this value, as
181* **`4`**: about 26kbps 181* **`4`**: about 26kbps
182* **`5`**: about 20kbps 182* **`5`**: about 20kbps
183 183
184```c
185#define SPLIT_MODS_ENABLE
186```
187
188This enables transmitting modifier state (normal, weak and oneshot) to the non
189primary side of the split keyboard. This adds a few bytes of data to the split
190communication protocol and may impact the matrix scan speed when enabled.
191The purpose of this feature is to support cosmetic use of modifer state (e.g.
192displaying status on an OLED screen).
193
184### Hardware Configuration Options 194### Hardware Configuration Options
185 195
186There are some settings that you may need to configure, based on how the hardware is set up. 196There are some settings that you may need to configure, based on how the hardware is set up.
diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md
index ad63a1c2e..7198576e3 100644
--- a/docs/getting_started_make_guide.md
+++ b/docs/getting_started_make_guide.md
@@ -121,10 +121,6 @@ For further details, as well as limitations, see the [Unicode page](feature_unic
121 121
122This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information. 122This allows you output audio on the C6 pin (needs abstracting). See the [audio page](feature_audio.md) for more information.
123 123
124`FAUXCLICKY_ENABLE`
125
126Uses buzzer to emulate clicky switches. A cheap imitation of the Cherry blue switches. By default, uses the C6 pin, same as `AUDIO_ENABLE`.
127
128`VARIABLE_TRACE` 124`VARIABLE_TRACE`
129 125
130Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information. 126Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information.
diff --git a/docs/ja/compatible_microcontrollers.md b/docs/ja/compatible_microcontrollers.md
index 48b07aaec..fdd11f14f 100644
--- a/docs/ja/compatible_microcontrollers.md
+++ b/docs/ja/compatible_microcontrollers.md
@@ -14,6 +14,7 @@ QMK ã¯å分ãªå®¹é‡ã®ãƒ•ラッシュメモリを備ãˆãŸ USB 対応 AVR ã¾
14* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2) 14* [ATmega16U2](https://www.microchip.com/wwwproducts/en/ATmega16U2) / [ATmega32U2](https://www.microchip.com/wwwproducts/en/ATmega32U2)
15* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4) 15* [ATmega16U4](https://www.microchip.com/wwwproducts/en/ATmega16U4) / [ATmega32U4](https://www.microchip.com/wwwproducts/en/ATmega32U4)
16* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286) 16* [AT90USB64](https://www.microchip.com/wwwproducts/en/AT90USB646) / [AT90USB128](https://www.microchip.com/wwwproducts/en/AT90USB1286)
17* [AT90USB162](https://www.microchip.com/wwwproducts/en/AT90USB162)
17 18
18組ã¿è¾¼ã¿ã® USB インターフェースをæŒãŸãªã„ã€ã„ãã¤ã‹ã® MCU ã¯ä»£ã‚り㫠[V-USB](https://www.obdev.at/products/vusb/index.html) を使ã„ã¾ã™: 19組ã¿è¾¼ã¿ã® USB インターフェースをæŒãŸãªã„ã€ã„ãã¤ã‹ã® MCU ã¯ä»£ã‚り㫠[V-USB](https://www.obdev.at/products/vusb/index.html) を使ã„ã¾ã™:
19 20
@@ -30,6 +31,10 @@ QMK ã¯å分ãªå®¹é‡ã®ãƒ•ラッシュメモリを備ãˆãŸ USB 対応 AVR ã¾
30* [STM32F0x2](https://www.st.com/en/microcontrollers-microprocessors/stm32f0x2.html) 31* [STM32F0x2](https://www.st.com/en/microcontrollers-microprocessors/stm32f0x2.html)
31* [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html) 32* [STM32F103](https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html)
32* [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html) 33* [STM32F303](https://www.st.com/en/microcontrollers-microprocessors/stm32f303.html)
34* [STM32F401](https://www.st.com/en/microcontrollers-microprocessors/stm32f401.html)
35* [STM32F411](https://www.st.com/en/microcontrollers-microprocessors/stm32f411.html)
36* [STM32G431](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x1.html)
37* [STM32G474](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x4.html)
33 38
34### NXP (Kinetis) 39### NXP (Kinetis)
35 40
diff --git a/docs/ja/feature_audio.md b/docs/ja/feature_audio.md
index 2d13c3f7c..ca7820e3c 100644
--- a/docs/ja/feature_audio.md
+++ b/docs/ja/feature_audio.md
@@ -220,12 +220,6 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = LAYOUT_ortho_4x12(
220 AU_OFF, 220 AU_OFF,
221 AU_TOG, 221 AU_TOG,
222 222
223 #ifdef FAUXCLICKY_ENABLE
224 FC_ON,
225 FC_OFF,
226 FC_TOG,
227 #endif
228
229 // Music mode on/off/toggle 223 // Music mode on/off/toggle
230 MU_ON, 224 MU_ON,
231 MU_OFF, 225 MU_OFF,
diff --git a/docs/ja/feature_macros.md b/docs/ja/feature_macros.md
index 14a58ad24..c42a61b5f 100644
--- a/docs/ja/feature_macros.md
+++ b/docs/ja/feature_macros.md
@@ -9,7 +9,7 @@
9 9
10!> **ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£ã®æ³¨æ„**: マクロを使ã£ã¦ã€ãƒ‘スワードã€ã‚¯ãƒ¬ã‚¸ãƒƒãƒˆã‚«ãƒ¼ãƒ‰ç•ªå·ã€ãã®ä»–ã®æ©Ÿå¯†æƒ…å ±ã®ã„ãšã‚Œã‚‚é€ä¿¡ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ãŒã€ãれã¯éžå¸¸ã«æ‚ªã„考ãˆã§ã™ã€‚ã‚ãªãŸã®ã‚­ãƒ¼ãƒœãƒ¼ãƒ‰ã‚’手ã«å…¥ã‚ŒãŸäººã¯èª°ã§ã‚‚テキストエディタを開ã„ã¦ãã®æƒ…å ±ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ 10!> **ã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£ã®æ³¨æ„**: マクロを使ã£ã¦ã€ãƒ‘スワードã€ã‚¯ãƒ¬ã‚¸ãƒƒãƒˆã‚«ãƒ¼ãƒ‰ç•ªå·ã€ãã®ä»–ã®æ©Ÿå¯†æƒ…å ±ã®ã„ãšã‚Œã‚‚é€ä¿¡ã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ãŒã€ãれã¯éžå¸¸ã«æ‚ªã„考ãˆã§ã™ã€‚ã‚ãªãŸã®ã‚­ãƒ¼ãƒœãƒ¼ãƒ‰ã‚’手ã«å…¥ã‚ŒãŸäººã¯èª°ã§ã‚‚テキストエディタを開ã„ã¦ãã®æƒ…å ±ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
11 11
12## æ–°ã—ã„æ–¹æ³•: `SEND_STRING()` 㨠`process_record_user` 12## `SEND_STRING()` 㨠`process_record_user`
13 13
14å˜èªžã¾ãŸã¯ãƒ•レーズを入力ã™ã‚‹ã‚­ãƒ¼ãŒæ¬²ã—ã„æ™‚ãŒã‚りã¾ã™ã€‚最も一般的ãªçжæ³ã®ãŸã‚ã« `SEND_STRING()` ã‚’æä¾›ã—ã¦ã„ã¾ã™ã€‚ã“ã‚Œã¯æ–‡å­—列(ã¤ã¾ã‚Šã€æ–‡å­—ã®ã‚·ãƒ¼ã‚±ãƒ³ã‚¹)を入力ã—ã¾ã™ã€‚ç°¡å˜ã«ã‚­ãƒ¼ã‚³ãƒ¼ãƒ‰ã«å¤‰æ›ã™ã‚‹ã“ã¨ãŒã§ãã‚‹å…¨ã¦ã® ASCII 文字ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ (例ãˆã°ã€`qmk 123\n\t`)。 14å˜èªžã¾ãŸã¯ãƒ•レーズを入力ã™ã‚‹ã‚­ãƒ¼ãŒæ¬²ã—ã„æ™‚ãŒã‚りã¾ã™ã€‚最も一般的ãªçжæ³ã®ãŸã‚ã« `SEND_STRING()` ã‚’æä¾›ã—ã¦ã„ã¾ã™ã€‚ã“ã‚Œã¯æ–‡å­—列(ã¤ã¾ã‚Šã€æ–‡å­—ã®ã‚·ãƒ¼ã‚±ãƒ³ã‚¹)を入力ã—ã¾ã™ã€‚ç°¡å˜ã«ã‚­ãƒ¼ã‚³ãƒ¼ãƒ‰ã«å¤‰æ›ã™ã‚‹ã“ã¨ãŒã§ãã‚‹å…¨ã¦ã® ASCII 文字ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã™ (例ãˆã°ã€`qmk 123\n\t`)。
15 15
@@ -267,15 +267,15 @@ SEND_STRING(".."SS_TAP(X_END));
267ã“ã®ãƒžã‚¯ãƒ­ã¯ `KC_LALT` を登録ã—ã€`KC_TAB` をタップã—ã¦ã€1000ms å¾…ã¡ã¾ã™ã€‚キーãŒå†åº¦ã‚¿ãƒƒãƒ—ã•れるã¨ã€åˆ¥ã® `KC_TAB` ãŒé€ä¿¡ã•れã¾ã™; タップãŒç„¡ã„å ´åˆã€`KC_LALT` ãŒç™»éŒ²è§£é™¤ã•れã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’切り替ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ 267ã“ã®ãƒžã‚¯ãƒ­ã¯ `KC_LALT` を登録ã—ã€`KC_TAB` をタップã—ã¦ã€1000ms å¾…ã¡ã¾ã™ã€‚キーãŒå†åº¦ã‚¿ãƒƒãƒ—ã•れるã¨ã€åˆ¥ã® `KC_TAB` ãŒé€ä¿¡ã•れã¾ã™; タップãŒç„¡ã„å ´åˆã€`KC_LALT` ãŒç™»éŒ²è§£é™¤ã•れã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’切り替ãˆã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
268 268
269```c 269```c
270bool is_alt_tab_active = false; # keymap.c ã®å…ˆé ­ä»˜è¿‘ã«ã“れを追加ã—ã¾ã™ 270bool is_alt_tab_active = false; // keymap.c ã®å…ˆé ­ä»˜è¿‘ã«ã“れを追加ã—ã¾ã™
271uint16_t alt_tab_timer = 0; # ã™ãã«ãれらを使ã„ã¾ã™ 271uint16_t alt_tab_timer = 0; // ã™ãã«ãれらを使ã„ã¾ã™
272 272
273enum custom_keycodes { # 素晴らã—ã„キーコードを用æ„ã—ã¦ãã ã•ã„ 273enum custom_keycodes { // 素晴らã—ã„キーコードを用æ„ã—ã¦ãã ã•ã„
274 ALT_TAB = SAFE_RANGE, 274 ALT_TAB = SAFE_RANGE,
275}; 275};
276 276
277bool process_record_user(uint16_t keycode, keyrecord_t *record) { 277bool process_record_user(uint16_t keycode, keyrecord_t *record) {
278 switch (keycode) { # ã“れã¯ã‚­ãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’利用ã—ãŸã¤ã¾ã‚‰ãªã„作業ã®ã»ã¨ã‚“ã©ã‚’行ã„ã¾ã™ã€‚ 278 switch (keycode) { // ã“れã¯ã‚­ãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’利用ã—ãŸã¤ã¾ã‚‰ãªã„作業ã®ã»ã¨ã‚“ã©ã‚’行ã„ã¾ã™ã€‚
279 case ALT_TAB: 279 case ALT_TAB:
280 if (record->event.pressed) { 280 if (record->event.pressed) {
281 if (!is_alt_tab_active) { 281 if (!is_alt_tab_active) {
@@ -292,7 +292,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
292 return true; 292 return true;
293} 293}
294 294
295void matrix_scan_user(void) { # ã¨ã¦ã‚‚é‡è¦ãªã‚¿ã‚¤ãƒžãƒ¼ 295void matrix_scan_user(void) { // ã¨ã¦ã‚‚é‡è¦ãªã‚¿ã‚¤ãƒžãƒ¼
296 if (is_alt_tab_active) { 296 if (is_alt_tab_active) {
297 if (timer_elapsed(alt_tab_timer) > 1000) { 297 if (timer_elapsed(alt_tab_timer) > 1000) {
298 unregister_code(KC_LALT); 298 unregister_code(KC_LALT);
@@ -301,104 +301,3 @@ void matrix_scan_user(void) { # ã¨ã¦ã‚‚é‡è¦ãªã‚¿ã‚¤ãƒžãƒ¼
301 } 301 }
302} 302}
303``` 303```
304
305---
306
307## **(éžæŽ¨å¥¨)** å¤ã„方法: `MACRO()` 㨠`action_get_macro`
308
309!> ã“れ㯠TMK ã‹ã‚‰ç¶™æ‰¿ã•れã¦ãŠã‚Šã€æ›´æ–°ã•れã¦ã„ã¾ã›ã‚“ - 代ã‚り㫠`SEND_STRING` 㨠`process_record_user` を使ã†ã“ã¨ã‚’ãŠå‹§ã‚ã—ã¾ã™ã€‚
310
311デフォルトã§ã¯ã€QMK ã¯ãƒžã‚¯ãƒ­ãŒç„¡ã„ã“ã¨ã‚’剿ã¨ã—ã¦ã„ã¾ã™ã€‚マクロを定義ã™ã‚‹ã«ã¯ã€`action_get_macro()` 関数を作æˆã—ã¾ã™ã€‚例ãˆã°:
312
313```c
314const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
315 if (record->event.pressed) {
316 switch(id) {
317 case 0:
318 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
319 case 1:
320 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
321 }
322 }
323 return MACRO_NONE;
324};
325```
326
327ã“れã¯å‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã‚‹ã‚­ãƒ¼ãŒæŠ¼ã•ã‚ŒãŸæ™‚ã«å®Ÿè¡Œã•れる2ã¤ã®ãƒžã‚¯ãƒ­ã‚’定義ã—ã¾ã™ã€‚ã‚­ãƒ¼ãŒæ”¾ã•ã‚ŒãŸæ™‚ã«ãれらを実行ã—ãŸã„å ´åˆã¯ã€if 文を変更ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
328
329 if (!record->event.pressed) {
330
331### マクロコマンド
332
333マクロã¯ä»¥ä¸‹ã®ã‚³ãƒžãƒ³ãƒ‰ã‚’å«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™:
334
335* I() ã¯ã‚¹ãƒˆãƒ­ãƒ¼ã‚¯ã®é–“隔をミリ秒å˜ä½ã§å¤‰æ›´ã—ã¾ã™ã€‚
336* D() ã¯ã‚­ãƒ¼ã‚’押ã—ã¾ã™ã€‚
337* U() ã¯ã‚­ãƒ¼ã‚’放ã—ã¾ã™ã€‚
338* T() ã¯ã‚­ãƒ¼ã‚’タイプ(押ã—ã¦æ”¾ã™)ã—ã¾ã™ã€‚
339* W() ã¯å¾…ã¡ã¾ã™ (ミリ秒)。
340* END 終了マーク。
341
342### マクロをキーã«ãƒžãƒƒãƒ”ングã™ã‚‹
343
344マクロを呼ã³å‡ºã™ã«ã¯ã‚­ãƒ¼ãƒžãƒƒãƒ—内㧠`M()` 関数を使ã„ã¾ã™ã€‚例ãˆã°ã€2キーã®ã‚­ãƒ¼ãƒœãƒ¼ãƒ‰ã®ã‚­ãƒ¼ãƒžãƒƒãƒ—ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™:
345
346```c
347const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
348 [0] = LAYOUT(
349 M(0), M(1)
350 ),
351};
352
353const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
354 if (record->event.pressed) {
355 switch(id) {
356 case 0:
357 return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END);
358 case 1:
359 return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END);
360 }
361 }
362 return MACRO_NONE;
363};
364```
365
366å·¦å´ã®ã‚­ãƒ¼ã‚’押ã™ã¨ã€"Hi!" を入力ã—ã€å³å´ã®ã‚­ãƒ¼ã‚’押ã™ã¨ "Bye!" を入力ã—ã¾ã™ã€‚
367
368### マクロã«åå‰ã‚’付ã‘ã‚‹
369
370キーマップを読ã¿ã‚„ã™ãã—ãªãŒã‚‰ã‚­ãƒ¼ãƒžãƒƒãƒ—ã‹ã‚‰å‚ç…§ã—ãŸã„マクロãŒãŸãã•ã‚“ã‚ã‚‹å ´åˆã¯ã€ãƒ•ァイルã®å…ˆé ­ã§ `#define` を使ã£ã¦åå‰ã‚’付ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
371
372```c
373#define M_HI M(0)
374#define M_BYE M(1)
375
376const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
377 [0] = LAYOUT(
378 M_HI, M_BYE
379 ),
380};
381```
382
383
384## 高度ãªä¾‹:
385
386### å˜ä¸€ã‚­ãƒ¼ã®ã‚³ãƒ”ーã¨è²¼ã‚Šä»˜ã‘
387
388ã“ã®ä¾‹ã¯ã€æŠ¼ã•ã‚ŒãŸæ™‚ã« `Ctrl-C` ã‚’é€ä¿¡ã—ã€æ”¾ã•れる時㫠`Ctrl-V` ã‚’é€ä¿¡ã™ã‚‹ãƒžã‚¯ãƒ­ã‚’定義ã—ã¾ã™ã€‚
389
390```c
391const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
392 switch(id) {
393 case 0: {
394 if (record->event.pressed) {
395 return MACRO( D(LCTL), T(C), U(LCTL), END );
396 } else {
397 return MACRO( D(LCTL), T(V), U(LCTL), END );
398 }
399 break;
400 }
401 }
402 return MACRO_NONE;
403};
404```
diff --git a/docs/ja/feature_mouse_keys.md b/docs/ja/feature_mouse_keys.md
index 74b09e939..e4fa9dfb4 100644
--- a/docs/ja/feature_mouse_keys.md
+++ b/docs/ja/feature_mouse_keys.md
@@ -34,6 +34,9 @@ MOUSEKEY_ENABLE = yes
34| `KC_MS_BTN3` | `KC_BTN3` | ボタン3を押㙠| 34| `KC_MS_BTN3` | `KC_BTN3` | ボタン3を押㙠|
35| `KC_MS_BTN4` | `KC_BTN4` | ボタン4を押㙠| 35| `KC_MS_BTN4` | `KC_BTN4` | ボタン4を押㙠|
36| `KC_MS_BTN5` | `KC_BTN5` | ボタン5を押㙠| 36| `KC_MS_BTN5` | `KC_BTN5` | ボタン5を押㙠|
37| `KC_MS_BTN6` | `KC_BTN6` | ボタン6を押㙠|
38| `KC_MS_BTN7` | `KC_BTN7` | ボタン7を押㙠|
39| `KC_MS_BTN8` | `KC_BTN8` | ボタン8を押㙠|
37| `KC_MS_WH_UP` | `KC_WH_U` | ホイールをå‘ã“ã†å´ã«å›žè»¢ | 40| `KC_MS_WH_UP` | `KC_WH_U` | ホイールをå‘ã“ã†å´ã«å›žè»¢ |
38| `KC_MS_WH_DOWN` | `KC_WH_D` | ホイールを手å‰å´ã«å›žè»¢ | 41| `KC_MS_WH_DOWN` | `KC_WH_D` | ホイールを手å‰å´ã«å›žè»¢ |
39| `KC_MS_WH_LEFT` | `KC_WH_L` | ホイールを左ã«å€’ã™ | 42| `KC_MS_WH_LEFT` | `KC_WH_L` | ホイールを左ã«å€’ã™ |
diff --git a/docs/ja/getting_started_make_guide.md b/docs/ja/getting_started_make_guide.md
index 08005877e..45284a0b9 100644
--- a/docs/ja/getting_started_make_guide.md
+++ b/docs/ja/getting_started_make_guide.md
@@ -110,10 +110,6 @@ make コマンド自体ã«ã‚‚ã„ãã¤ã‹ã®è¿½åŠ ã‚ªãƒ—ã‚·ãƒ§ãƒ³ãŒã‚りã¾ã™
110 110
111C6 ピン(抽象化ãŒå¿…è¦)ã§ã‚ªãƒ¼ãƒ‡ã‚£ã‚ªå‡ºåŠ›ã§ãã¾ã™ã€‚詳細ã¯[オーディオページ](ja/feature_audio.md)を見ã¦ãã ã•ã„。 111C6 ピン(抽象化ãŒå¿…è¦)ã§ã‚ªãƒ¼ãƒ‡ã‚£ã‚ªå‡ºåŠ›ã§ãã¾ã™ã€‚詳細ã¯[オーディオページ](ja/feature_audio.md)を見ã¦ãã ã•ã„。
112 112
113`FAUXCLICKY_ENABLE`
114
115クリック音ã®ã‚るスイッãƒã‚’エミュレートã™ã‚‹ãŸã‚ã«ãƒ–ザーを使ã„ã¾ã™ã€‚Cherry社製ã®é’軸スイッãƒã®å®‰ã£ã½ã„模倣ã§ã™ã€‚デフォルトã§ã¯ã€`AUDIO_ENABLE` ã¨åŒã˜ã‚ˆã†ã« C6 ピンを使ã„ã¾ã™ã€‚
116
117`VARIABLE_TRACE` 113`VARIABLE_TRACE`
118 114
119ã“れを使ã£ã¦å¤‰æ•°ã®å€¤ã®å¤‰æ›´ã‚’デãƒãƒƒã‚°ã—ã¾ã™ã€‚詳細ã«ã¤ã„ã¦ã¯ãƒ¦ãƒ‹ãƒƒãƒˆãƒ†ã‚¹ãƒˆã®ãƒšãƒ¼ã‚¸ã®[変数ã®ãƒˆãƒ¬ãƒ¼ã‚¹](ja/unit_testing.md#tracing-variables)ã®ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’見ã¦ãã ã•ã„。 115ã“れを使ã£ã¦å¤‰æ•°ã®å€¤ã®å¤‰æ›´ã‚’デãƒãƒƒã‚°ã—ã¾ã™ã€‚詳細ã«ã¤ã„ã¦ã¯ãƒ¦ãƒ‹ãƒƒãƒˆãƒ†ã‚¹ãƒˆã®ãƒšãƒ¼ã‚¸ã®[変数ã®ãƒˆãƒ¬ãƒ¼ã‚¹](ja/unit_testing.md#tracing-variables)ã®ã‚»ã‚¯ã‚·ãƒ§ãƒ³ã‚’見ã¦ãã ã•ã„。
diff --git a/docs/ja/proton_c_conversion.md b/docs/ja/proton_c_conversion.md
index 6e4f7dcb6..e7c07413c 100644
--- a/docs/ja/proton_c_conversion.md
+++ b/docs/ja/proton_c_conversion.md
@@ -51,6 +51,7 @@ Proton C ã«ã¯1ã¤ã®ã‚ªãƒ³ãƒœãƒ¼ãƒ‰ LED(C13)ã—ã‹ãªãã€ãƒ‡ãƒ•ォルトã§ã
51 51
52``` 52```
53MCU = STM32F303 53MCU = STM32F303
54BOARD = QMK_PROTON_C
54``` 55```
55 56
56次ã®å¤‰æ•°ãŒå­˜åœ¨ã™ã‚‹å ´åˆã¯å‰Šé™¤ã—ã¾ã™ã€‚ 57次ã®å¤‰æ•°ãŒå­˜åœ¨ã™ã‚‹å ´åˆã¯å‰Šé™¤ã—ã¾ã™ã€‚
diff --git a/docs/proton_c_conversion.md b/docs/proton_c_conversion.md
index 1b5e496e7..47511e1b1 100644
--- a/docs/proton_c_conversion.md
+++ b/docs/proton_c_conversion.md
@@ -44,6 +44,7 @@ To use the Proton C natively, without having to specify `CTPC=yes`, you need to
44 44
45``` 45```
46MCU = STM32F303 46MCU = STM32F303
47BOARD = QMK_PROTON_C
47``` 48```
48 49
49Remove these variables if they exist: 50Remove these variables if they exist:
diff --git a/docs/reference_info_json.md b/docs/reference_info_json.md
index 67c189d78..30d813e93 100644
--- a/docs/reference_info_json.md
+++ b/docs/reference_info_json.md
@@ -19,8 +19,20 @@ The `info.json` file is a JSON formatted dictionary with the following keys avai
19 * Width of the board in Key Units 19 * Width of the board in Key Units
20* `height` 20* `height`
21 * Height of the board in Key Units 21 * Height of the board in Key Units
22* `debounce`
23 * How many milliseconds (ms) to wait for debounce to happen. (Default: 5)
24* `diode_direction`
25 * The direction diodes face. See [`DIRECT_PINS` in the hardware configuration](https://docs.qmk.fm/#/config_options?id=hardware-options) for more details.
26* `layout_aliases`
27 * A dictionary containing layout aliases. The key is the alias and the value is a layout in `layouts` it maps to.
22* `layouts` 28* `layouts`
23 * Physical Layout representations. See the next section for more detail. 29 * Physical Layout representations. See the [Layout Format](#layout_format) section for more detail.
30* `matrix_pins`
31 * Configure the pins corresponding to columns and rows, or direct pins. See [Matrix Pins](#matrix_pins) for more detail.
32* `rgblight`
33 * Configure the [RGB Lighting feature](feature_rgblight.md). See the [RGB Lighting](#rgb_lighting) section for more detail.
34* `usb`
35 * Configure USB VID, PID, and other parameters. See [USB](#USB) for more detail.
24 36
25### Layout Format 37### Layout Format
26 38
@@ -49,25 +61,129 @@ All key positions and rotations are specified in relation to the top-left corner
49 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1` 61 * The width of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
50* `h` 62* `h`
51 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1` 63 * The height of the key, in Key Units. Ignored if `ks` is provided. Default: `1`
52* `r`
53 * How many degrees clockwise to rotate the key.
54* `rx`
55 * The absolute position of the point to rotate the key around in the horizontal axis. Default: `x`
56* `ry`
57 * The absolute position of the point to rotate the key around in the vertical axis. Default: `y`
58* `ks`
59 * Key Shape: define a polygon by providing a list of points, in Key Units.
60 * **Important**: These are relative to the top-left of the key, not absolute.
61 * Example ISO Enter: `[ [0,0], [1.5,0], [1.5,2], [0.25,2], [0.25,1], [0,1], [0,0] ]`
62* `label` 64* `label`
63 * What to name this position in the matrix. 65 * What to name this position in the matrix.
64 * This should usually be the same name as what is silkscreened on the PCB at this location. 66 * This should usually correspond to the keycode for the first layer of the default keymap.
65 67* `matrix`
66## How is the Metadata Exposed? 68 * A 2 item list describing the row and column location for this key.
67 69
68This metadata is primarily used in two ways: 70### Matrix Pins
69 71
70* To allow web-based configurators to dynamically generate UI 72Currently QMK supports connecting switches either directly to GPIO pins or via a switch matrix. At this time you can not combine these, they are mutually exclusive.
71* To support the new `make keyboard:keymap:qmk` target, which bundles this metadata up with the firmware to allow QMK Toolbox to be smarter. 73
72 74#### Switch Matrix
73Configurator authors can see the [QMK Compiler](https://docs.api.qmk.fm/using-the-api) docs for more information on using the JSON API. 75
76Most keyboards use a switch matrix to connect keyswitches to the MCU. You can define your pin columns and rows to configure your switch matrix. When defining switch matrices you should also define your `diode_direction`.
77
78Example:
79
80```json
81{
82 "diode_direction": "COL2ROW",
83 "matrix_pins": {
84 "cols": ["F4", "E6", "B1", "D2"],
85 "rows": ["B0", "D3", "D5", "D4", "D6"]
86 }
87}
88```
89
90#### Direct Pins
91
92Direct pins are when you connect one side of the switch to GND and the other side to a GPIO pin on your MCU. No diode is required, but there is a 1:1 mapping between switches and pins.
93
94When specifying direct pins you need to arrange them in nested arrays. The outer array consists of rows, while the inner array is a text string corresponding to a pin. You can use `null` to indicate an empty spot in the matrix.
95
96Example:
97
98```json
99{
100 "matrix_pins": {
101 "direct": [
102 ["A10", "A9"],
103 ["A0", "B8"],
104 [null, "B11"],
105 ["B9", "A8"],
106 ["A7", "B1"],
107 [null, "B2"]
108 ]
109 }
110}
111```
112
113### RGB Lighting
114
115This section controls the legacy WS2812 support in QMK. This should not be confused with the RGB Matrix feature, which can be used to control both WS2812 and ISSI RGB LEDs.
116
117The following items can be set. Not every value is required.
118
119* `led_count`
120 * The number of LEDs in your strip
121* `pin`
122 * The GPIO pin that your LED strip is connected to
123* `animations`
124 * A dictionary that lists enabled and disabled animations. See [RGB Light Animations](#rgb_light_animations) below.
125* `sleep`
126 * Set to `true` to enable lighting during host sleep
127* `split`
128 * Set to `true` to enable synchronization functionality between split halves
129* `split_count`
130 * For split keyboards, the number of LEDs on each side
131* `max_brightness`
132 * (0-255) What the maxmimum brightness (value) level is
133* `hue_steps`
134 * How many steps of adjustment to have for hue
135* `saturation_steps`
136 * How many steps of adjustment to have for saturation
137* `brightness_steps`
138 * How many steps of adjustment to have for brightness (value)
139
140Example:
141
142```json
143{
144 "rgblight": {
145 "led_count": 4,
146 "pin": "F6",
147 "hue_steps": 10,
148 "saturation_steps": 17,
149 "brightness_steps": 17,
150 "animations": {
151 "all": true
152 }
153 }
154}
155```
156
157#### RGB Light Animations
158
159The following animations can be enabled:
160
161| Key | Description |
162|-----|-------------|
163| `all` | Enable all additional animation modes. |
164| `alternating` | Enable alternating animation mode. |
165| `breathing` | Enable breathing animation mode. |
166| `christmas` | Enable christmas animation mode. |
167| `knight` | Enable knight animation mode. |
168| `rainbow_mood` | Enable rainbow mood animation mode. |
169| `rainbow_swirl` | Enable rainbow swirl animation mode. |
170| `rgb_test` | Enable RGB test animation mode. |
171| `snake` | Enable snake animation mode. |
172| `static_gradient` | Enable static gradient mode. |
173| `twinkle` | Enable twinkle animation mode. |
174
175### USB
176
177Every USB keyboard needs to have its USB parmaters defined. At a minimum you need to set vid, pid, and device version.
178
179Example:
180
181```json
182{
183 "usb": {
184 "vid": "0xC1ED",
185 "pid": "0x23B0",
186 "device_ver": "0x0001"
187 }
188}
189```
diff --git a/docs/reference_keymap_extras.md b/docs/reference_keymap_extras.md
index f2abb4e59..40a195684 100644
--- a/docs/reference_keymap_extras.md
+++ b/docs/reference_keymap_extras.md
@@ -18,7 +18,9 @@ To use these, simply `#include` the corresponding [header file](https://github.c
18|Dutch (Belgium) |`keymap_belgian.h` | 18|Dutch (Belgium) |`keymap_belgian.h` |
19|English (Ireland) |`keymap_irish.h` | 19|English (Ireland) |`keymap_irish.h` |
20|English (UK) |`keymap_uk.h` | 20|English (UK) |`keymap_uk.h` |
21|English (US Extended) |`keymap_us_extended.h` |
21|English (US International) |`keymap_us_international.h` | 22|English (US International) |`keymap_us_international.h` |
23|English (US International, Linux)|`keymap_us_international_linux.h`|
22|Estonian |`keymap_estonian.h` | 24|Estonian |`keymap_estonian.h` |
23|Finnish |`keymap_finnish.h` | 25|Finnish |`keymap_finnish.h` |
24|French |`keymap_french.h` | 26|French |`keymap_french.h` |
diff --git a/docs/serial_driver.md b/docs/serial_driver.md
index bc376b6dd..c98f4c117 100644
--- a/docs/serial_driver.md
+++ b/docs/serial_driver.md
@@ -60,6 +60,7 @@ Configure the hardware via your config.h:
60 // 5: about 19200 baud 60 // 5: about 19200 baud
61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 61#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 62#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
63#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100
63``` 64```
64 65
65You must also enable the ChibiOS `SERIAL` feature: 66You must also enable the ChibiOS `SERIAL` feature:
diff --git a/docs/spi_driver.md b/docs/spi_driver.md
index 16fe1d803..a27a3a13d 100644
--- a/docs/spi_driver.md
+++ b/docs/spi_driver.md
@@ -6,12 +6,12 @@ The SPI Master drivers used in QMK have a set of common functions to allow porta
6 6
7No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` pins of your SPI devices to the matching pins on the MCU: 7No special setup is required - just connect the `SS`, `SCK`, `MOSI` and `MISO` pins of your SPI devices to the matching pins on the MCU:
8 8
9|MCU |`SS`|`SCK`|`MOSI`|`MISO`| 9|MCU |`SS`|`SCK`|`MOSI`|`MISO`|
10|---------------|----|-----|------|------| 10|-----------------|----|-----|------|------|
11|ATmega16/32U2/4|`B0`|`B1` |`B2` |`B3` | 11|ATmega16/32U2/4 |`B0`|`B1` |`B2` |`B3` |
12|AT90USB64/128 |`B0`|`B1` |`B2` |`B3` | 12|AT90USB64/128/162|`B0`|`B1` |`B2` |`B3` |
13|ATmega32A |`B4`|`B7` |`B5` |`B6` | 13|ATmega32A |`B4`|`B7` |`B5` |`B6` |
14|ATmega328/P |`B2`|`B5` |`B3` |`B4` | 14|ATmega328/P |`B2`|`B5` |`B3` |`B4` |
15 15
16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually. 16You may use more than one slave select pin, not just the `SS` pin. This is useful when you have multiple devices connected and need to communicate with them individually.
17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`. 17`SPI_SS_PIN` can be passed to `spi_start()` to refer to `SS`.
diff --git a/docs/uart_driver.md b/docs/uart_driver.md
new file mode 100644
index 000000000..4d1716975
--- /dev/null
+++ b/docs/uart_driver.md
@@ -0,0 +1,90 @@
1# UART Driver
2
3The UART drivers used in QMK have a set of common functions to allow portability between MCUs.
4
5Currently, this driver does not support enabling hardware flow control (the `RTS` and `CTS` pins) if available, but may do so in future.
6
7## AVR Configuration
8
9No special setup is required - just connect the `RX` and `TX` pins of your UART device to the opposite pins on the MCU:
10
11|MCU |`TX`|`RX`|`CTS`|`RTS`|
12|-------------|----|----|-----|-----|
13|ATmega16/32U2|`D3`|`D2`|`D7` |`D6` |
14|ATmega16/32U4|`D3`|`D2`|`D5` |`B7` |
15|AT90USB64/128|`D3`|`D2`|*n/a*|*n/a*|
16|ATmega32A |`D1`|`D0`|*n/a*|*n/a*|
17|ATmega328/P |`D1`|`D0`|*n/a*|*n/a*|
18
19## ChibiOS/ARM Configuration
20
21You'll need to determine which pins can be used for UART -- as an example, STM32 parts generally have multiple UART peripherals, labeled USART1, USART2, USART3 etc.
22
23To enable UART, modify your board's `halconf.h` to enable the serial driver:
24
25```c
26#define HAL_USE_SERIAL TRUE
27```
28
29Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
30
31```c
32#undef STM32_SERIAL_USE_USART2
33#define STM32_SERIAL_USE_USART2 TRUE
34```
35
36Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
37
38|`config.h` override |Description |Default Value|
39|--------------------------|---------------------------------------------------------------|-------------|
40|`#define SERIAL_DRIVER` |USART peripheral to use - USART1 -> `SD1`, USART2 -> `SD2` etc.|`SD1` |
41|`#define SD1_TX_PIN` |The pin to use for TX |`A9` |
42|`#define SD1_TX_PAL_MODE` |The alternate function mode for TX |`7` |
43|`#define SD1_RX_PIN` |The pin to use for RX |`A10` |
44|`#define SD1_RX_PAL_MODE` |The alternate function mode for RX |`7` |
45|`#define SD1_CTS_PIN` |The pin to use for CTS |`A11` |
46|`#define SD1_CTS_PAL_MODE`|The alternate function mode for CTS |`7` |
47|`#define SD1_RTS_PIN` |The pin to use for RTS |`A12` |
48|`#define SD1_RTS_PAL_MODE`|The alternate function mode for RTS |`7` |
49
50## Functions
51
52### `void uart_init(uint32_t baud)`
53
54Initialize the UART driver. This function must be called only once, before any of the below functions can be called.
55
56#### Arguments
57
58 - `uint32_t baud`
59 The baud rate to transmit and receive at. This may depend on the device you are communicating with. Common values are 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200.
60
61---
62
63### `void uart_putchar(uint8_t c)`
64
65Transmit a single byte.
66
67#### Arguments
68
69 - `uint8_t c`
70 The byte (character) to send, from 0 to 255.
71
72---
73
74### `uint8_t uart_getchar(void)`
75
76Receive a single byte.
77
78#### Return Value
79
80The byte read from the receive buffer.
81
82---
83
84### `bool uart_available(void)`
85
86Return whether the receive buffer contains data. Call this function to determine if `uart_getchar()` will return meaningful data.
87
88#### Return Value
89
90`true` if the receive buffer length is non-zero.