Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (26 commits)
  Fixed OS detection such that OSX doesn't take over the world (qmk#8248)
  [Keyboard] Add Prime_EXL Plus to handwired (qmk#8238)
  format code according to conventions [skip ci]
  New feature: PERMISSIVE_HOLD_PER_KEY (qmk#7994)
  Split - Avoid race condition during matrix_init_quantum (qmk#8235)
  Acheron VIA support (qmk#8204)
  `send_unicode_string()`: Add support for code points > 0xFFFF (qmk#8236)
  [Keyboard] Add Wete (qmk#8229)
  Improvements to extrakey HID descriptors (qmk#8156)
  Hineybush h87a lock indicators (qmk#8237)
  Add VIA support for Prime_L (qmk#8233)
  Hub16 - Bug removal + clean up code (qmk#8227)
  [Keyboard] ai03 Equinox (qmk#8224)
  [Keyboard] Add zfrontier/big_switch (qmk#8205)
  Gingham Update (qmk#8225)
  A proper `send_string()` for the Unicode feature (qmk#8155)
  Rollback PR qmk#7967 in preference of fixing I2C start/stop properly, in a followup PR. (qmk#8173)
  Add mouse support to SEND_STRING (qmk#8223)
  Add link to "Useful functions" in macro docs (qmk#7446)
  New functionality for cformat (qmk#7893)
  ...
  • Loading branch information
Luc Lebel committed Feb 27, 2020
2 parents 70a02ed + 4667bc5 commit 1362dc4
Show file tree
Hide file tree
Showing 116 changed files with 3,739 additions and 489 deletions.
26 changes: 24 additions & 2 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,36 @@ There are some limitations to the local CLI compared to the global CLI:

## `qmk cformat`

This command formats C code using clang-format. Run it with no arguments to format all core code, or pass filenames on the command line to run it on specific files.
This command formats C code using clang-format.

**Usage**:
Run it with no arguments to format all core code that has been changed. Default checks `origin/master` with `git diff`, branch can be changed using `-b <branch_name>`

Run it with `-a` to format all core code, or pass filenames on the command line to run it on specific files.

**Usage for specified files**:

```
qmk cformat [file1] [file2] [...] [fileN]
```

**Usage for all core files**:

```
qmk cformat -a
```

**Usage for only changed files against origin/master**:

```
qmk cformat
```

**Usage for only changed files against branch_name**:

```
qmk cformat -b branch_name
```

## `qmk compile`

This command allows you to compile firmware from any directory. You can compile JSON exports from <https://config.qmk.fm>, compile keymaps in the repo, or compile the keyboard in the current working directory.
Expand Down
2 changes: 2 additions & 0 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ If you define these options you will enable the associated feature, which may in
* `#define PERMISSIVE_HOLD`
* makes tap and hold keys trigger the hold if another key is pressed before releasing, even if it hasn't hit the `TAPPING_TERM`
* See [Permissive Hold](feature_advanced_keycodes.md#permissive-hold) for details
* `#define PERMISSIVE_HOLD_PER_KEY`
* enabled handling for per key `PERMISSIVE_HOLD` settings
* `#define IGNORE_MOD_TAP_INTERRUPT`
* makes it possible to do rolling combos (zx) with keys that convert to other keys on hold, by enforcing the `TAPPING_TERM` for both keys.
* See [Mod tap interrupt](feature_advanced_keycodes.md#ignore-mod-tap-interrupt) for details
Expand Down
19 changes: 19 additions & 0 deletions docs/feature_advanced_keycodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,25 @@ Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this wil

?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.

For more granular control of this feature, you can add the following to your `config.h`:

```c
#define PERMISSIVE_HOLD_PER_KEY
```

You can then add the following function to your keymap:

```c
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case SFT_T(KC_A):
return true;
default:
return false;
}
}
```
## Ignore Mod Tap Interrupt
To enable this setting, add this to your `config.h`:
Expand Down
2 changes: 2 additions & 0 deletions docs/feature_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ SEND_STRING(".."SS_TAP(X_END));

There are some functions you may find useful in macro-writing. Keep in mind that while you can write some fairly advanced code within a macro, if your functionality gets too complex you may want to define a custom keycode instead. Macros are meant to be simple.

?> You can also use the functions described in [Useful function](ref_functions.md) for additional functionality. For example `reset_keyboard()` allows you to reset the keyboard as part of a macro.

### `record->event.pressed`

This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is
Expand Down
21 changes: 16 additions & 5 deletions docs/feature_unicode.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,23 @@ By default, when the keyboard boots, it will initialize the input mode to the la

!> Using `UNICODE_SELECTED_MODES` means you don't have to initially set the input mode in `matrix_init_user()` (or a similar function); the Unicode system will do that for you on startup. This has the added benefit of avoiding unnecessary writes to EEPROM.
## `send_unicode_hex_string`
## `send_unicode_string()`
To type multiple characters for things like (ノಠ痊ಠ)ノ彡┻━┻, you can use `send_unicode_hex_string()` much like `SEND_STRING()` except you would use hex values separate by spaces.
For example, the table flip seen above would be `send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B")`
This function is much like `send_string()` but allows you to input UTF-8 characters directly, and supports all code points (provided the selected input method also supports it). Make sure your `keymap.c` is formatted in UTF-8 encoding.
There are many ways to get a hex code, but an easy one is [this site](https://r12a.github.io/app-conversion/). Just make sure to convert to hexadecimal, and that is your string.
```c
send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
```
## `send_unicode_hex_string()`
Similar to `send_unicode_string()`, but the characters are represented by their code point values in ASCII, separated by spaces. For example, the table flip above would be achieved with:
```c
send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
```
An easy way to convert your Unicode string to this format is by using [this site](https://r12a.github.io/app-conversion/), and taking the result in the "Hex/UTF-32" section.
## Additional Language Support
Expand Down Expand Up @@ -228,6 +239,6 @@ AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
If you enable the US International layout on the system, it will use punctuation to accent the characters.
For instance, typing "`a" will result in à.
For instance, typing "\`a" will result in à.
You can find details on how to enable this [here](https://support.microsoft.com/en-us/help/17424/windows-change-keyboard-layout).
63 changes: 12 additions & 51 deletions drivers/arm/i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <string.h>
#include <hal.h>

static uint8_t i2c_address;

static const I2CConfig i2cconfig = {
#ifdef USE_I2CV1
I2C1_OPMODE,
Expand Down Expand Up @@ -69,49 +71,27 @@ __attribute__((weak)) void i2c_init(void) {
}

i2c_status_t i2c_start(uint8_t address) {
#if I2C_USE_MUTUAL_EXCLUSION
i2cAcquireBus(&I2C_DRIVER);
#endif

i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig);
return I2C_STATUS_SUCCESS;
}

i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
#if I2C_USE_MUTUAL_EXCLUSION
i2cAcquireBus(&I2C_DRIVER);
#endif

i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (address >> 1), data, length, 0, 0, MS2ST(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
#endif

msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout));
return chibios_to_qmk(&status);
}

i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) {
#if I2C_USE_MUTUAL_EXCLUSION
i2cAcquireBus(&I2C_DRIVER);
#endif

i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (address >> 1), data, length, MS2ST(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
#endif

msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout));
return chibios_to_qmk(&status);
}

i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) {
#if I2C_USE_MUTUAL_EXCLUSION
i2cAcquireBus(&I2C_DRIVER);
#endif

i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig);

uint8_t complete_packet[length + 1];
Expand All @@ -120,34 +100,15 @@ i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data,
}
complete_packet[0] = regaddr;

msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
#endif

msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout));
return chibios_to_qmk(&status);
}

i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
#if I2C_USE_MUTUAL_EXCLUSION
i2cAcquireBus(&I2C_DRIVER);
#endif

i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (devaddr >> 1), &regaddr, 1, data, length, MS2ST(timeout));

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
#endif

msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, MS2ST(timeout));
return chibios_to_qmk(&status);
}

void i2c_stop(void) {
i2cStop(&I2C_DRIVER);

#if I2C_USE_MUTUAL_EXCLUSION
i2cReleaseBus(&I2C_DRIVER);
#endif
}
void i2c_stop(void) { i2cStop(&I2C_DRIVER); }
Loading

0 comments on commit 1362dc4

Please sign in to comment.