Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/qmk/qmk_firmware: (55 commits)
  Keyboard: Add Handwired 108 Key with Trackpoint (qmk#4448)
  Update Levinson readme to support elite-c (qmk#4445)
  Fix UCIS code
  Fix permanently on capslock led on Atom47 (qmk#4452)
  Delete readme.md
  Fix my community layouts (qmk#4449)
  Add default glow board
  Fix i2c_master.d listed more than once warning
  Make Ergodox EZ Glow's rgb matrix user configurable
  Allows disabling rgb effects in userspace (qmk#4422)
  Satan: add LAYOUT_60_ansi_split_rshift to info.json (qmk#4441)
  Add personal zvecr dz60 keymap (qmk#4443)
  Default JIS TKL keymap for Pegasus Hoof (qmk#4446)
  Update to my keymaps and userspace (qmk#4447)
  Updating Boy_314's XD75 Layout (qmk#4440)
  Moved ep40 to ep/40 for easier adding of next ep keyboard (qmk#4439)
  Update whitefox/konstantin keymap (qmk#4436)
  Unify 68keys with mf68 (qmk#4435)
  Add configurator support for luddite (qmk#4434)
  Use a single endpoint for HID reports (qmk#3951)
  ...
  • Loading branch information
Shinichi-Ohki committed Nov 21, 2018
2 parents e5ba142 + 1485098 commit 2d4420d
Show file tree
Hide file tree
Showing 268 changed files with 8,770 additions and 2,632 deletions.
2 changes: 2 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* [Glossary](reference_glossary.md)
* [Unit Testing](unit_testing.md)
* [Useful Functions](ref_functions.md)
* [Configurator Support](reference_configurator_support.md)

* [Features](features.md)
* [Basic Keycodes](keycodes_basic.md)
Expand Down Expand Up @@ -79,6 +80,7 @@
* [Hand Wiring Guide](hand_wire.md)
* [ISP Flashing Guide](isp_flashing_guide.md)
* [ARM Debugging Guide](arm_debugging.md)
* [I2C Driver](i2c_driver.md)

* For a Deeper Understanding
* [How Keyboards Work](how_keyboards_work.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* [Glossary](reference_glossary.md)
* [Unit Testing](unit_testing.md)
* [Useful Functions](ref_functions.md)
* [Configurator Support](reference_configurator_support.md)

* [Features](features.md)
* [Basic Keycodes](keycodes_basic.md)
Expand Down Expand Up @@ -79,6 +80,7 @@
* [Hand Wiring Guide](hand_wire.md)
* [ISP Flashing Guide](isp_flashing_guide.md)
* [ARM Debugging Guide](arm_debugging.md)
* [I2C Driver](i2c_driver.md)

* For a Deeper Understanding
* [How Keyboards Work](how_keyboards_work.md)
Expand Down
29 changes: 29 additions & 0 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,32 @@ Use these to enable or disable building certain features. The more you have enab
* Forces the keyboard to wait for a USB connection to be established before it starts up
* `NO_USB_STARTUP_CHECK`
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.

## USB Endpoint Limitations

In order to provide services over USB, QMK has to use USB endpoints.
These are a finite resource: each microcontroller has only a certain number.
This limits what features can be enabled together.
If the available endpoints are exceeded, a build error is thrown.

The following features can require separate endpoints:

* `MOUSEKEY_ENABLE`
* `EXTRAKEY_ENABLE`
* `CONSOLE_ENABLE`
* `NKRO_ENABLE`
* `MIDI_ENABLE`
* `RAW_ENABLE`
* `VIRTSER_ENABLE`

In order to improve utilisation of the endpoints, the HID features can be combined to use a single endpoint.
By default, `MOUSEKEY`, `EXTRAKEY`, and `NKRO` are combined into a single endpoint.

The base keyboard functionality can also be combined into the endpoint,
by setting `KEYBOARD_SHARED_EP = yes`.
This frees up one more endpoint,
but it can prevent the keyboard working in some BIOSes,
as they do not implement Boot Keyboard protocol switching.

Combining the mouse also breaks Boot Mouse compatibility.
The mouse can be uncombined by setting `MOUSE_SHARED_EP = no` if this functionality is required.
2 changes: 1 addition & 1 deletion docs/faq_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ For now, you need to rollback avr-gcc to 7 in brew.
```
brew uninstall --force avr-gcc
brew install avr-gcc@7
brew link avr-gcc@7
brew link --force avr-gcc@7
```
19 changes: 11 additions & 8 deletions docs/feature_backlight.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ In this handler, the value of an incrementing counter is mapped onto a precomput

## Backlight Functions

|Function |Description |
|----------|----------------------------------------------------------|
|`backlight_toggle()` |Turn the backlight on or off |
|`backlight_step()` |Cycle through backlight levels |
|`backlight_increase()` |Increase the backlight level |
|`backlight_decrease()` |Decrease the backlight level |
|`backlight_level(x)` |Sets the backlight level to specified level |
|`get_backlight_level()`|Return the current backlight level |
|Function |Description |
|----------|-----------------------------------------------------------|
|`backlight_toggle()` |Turn the backlight on or off |
|`backlight_enable()` |Turn the backlight on |
|`backlight_disable()` |Turn the backlight off |
|`backlight_step()` |Cycle through backlight levels |
|`backlight_increase()` |Increase the backlight level |
|`backlight_decrease()` |Decrease the backlight level |
|`backlight_level(x)` |Sets the backlight level to specified level |
|`get_backlight_level()` |Return the current backlight level |
|`is_backlight_enabled()`|Return whether the backlight is currently on |

### Backlight Breathing Functions

Expand Down
24 changes: 24 additions & 0 deletions docs/feature_rgb_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,30 @@ These are the effects that are currently available:
#endif
RGB_MATRIX_EFFECT_MAX
};

You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`:


|Define |Description |
|---------------------------------------------------|--------------------------------------------|
|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` |
|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` |
|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` |
|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` |
|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` |
|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` |
|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON`|Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON`|
|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` |
|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` |
|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` |
|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` |
|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` |
|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` |


## Custom layer effects

Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QMK has a staggering number of features for building your keyboard. It can take
* [Auto Shift](feature_auto_shift.md) - Tap for the normal key, hold slightly longer for its shifted state.
* [Backlight](feature_backlight.md) - LED lighting support for your keyboard.
* [Bootmagic](feature_bootmagic.md) - Adjust the behavior of your keyboard using hotkeys.
* [Combos](feature_combos.md) - Custom actions for multiple key holds.
* [Combos](feature_combo.md) - Custom actions for multiple key holds.
* [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic").
* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself.
* [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave.
Expand Down
1 change: 1 addition & 0 deletions docs/getting_started_build_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ If you're using [homebrew,](http://brew.sh/) you can use the following commands:
brew tap PX4/homebrew-px4
brew update
brew install avr-gcc@7
brew link --force avr-gcc@7
brew install dfu-programmer
brew install dfu-util
brew install gcc-arm-none-eabi
Expand Down
82 changes: 82 additions & 0 deletions docs/i2c_driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# I2C Master Driver

The I2C Master drivers used in QMK have a set of common functions to allow portability between MCUs.

## Available functions

|Function |Description |
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|`void i2c_init(void);` |Initializes the I2C driver. This function should be called once before any transaction is initiated. |
|`uint8_t i2c_start(uint8_t address);` |Starts an I2C transaction. Address is the 7-bit slave address without the direction bit. |
|`uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Transmit data over I2C. Address is the 7-bit slave address without the direction. Returns status of transaction. |
|`uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` |Receive data over I2C. Address is the 7-bit slave address without the direction. Saves number of bytes specified by `length` in `data` array. Returns status of transaction. |
|`uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_transmit` function but `regaddr` sets where in the slave the data will be written. |
|`uint8_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` |Same as the `i2c_receive` function but `regaddr` sets from where in the slave the data will be read. |
|`uint8_t i2c_stop(uint16_t timeout);` |Stops the I2C driver. |

### Function Return

All the above functions, except `void i2c_init(void);` return the following truth table:

|Return Value |Description |
|---------------|---------------------------------------------------|
|0 |Operation executed successfully. |
|-1 |Operation failed. |
|-2 |Operation timed out. |


## AVR

### Configuration

The following defines can be used to configure the I2C master driver.

|Variable |Description |Default|
|------------------|---------------------------------------------------|-------|
|`#F_SCL` |Clock frequency in Hz |400KHz |
|`#Prescaler` |Divides master clock to aid in I2C clock selection |1 |

AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required.

## ARM

For ARM the Chibios I2C HAL driver is under the hood.
This section assumes an STM32 MCU.

### Configuration

The configuration for ARM MCUs can be quite complex as often there are multiple I2C drivers which can be assigned to a variety of ports.

Firstly the `mcuconf.h` file must be setup to enable the necessary hardware drivers.

|Variable |Description |Default|
|------------------------------|------------------------------------------------------------------------------------|-------|
|`#STM32_I2C_USE_XXX` |Enable/Disable the hardware driver XXX (each driver should be explicitly listed) |FALSE |
|`#STM32_I2C_BUSY_TIMEOUT` |Time in ms until the I2C command is aborted if no response is received |50 |
|`#STM32_I2C_XXX_IRQ_PRIORITY` |Interrupt priority for hardware driver XXX (THIS IS AN EXPERT SETTING) |10 |
|`#STM32_I2C_USE_DMA` |Enable/Disable the ability of the MCU to offload the data transfer to the DMA unit |TRUE |
|`#STM32_I2C_XXX_DMA_PRIORITY` |Priority of DMA unit for hardware driver XXX (THIS IS AN EXPERT SETTING) |1 |

Secondly, in the `halconf.h` file, `#define HAL_USE_I2C` must be set to `TRUE`. This allows ChibiOS to load its I2C driver.

Lastly, we need to assign the correct GPIO pins depending on the I2C hardware driver we want to use.

By default the I2C1 hardware driver is assumed to be used. If another hardware driver is used, `#define I2C_DRIVER I2CDX` should be added to the `config.h` file with X being the number of hardware driver used. For example is I2C3 is enabled, the `config.h` file should contain `#define I2C_DRIVER I2CD3`. This aligns the QMK I2C driver with the Chibios I2C driver.

STM32 MCUs allows a variety of pins to be configured as I2C pins depending on the hardware driver used. By default B6 and B7 are set to I2C.

This can be changed by declaring the `i2c_init` function which intentionally has a weak attribute. Please consult the datasheet of your MCU for the available GPIO configurations. The following is an example initialization function:

```C
void i2c_init(void)
{
setPinInput(B6); // Try releasing special pins for a short time
setPinInput(B7);
chThdSleepMilliseconds(10); // Wait for the release to happen

palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function
palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B7 to I2C function
}
```
5 changes: 3 additions & 2 deletions docs/keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ This is a reference only. Each group of keys links to the page documenting their
|`KC_LOCKING_SCROLL` |`KC_LSCR` |Locking Scroll Lock |
|`KC_KP_COMMA` |`KC_PCMM` |Keypad `,` |
|`KC_KP_EQUAL_AS400` | |Keypad `=` on AS/400 keyboards |
|`KC_INT1` |`KC_RO` |JIS `\` and <code>&#124;</code> |
|`KC_INT1` |`KC_RO` |JIS `\` and `_` |
|`KC_INT2` |`KC_KANA` |JIS Katakana/Hiragana |
|`KC_INT3` |`KC_JYEN` |JIS `¥` |
|`KC_INT3` |`KC_JYEN` |JIS `¥` and <code>&#124;</code> |
|`KC_INT4` |`KC_HENK` |JIS Henkan |
|`KC_INT5` |`KC_MHEN` |JIS Muhenkan |
|`KC_INT6` | |JIS Numpad `,` |
Expand Down Expand Up @@ -459,6 +459,7 @@ This is a reference only. Each group of keys links to the page documenting their
|`SH_MOFF` |Momentarily turns off swap. |
|`SH_TG` |Toggles swap on and off with every key press. |
|`SH_TT` |Toggles with a tap; momentary when held. |

## [Unicode Support](feature_unicode.md)

|Key |Aliases| |
Expand Down
4 changes: 2 additions & 2 deletions docs/keycodes_basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07

|Key |Aliases |Description |
|----------|---------|-------------------------------|
|`KC_INT1` |`KC_RO` |JIS `\` and <code>&#124;</code>|
|`KC_INT1` |`KC_RO` |JIS `\` and `_` |
|`KC_INT2` |`KC_KANA`|JIS Katakana/Hiragana |
|`KC_INT3` |`KC_JYEN`|JIS `¥` |
|`KC_INT3` |`KC_JYEN`|JIS `¥` and <code>&#124;</code>|
|`KC_INT4` |`KC_HENK`|JIS Henkan |
|`KC_INT5` |`KC_MHEN`|JIS Muhenkan |
|`KC_INT6` | |JIS Numpad `,` |
Expand Down
Loading

0 comments on commit 2d4420d

Please sign in to comment.