Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2cee371bf1 | ||
|
a7a647b7f6 | ||
|
16226274c9 | ||
|
cbb7e91851 | ||
|
c8577a9a73 | ||
|
f2d597d1d3 | ||
|
bbd4b5eb88 | ||
|
3309e91e0b | ||
|
e04e55c872 | ||
|
83de3dff01 | ||
|
6f50c7eba1 | ||
|
2ba54690e6 | ||
|
222380c636 | ||
|
9b3f397ab2 | ||
|
ecdf14bb62 | ||
|
642f6cf14f | ||
|
f3bdd436a3 | ||
|
d04485e32c |
@ -246,11 +246,21 @@ endif
|
||||
|
||||
ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L)
|
||||
COMMON_VPATH += $(DRIVER_PATH)/haptic
|
||||
SRC += haptic.c
|
||||
SRC += DRV2605L.c
|
||||
SRC += i2c_master.c
|
||||
OPT_DEFS += -DHAPTIC_ENABLE
|
||||
OPT_DEFS += -DDRV2605L
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(HAPTIC_ENABLE)), SOLENOID)
|
||||
COMMON_VPATH += $(DRIVER_PATH)/haptic
|
||||
SRC += haptic.c
|
||||
SRC += solenoid.c
|
||||
OPT_DEFS += -DHAPTIC_ENABLE
|
||||
OPT_DEFS += -DSOLENOID_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(HD44780_ENABLE)), yes)
|
||||
SRC += drivers/avr/hd44780.c
|
||||
OPT_DEFS += -DHD44780_ENABLE
|
||||
|
@ -146,7 +146,7 @@ Additionally, hitting keys five times in a short period will lock that key. This
|
||||
You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
|
||||
```c
|
||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */
|
||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */
|
||||
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
|
||||
```
|
||||
|
||||
|
@ -4,7 +4,11 @@ If you're using a 60% keyboard, or any other layout with no F-row, you will have
|
||||
|
||||
## Usage
|
||||
|
||||
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. When pressed it will behave like `KC_ESC`, but with Shift or GUI held it will send `KC_GRAVE`.
|
||||
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. Most of the time this key will output `KC_ESC` when pressed. However, when Shift or GUI are held down it will output `KC_GRV` instead.
|
||||
|
||||
## What Your OS Sees
|
||||
|
||||
If Mary presses GESC on her keyboard, the OS will see an KC_ESC character. Now if Mary holds Shift down and presses GESC it will output `~`, or a shifted backtick. Now if she holds GUI/CMD/WIN, it will output a simple <code>`</code> character.
|
||||
|
||||
## Keycodes
|
||||
|
||||
@ -12,6 +16,10 @@ Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) w
|
||||
|---------|-----------|------------------------------------------------------------------|
|
||||
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
||||
|
||||
### Caveats
|
||||
|
||||
* On macOS CMD/GUI + KC_GRV is actually mapped to a hot key so it will not output a backtick.
|
||||
|
||||
## Configuration
|
||||
|
||||
There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`:
|
||||
|
147
docs/feature_haptic_feedback.md
Normal file
147
docs/feature_haptic_feedback.md
Normal file
@ -0,0 +1,147 @@
|
||||
# Haptic Feedback
|
||||
|
||||
## Haptic feedback rules.mk options
|
||||
|
||||
The following options are currently available for haptic feedback in `rule.mk`:
|
||||
|
||||
`HAPTIC_ENABLE += DRV2605L`
|
||||
|
||||
`HAPTIC_ENABLE += SOLENOID`
|
||||
|
||||
## Known Supported Hardware
|
||||
|
||||
| Name | Description |
|
||||
|--------------------|-------------------------------------------------|
|
||||
| [LV061228B-L65-A](https://www.digikey.com/product-detail/en/jinlong-machinery-electronics-inc/LV061228B-L65-A/1670-1050-ND/7732325) | z-axis 2v LRA |
|
||||
| [Mini Motor Disc](https://www.adafruit.com/product/1201) | small 2-5v ERM |
|
||||
|
||||
## Haptic Keycodes
|
||||
|
||||
Not all keycodes below will work depending on which haptic mechanism you have chosen.
|
||||
|
||||
| Name | Description |
|
||||
|-----------|-------------------------------------------------------|
|
||||
|`HPT_ON` | Turn haptic feedback on |
|
||||
|`HPT_OFF` | Turn haptic feedback on |
|
||||
|`HPT_TOG` | Toggle haptic feedback on/off |
|
||||
|`HPT_RST` | Reset haptic feedback config to default |
|
||||
|`HPT_FBK` | Toggle feedback to occur on keypress, release or both |
|
||||
|`HPT_BUZ` | Toggle solenoid buzz on/off |
|
||||
|`HPT_MODI` | Go to next DRV2605L waveform |
|
||||
|`HPT_MODD` | Go to previous DRV2605L waveform |
|
||||
|`HPT_DWLI` | Increase Solenoid dwell time |
|
||||
|`HPT_DWLD` | Decrease Solenoid dwell time |
|
||||
|
||||
### Solenoids
|
||||
|
||||
First you will need a build a circuit to drive the solenoid through a mosfet as most MCU will not be able to provide the current needed to drive the coil in the solenoid.
|
||||
|
||||
[Wiring diagram provided by Adafruit](https://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf)
|
||||
|
||||
Select a pin that has PWM for the signal pin
|
||||
|
||||
```
|
||||
#define SOLENOID_PIN *pin*
|
||||
```
|
||||
|
||||
Beware that some pins may be powered during bootloader (ie. A13 on the STM32F303 chip) and will result in the solenoid kept in the on state through the whole flashing process. This may overheat and damage the solenoid. If you find that the pin the solenoid is connected to is triggering the solenoid during bootloader/DFU, select another pin.
|
||||
|
||||
### DRV2605L
|
||||
|
||||
DRV2605L is controlled over i2c protocol, and has to be connected to the SDA and SCL pins, these varies depending on the MCU in use.
|
||||
|
||||
#### Feedback motor setup
|
||||
|
||||
This driver supports 2 different feedback motors. Set the following in your `config.h` based on which motor you have selected.
|
||||
|
||||
##### ERM
|
||||
|
||||
Eccentric Rotating Mass vibration motors (ERM) is motor with a off-set weight attached so when drive signal is attached, the off-set weight spins and causes a sinusoidal wave that translate into vibrations.
|
||||
|
||||
```
|
||||
#define FB_ERM_LRA 0
|
||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||
|
||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||
#define RATED_VOLTAGE 3
|
||||
#define V_PEAK 5
|
||||
```
|
||||
##### LRA
|
||||
|
||||
Linear resonant actuators (LRA, also know as a linear vibrator) works different from a ERM. A LRA has a weight and magnet suspended by springs and a voice coil. When the drive signal is applied, the weight would be vibrate on a single axis (side to side or up and down). Since the weight is attached to a spring, there is a resonance effect at a specific frequency. This frequency is where the LRA will operate the most efficiently. Refer to the motor's datasheet for the recommanded range for this frequency.
|
||||
|
||||
```
|
||||
#define FB_ERM_LRA 1
|
||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||
|
||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||
#define RATED_VOLTAGE 2
|
||||
#define V_PEAK 2.8
|
||||
#define V_RMS 2.0
|
||||
#define V_PEAK 2.1
|
||||
#define F_LRA 205 /* resonance freq */
|
||||
```
|
||||
|
||||
#### DRV2605L waveform library
|
||||
|
||||
DRV2605L comes with preloaded library of various waveform sequences that can be called and played. If writing a macro, these waveforms can be played using `DRV_pulse(*sequence name or number*)`
|
||||
|
||||
List of waveform sequences from the datasheet:
|
||||
|
||||
|seq# | Sequence name |seq# | Sequence name |seq# |Sequence name |
|
||||
|-----|---------------------|-----|-----------------------------------|-----|--------------------------------------|
|
||||
| 1 | strong_click | 43 | lg_dblclick_med_60 | 85 | transition_rampup_med_smooth2 |
|
||||
| 2 | strong_click_60 | 44 | lg_dblsharp_tick | 86 | transition_rampup_short_smooth1 |
|
||||
| 3 | strong_click_30 | 45 | lg_dblsharp_tick_80 | 87 | transition_rampup_short_smooth2 |
|
||||
| 4 | sharp_click | 46 | lg_dblsharp_tick_60 | 88 | transition_rampup_long_sharp1 |
|
||||
| 5 | sharp_click_60 | 47 | buzz | 89 | transition_rampup_long_sharp2 |
|
||||
| 6 | sharp_click_30 | 48 | buzz_80 | 90 | transition_rampup_med_sharp1 |
|
||||
| 7 | soft_bump | 49 | buzz_60 | 91 | transition_rampup_med_sharp2 |
|
||||
| 8 | soft_bump_60 | 50 | buzz_40 | 92 | transition_rampup_short_sharp1 |
|
||||
| 9 | soft_bump_30 | 51 | buzz_20 | 93 | transition_rampup_short_sharp2 |
|
||||
| 10 | dbl_click | 52 | pulsing_strong | 94 | transition_rampdown_long_smooth1_50 |
|
||||
| 11 | dbl_click_60 | 53 | pulsing_strong_80 | 95 | transition_rampdown_long_smooth2_50 |
|
||||
| 12 | trp_click | 54 | pulsing_medium | 96 | transition_rampdown_med_smooth1_50 |
|
||||
| 13 | soft_fuzz | 55 | pulsing_medium_80 | 97 | transition_rampdown_med_smooth2_50 |
|
||||
| 14 | strong_buzz | 56 | pulsing_sharp | 98 | transition_rampdown_short_smooth1_50 |
|
||||
| 15 | alert_750ms | 57 | pulsing_sharp_80 | 99 | transition_rampdown_short_smooth2_50 |
|
||||
| 16 | alert_1000ms | 58 | transition_click | 100 | transition_rampdown_long_sharp1_50 |
|
||||
| 17 | strong_click1 | 59 | transition_click_80 | 101 | transition_rampdown_long_sharp2_50 |
|
||||
| 18 | strong_click2_80 | 60 | transition_click_60 | 102 | transition_rampdown_med_sharp1_50 |
|
||||
| 19 | strong_click3_60 | 61 | transition_click_40 | 103 | transition_rampdown_med_sharp2_50 |
|
||||
| 20 | strong_click4_30 | 62 | transition_click_20 | 104 | transition_rampdown_short_sharp1_50 |
|
||||
| 21 | medium_click1 | 63 | transition_click_10 | 105 | transition_rampdown_short_sharp2_50 |
|
||||
| 22 | medium_click2_80 | 64 | transition_hum | 106 | transition_rampup_long_smooth1_50 |
|
||||
| 23 | medium_click3_60 | 65 | transition_hum_80 | 107 | transition_rampup_long_smooth2_50 |
|
||||
| 24 | sharp_tick1 | 66 | transition_hum_60 | 108 | transition_rampup_med_smooth1_50 |
|
||||
| 25 | sharp_tick2_80 | 67 | transition_hum_40 | 109 | transition_rampup_med_smooth2_50 |
|
||||
| 26 | sharp_tick3_60 | 68 | transition_hum_20 | 110 | transition_rampup_short_smooth1_50 |
|
||||
| 27 | sh_dblclick_str | 69 | transition_hum_10 | 111 | transition_rampup_short_smooth2_50 |
|
||||
| 28 | sh_dblclick_str_80 | 70 | transition_rampdown_long_smooth1 | 112 | transition_rampup_long_sharp1_50 |
|
||||
| 29 | sh_dblclick_str_60 | 71 | transition_rampdown_long_smooth2 | 113 | transition_rampup_long_sharp2_50 |
|
||||
| 30 | sh_dblclick_str_30 | 72 | transition_rampdown_med_smooth1 | 114 | transition_rampup_med_sharp1_50 |
|
||||
| 31 | sh_dblclick_med | 73 | transition_rampdown_med_smooth2 | 115 | transition_rampup_med_sharp2_50 |
|
||||
| 32 | sh_dblclick_med_80 | 74 | transition_rampdown_short_smooth1 | 116 | transition_rampup_short_sharp1_50 |
|
||||
| 33 | sh_dblclick_med_60 | 75 | transition_rampdown_short_smooth2 | 117 | transition_rampup_short_sharp2_50 |
|
||||
| 34 | sh_dblsharp_tick | 76 | transition_rampdown_long_sharp1 | 118 | long_buzz_for_programmatic_stopping |
|
||||
| 35 | sh_dblsharp_tick_80 | 77 | transition_rampdown_long_sharp2 | 119 | smooth_hum1_50 |
|
||||
| 36 | sh_dblsharp_tick_60 | 78 | transition_rampdown_med_sharp1 | 120 | smooth_hum2_40 |
|
||||
| 37 | lg_dblclick_str | 79 | transition_rampdown_med_sharp2 | 121 | smooth_hum3_30 |
|
||||
| 38 | lg_dblclick_str_80 | 80 | transition_rampdown_short_sharp1 | 122 | smooth_hum4_20 |
|
||||
| 39 | lg_dblclick_str_60 | 81 | transition_rampdown_short_sharp2 | 123 | smooth_hum5_10 |
|
||||
| 40 | lg_dblclick_str_30 | 82 | transition_rampup_long_smooth1 | | |
|
||||
| 41 | lg_dblclick_med | 83 | transition_rampup_long_smooth2 | | |
|
||||
| 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | |
|
||||
### Optional DRV2605L defines
|
||||
|
||||
```
|
||||
#define DRV_GREETING *sequence name or number*
|
||||
```
|
||||
If haptic feedback is enabled, the keyboard will vibrate to a specific sqeuence during startup. That can be selected using the following define:
|
||||
|
||||
```
|
||||
#define DRV_MODE_DEFAULT *sequence name or number*
|
||||
```
|
||||
This will set what sequence HPT_RST will set as the active mode. If not defined, mode will be set to 1 when HPT_RST is pressed.
|
@ -148,37 +148,43 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
||||
|
||||
If you need to change your RGB lighting in code, for example in a macro to change the color whenever you switch layers, QMK provides a set of functions to assist you. See [`rgblight.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h) for the full list, but the most commonly used functions include:
|
||||
|
||||
|Function |Description |
|
||||
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
||||
|`rgblight_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
||||
|`rgblight_disable()` |Turn LEDs off |
|
||||
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
||||
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
||||
|`rgblight_setrgb(r, g, b)` |Set all LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_at(r, g, b, led)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||
|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
|
||||
|`rgblight_sethsv_noeeprom(h, s, v)`|Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
||||
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
||||
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
||||
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
||||
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
||||
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
||||
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
||||
|Function |Description |
|
||||
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
||||
|`rgblight_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
||||
|`rgblight_disable()` |Turn LEDs off |
|
||||
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
||||
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
||||
|`rgblight_setrgb(r, g, b)` |Set all LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_at(r, g, b, led)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||
|`rgblight_setrgb_range(r, g, b, start, end)`|Set a continuous range of LEDs to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_setrgb_master(r, g, b)` |Set the LEDs on the master side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_slave(r, g, b)` |Set the LEDs on the slave side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
|
||||
|`rgblight_sethsv_noeeprom(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_sethsv_range(h, s, v, start, end)`|Set a continuous range of LEDs to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_sethsv_master(h, s, v)` |Set the LEDs on the master side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_slave(h, s, v)` |Set the LEDs on the slave side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
||||
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
||||
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
||||
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
||||
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
||||
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
||||
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
||||
|
||||
Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
|
||||
|
||||
|
101
drivers/avr/apa102.c
Executable file
101
drivers/avr/apa102.c
Executable file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* APA102 lib V1.0a
|
||||
*
|
||||
* Controls APA102 RGB-LEDs
|
||||
* Author: Mikkel (Duckle29 on github)
|
||||
*
|
||||
* Dec 22th, 2017 v1.0a Initial Version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "apa102.h"
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "debug.h"
|
||||
|
||||
// Setleds for standard RGB
|
||||
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds){
|
||||
apa102_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF));
|
||||
}
|
||||
|
||||
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK){
|
||||
pinMode(RGB_DI_PIN, PinDirectionOutput);
|
||||
pinMode(RGB_CLK_PIN, PinDirectionOutput);
|
||||
|
||||
apa102_send_array((uint8_t*)ledarray,leds)
|
||||
}
|
||||
|
||||
void apa102_send_array(uint8_t *data, uint16_t leds){ // Data is struct of 3 bytes. RGB - leds is number of leds in data
|
||||
apa102_start_frame();
|
||||
while(leds--){
|
||||
apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r);
|
||||
data++;
|
||||
}
|
||||
apa102_end_frame(leds);
|
||||
}
|
||||
|
||||
void apa102_send_frame(uint32_t frame){
|
||||
for(uint32_t i=0xFF; i>0;){
|
||||
apa102_send_byte(frame & i);
|
||||
i = i << 8;
|
||||
}
|
||||
}
|
||||
|
||||
void apa102_start_frame(){
|
||||
apa102_send_frame(0);
|
||||
}
|
||||
|
||||
void apa102_end_frame(uint16_t leds)
|
||||
{
|
||||
// This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h
|
||||
// and adapted. The code is MIT licensed. I think thats compatible?
|
||||
|
||||
// We need to send some more bytes to ensure that all the LEDs in the
|
||||
// chain see their new color and start displaying it.
|
||||
//
|
||||
// The data stream seen by the last LED in the chain will be delayed by
|
||||
// (count - 1) clock edges, because each LED before it inverts the clock
|
||||
// line and delays the data by one clock edge. Therefore, to make sure
|
||||
// the last LED actually receives the data we wrote, the number of extra
|
||||
// edges we send at the end of the frame must be at least (count - 1).
|
||||
// For the APA102C, that is sufficient.
|
||||
//
|
||||
// The SK9822 only updates after it sees 32 zero bits followed by one more
|
||||
// rising edge. To avoid having the update time depend on the color of
|
||||
// the last LED, we send a dummy 0xFF byte. (Unfortunately, this means
|
||||
// that partial updates of the beginning of an LED strip are not possible;
|
||||
// the LED after the last one you are trying to update will be black.)
|
||||
// After that, to ensure that the last LED in the chain sees 32 zero bits
|
||||
// and a rising edge, we need to send at least 65 + (count - 1) edges. It
|
||||
// is sufficent and simpler to just send (5 + count/16) bytes of zeros.
|
||||
//
|
||||
// We are ignoring the specification for the end frame in the APA102/SK9822
|
||||
// datasheets because it does not actually ensure that all the LEDs will
|
||||
// start displaying their new colors right away.
|
||||
|
||||
apa102_send_byte(0xFF);
|
||||
for (uint16_t i = 0; i < 5 + leds / 16; i++){
|
||||
apa102_send_byte(0);
|
||||
}
|
||||
}
|
||||
|
||||
void apa102_send_byte(uint8_t byte){
|
||||
uint8_t i;
|
||||
for (i = 0; i < 8; i++){
|
||||
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
|
||||
digitalWrite(RGB_CLK_PIN, PinLevelHigh);
|
||||
}
|
||||
}
|
46
drivers/avr/apa102.h
Executable file
46
drivers/avr/apa102.h
Executable file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* light weight WS2812 lib include
|
||||
*
|
||||
* Version 2.3 - Nev 29th 2015
|
||||
* Author: Tim (cpldcpu@gmail.com)
|
||||
*
|
||||
* Please do not change this file! All configuration is handled in "ws2812_config.h"
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "rgblight_types.h"
|
||||
|
||||
|
||||
/* User Interface
|
||||
*
|
||||
* Input:
|
||||
* ledarray: An array of GRB data describing the LED colors
|
||||
* number_of_leds: The number of LEDs to write
|
||||
* pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0)
|
||||
*
|
||||
* The functions will perform the following actions:
|
||||
* - Set the data-out pin as output
|
||||
* - Send out the LED data
|
||||
* - Wait 50<EFBFBD>s to reset the LEDs
|
||||
*/
|
||||
|
||||
void apa102_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
|
||||
void apa102_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
|
||||
void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
|
@ -21,7 +21,7 @@
|
||||
#include <math.h>
|
||||
|
||||
|
||||
uint8_t DRV2605L_transfer_buffer[20];
|
||||
uint8_t DRV2605L_transfer_buffer[2];
|
||||
uint8_t DRV2605L_tx_register[0];
|
||||
uint8_t DRV2605L_read_buffer[0];
|
||||
uint8_t DRV2605L_read_register;
|
||||
@ -34,6 +34,11 @@ void DRV_write(uint8_t drv_register, uint8_t settings) {
|
||||
}
|
||||
|
||||
uint8_t DRV_read(uint8_t regaddress) {
|
||||
#ifdef __AVR__
|
||||
i2c_readReg(DRV2605L_BASE_ADDRESS << 1,
|
||||
regaddress, DRV2605L_read_buffer, 1, 100);
|
||||
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
|
||||
#else
|
||||
DRV2605L_tx_register[0] = regaddress;
|
||||
if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1,
|
||||
DRV2605L_tx_register, 1,
|
||||
@ -42,14 +47,13 @@ uint8_t DRV_read(uint8_t regaddress) {
|
||||
printf("err reading reg \n");
|
||||
}
|
||||
DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
|
||||
#endif
|
||||
return DRV2605L_read_register;
|
||||
}
|
||||
|
||||
void DRV_init(void)
|
||||
{
|
||||
i2c_init();
|
||||
i2c_start(DRV2605L_BASE_ADDRESS);
|
||||
|
||||
/* 0x07 sets DRV2605 into calibration mode */
|
||||
DRV_write(DRV_MODE,0x07);
|
||||
|
||||
@ -104,21 +108,17 @@ void DRV_init(void)
|
||||
C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME;
|
||||
DRV_write(DRV_CTRL_4, (uint8_t) C4_SET.Byte);
|
||||
DRV_write(DRV_LIB_SELECTION,LIB_SELECTION);
|
||||
//start autocalibration
|
||||
|
||||
DRV_write(DRV_GO, 0x01);
|
||||
|
||||
/* 0x00 sets DRV2605 out of standby and to use internal trigger
|
||||
* 0x01 sets DRV2605 out of standby and to use external trigger */
|
||||
DRV_write(DRV_MODE,0x00);
|
||||
|
||||
/* 0x06: LRA library */
|
||||
DRV_write(DRV_WAVEFORM_SEQ_1, 0x01);
|
||||
|
||||
/* 0xB9: LRA, 4x brake factor, medium gain, 7.5x back EMF
|
||||
* 0x39: ERM, 4x brake factor, medium gain, 1.365x back EMF */
|
||||
|
||||
/* TODO: setup auto-calibration as part of initiation */
|
||||
|
||||
//Play greeting sequence
|
||||
DRV_write(DRV_GO, 0x00);
|
||||
DRV_write(DRV_WAVEFORM_SEQ_1, DRV_GREETING);
|
||||
DRV_write(DRV_GO, 0x01);
|
||||
}
|
||||
|
||||
void DRV_pulse(uint8_t sequence)
|
||||
|
@ -31,13 +31,6 @@
|
||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||
#endif
|
||||
|
||||
#ifndef RATED_VOLTAGE
|
||||
#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
||||
#ifndef V_PEAK
|
||||
#define V_PEAK 2.8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* LRA specific settings */
|
||||
#if FB_ERM_LRA == 1
|
||||
#ifndef V_RMS
|
||||
@ -49,6 +42,16 @@
|
||||
#ifndef F_LRA
|
||||
#define F_LRA 205
|
||||
#endif
|
||||
#ifndef RATED_VOLTAGE
|
||||
#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RATED_VOLTAGE
|
||||
#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
||||
#endif
|
||||
#ifndef V_PEAK
|
||||
#define V_PEAK 2.8
|
||||
#endif
|
||||
|
||||
/* Library Selection */
|
||||
@ -60,6 +63,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DRV_GREETING
|
||||
#define DRV_GREETING alert_750ms
|
||||
#endif
|
||||
#ifndef DRV_MODE_DEFAULT
|
||||
#define DRV_MODE_DEFAULT strong_click1
|
||||
#endif
|
||||
|
||||
/* Control 1 register settings */
|
||||
#ifndef DRIVE_TIME
|
||||
#define DRIVE_TIME 25
|
||||
@ -162,7 +172,6 @@ void DRV_write(const uint8_t drv_register, const uint8_t settings);
|
||||
uint8_t DRV_read(const uint8_t regaddress);
|
||||
void DRV_pulse(const uint8_t sequence);
|
||||
|
||||
|
||||
typedef enum DRV_EFFECT{
|
||||
clear_sequence = 0,
|
||||
strong_click = 1,
|
||||
@ -288,6 +297,7 @@ typedef enum DRV_EFFECT{
|
||||
smooth_hum3_30 = 121,
|
||||
smooth_hum4_20 = 122,
|
||||
smooth_hum5_10 = 123,
|
||||
drv_effect_max = 124,
|
||||
} DRV_EFFECT;
|
||||
|
||||
/* Register bit array unions */
|
||||
|
248
drivers/haptic/haptic.c
Normal file
248
drivers/haptic/haptic.c
Normal file
@ -0,0 +1,248 @@
|
||||
/* Copyright 2019 ishtob
|
||||
* Driver for haptic feedback written for QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "haptic.h"
|
||||
#include "eeconfig.h"
|
||||
#include "progmem.h"
|
||||
#include "debug.h"
|
||||
#ifdef DRV2605L
|
||||
#include "DRV2605L.h"
|
||||
#endif
|
||||
#ifdef SOLENOID_ENABLE
|
||||
#include "solenoid.h"
|
||||
#endif
|
||||
|
||||
haptic_config_t haptic_config;
|
||||
|
||||
void haptic_init(void) {
|
||||
debug_enable = 1; //Debug is ON!
|
||||
if (!eeconfig_is_enabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
haptic_config.raw = eeconfig_read_haptic();
|
||||
if (haptic_config.mode < 1){
|
||||
haptic_config.mode = 1;
|
||||
}
|
||||
if (!haptic_config.mode){
|
||||
dprintf("No haptic config found in eeprom, setting default configs\n");
|
||||
haptic_reset();
|
||||
}
|
||||
#ifdef SOLENOID_ENABLE
|
||||
solenoid_setup();
|
||||
dprintf("Solenoid driver initialized\n");
|
||||
#endif
|
||||
#ifdef DRV2605L
|
||||
DRV_init();
|
||||
dprintf("DRV2605 driver initialized\n");
|
||||
#endif
|
||||
eeconfig_debug_haptic();
|
||||
}
|
||||
|
||||
void haptic_task(void) {
|
||||
#ifdef SOLENOID_ENABLE
|
||||
solenoid_check();
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeconfig_debug_haptic(void) {
|
||||
dprintf("haptic_config eprom\n");
|
||||
dprintf("haptic_config.enable = %d\n", haptic_config.enable);
|
||||
dprintf("haptic_config.mode = %d\n", haptic_config.mode);
|
||||
}
|
||||
|
||||
void haptic_enable(void) {
|
||||
haptic_config.enable = 1;
|
||||
xprintf("haptic_config.enable = %u\n", haptic_config.enable);
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
}
|
||||
|
||||
void haptic_disable(void) {
|
||||
haptic_config.enable = 0;
|
||||
xprintf("haptic_config.enable = %u\n", haptic_config.enable);
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
}
|
||||
|
||||
void haptic_toggle(void) {
|
||||
if (haptic_config.enable) {
|
||||
haptic_disable();
|
||||
} else {
|
||||
haptic_enable();
|
||||
}
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
}
|
||||
|
||||
void haptic_feedback_toggle(void){
|
||||
haptic_config.feedback++;
|
||||
if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX)
|
||||
haptic_config.feedback = KEY_PRESS;
|
||||
xprintf("haptic_config.feedback = %u\n", !haptic_config.feedback);
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
}
|
||||
|
||||
void haptic_buzz_toggle(void) {
|
||||
bool buzz_stat = !haptic_config.buzz;
|
||||
haptic_config.buzz = buzz_stat;
|
||||
haptic_set_buzz(buzz_stat);
|
||||
}
|
||||
|
||||
void haptic_mode_increase(void) {
|
||||
uint8_t mode = haptic_config.mode + 1;
|
||||
#ifdef DRV2605L
|
||||
if (haptic_config.mode >= drv_effect_max) {
|
||||
mode = 1;
|
||||
}
|
||||
#endif
|
||||
haptic_set_mode(mode);
|
||||
}
|
||||
|
||||
void haptic_mode_decrease(void) {
|
||||
uint8_t mode = haptic_config.mode -1;
|
||||
#ifdef DRV2605L
|
||||
if (haptic_config.mode < 1) {
|
||||
mode = (drv_effect_max - 1);
|
||||
}
|
||||
#endif
|
||||
haptic_set_mode(mode);
|
||||
}
|
||||
|
||||
void haptic_dwell_increase(void) {
|
||||
uint8_t dwell = haptic_config.dwell + 1;
|
||||
#ifdef SOLENOID_ENABLE
|
||||
if (haptic_config.dwell >= SOLENOID_MAX_DWELL) {
|
||||
dwell = 1;
|
||||
}
|
||||
solenoid_set_dwell(dwell);
|
||||
#endif
|
||||
haptic_set_dwell(dwell);
|
||||
}
|
||||
|
||||
void haptic_dwell_decrease(void) {
|
||||
uint8_t dwell = haptic_config.dwell -1;
|
||||
#ifdef SOLENOID_ENABLE
|
||||
if (haptic_config.dwell < SOLENOID_MIN_DWELL) {
|
||||
dwell = SOLENOID_MAX_DWELL;
|
||||
}
|
||||
solenoid_set_dwell(dwell);
|
||||
#endif
|
||||
haptic_set_dwell(dwell);
|
||||
}
|
||||
|
||||
void haptic_reset(void){
|
||||
haptic_config.enable = true;
|
||||
uint8_t feedback = HAPTIC_FEEDBACK_DEFAULT;
|
||||
haptic_config.feedback = feedback;
|
||||
#ifdef DRV2605L
|
||||
uint8_t mode = HAPTIC_MODE_DEFAULT;
|
||||
haptic_config.mode = mode;
|
||||
#endif
|
||||
#ifdef SOLENOID_ENABLE
|
||||
uint8_t dwell = SOLENOID_DEFAULT_DWELL;
|
||||
haptic_config.dwell = dwell;
|
||||
#endif
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
|
||||
xprintf("haptic_config.mode = %u\n", haptic_config.mode);
|
||||
}
|
||||
|
||||
void haptic_set_feedback(uint8_t feedback) {
|
||||
haptic_config.feedback = feedback;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
|
||||
}
|
||||
|
||||
void haptic_set_mode(uint8_t mode) {
|
||||
haptic_config.mode = mode;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.mode = %u\n", haptic_config.mode);
|
||||
}
|
||||
|
||||
void haptic_set_buzz(uint8_t buzz) {
|
||||
haptic_config.buzz = buzz;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.buzz = %u\n", haptic_config.buzz);
|
||||
}
|
||||
|
||||
void haptic_set_dwell(uint8_t dwell) {
|
||||
haptic_config.dwell = dwell;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.dwell = %u\n", haptic_config.dwell);
|
||||
}
|
||||
|
||||
uint8_t haptic_get_mode(void) {
|
||||
if (!haptic_config.enable){
|
||||
return false;
|
||||
}
|
||||
return haptic_config.mode;
|
||||
}
|
||||
|
||||
uint8_t haptic_get_feedback(void) {
|
||||
if (!haptic_config.enable){
|
||||
return false;
|
||||
}
|
||||
return haptic_config.feedback;
|
||||
}
|
||||
|
||||
uint8_t haptic_get_dwell(void) {
|
||||
if (!haptic_config.enable){
|
||||
return false;
|
||||
}
|
||||
return haptic_config.dwell;
|
||||
}
|
||||
|
||||
void haptic_play(void) {
|
||||
#ifdef DRV2605L
|
||||
uint8_t play_eff = 0;
|
||||
play_eff = haptic_config.mode;
|
||||
DRV_pulse(play_eff);
|
||||
#endif
|
||||
#ifdef SOLENOID_ENABLE
|
||||
solenoid_fire();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == HPT_ON && record->event.pressed) { haptic_enable(); }
|
||||
if (keycode == HPT_OFF && record->event.pressed) { haptic_disable(); }
|
||||
if (keycode == HPT_TOG && record->event.pressed) { haptic_toggle(); }
|
||||
if (keycode == HPT_RST && record->event.pressed) { haptic_reset(); }
|
||||
if (keycode == HPT_FBK && record->event.pressed) { haptic_feedback_toggle(); }
|
||||
if (keycode == HPT_BUZ && record->event.pressed) { haptic_buzz_toggle(); }
|
||||
if (keycode == HPT_MODI && record->event.pressed) { haptic_mode_increase(); }
|
||||
if (keycode == HPT_MODD && record->event.pressed) { haptic_mode_decrease(); }
|
||||
if (keycode == HPT_DWLI && record->event.pressed) { haptic_dwell_increase(); }
|
||||
if (keycode == HPT_DWLD && record->event.pressed) { haptic_dwell_decrease(); }
|
||||
if (haptic_config.enable) {
|
||||
if ( record->event.pressed ) {
|
||||
// keypress
|
||||
if (haptic_config.feedback < 2) {
|
||||
haptic_play();
|
||||
}
|
||||
} else {
|
||||
//keyrelease
|
||||
if (haptic_config.feedback > 0) {
|
||||
haptic_play();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void haptic_shutdown(void) {
|
||||
#ifdef SOLENOID_ENABLE
|
||||
solenoid_shutdown();
|
||||
#endif
|
||||
|
||||
}
|
82
drivers/haptic/haptic.h
Normal file
82
drivers/haptic/haptic.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* Copyright 2019 ishtob
|
||||
* Driver for haptic feedback written for QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "quantum.h"
|
||||
#ifdef DRV2605L
|
||||
#include "DRV2605L.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAPTIC_FEEDBACK_DEFAULT
|
||||
#define HAPTIC_FEEDBACK_DEFAULT 0
|
||||
#endif
|
||||
#ifndef HAPTIC_MODE_DEFAULT
|
||||
#define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
|
||||
#endif
|
||||
|
||||
/* EEPROM config settings */
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool enable :1;
|
||||
uint8_t feedback :2;
|
||||
uint8_t mode :7;
|
||||
bool buzz :1;
|
||||
uint8_t dwell :7;
|
||||
uint16_t reserved :16;
|
||||
};
|
||||
} haptic_config_t;
|
||||
|
||||
typedef enum HAPTIC_FEEDBACK{
|
||||
KEY_PRESS,
|
||||
KEY_PRESS_RELEASE,
|
||||
KEY_RELEASE,
|
||||
HAPTIC_FEEDBACK_MAX,
|
||||
} HAPTIC_FEEDBACK;
|
||||
|
||||
bool process_haptic(uint16_t keycode, keyrecord_t *record);
|
||||
void haptic_init(void);
|
||||
void haptic_task(void);
|
||||
void eeconfig_debug_haptic(void);
|
||||
void haptic_enable(void);
|
||||
void haptic_disable(void);
|
||||
void haptic_toggle(void);
|
||||
void haptic_feedback_toggle(void);
|
||||
void haptic_mode_increase(void);
|
||||
void haptic_mode_decrease(void);
|
||||
void haptic_mode(uint8_t mode);
|
||||
void haptic_reset(void);
|
||||
void haptic_set_feedback(uint8_t feedback);
|
||||
void haptic_set_mode(uint8_t mode);
|
||||
void haptic_set_dwell(uint8_t dwell);
|
||||
void haptic_set_buzz(uint8_t buzz);
|
||||
void haptic_buzz_toggle(void);
|
||||
uint8_t haptic_get_mode(void);
|
||||
uint8_t haptic_get_feedback(void);
|
||||
void haptic_dwell_increase(void);
|
||||
void haptic_dwell_decrease(void);
|
||||
|
||||
void haptic_play(void);
|
||||
void haptic_shutdown(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
109
drivers/haptic/solenoid.c
Normal file
109
drivers/haptic/solenoid.c
Normal file
@ -0,0 +1,109 @@
|
||||
/* Copyright 2018 mtdjr - modified by ishtob
|
||||
* Driver for solenoid written for QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <timer.h>
|
||||
#include "solenoid.h"
|
||||
#include "haptic.h"
|
||||
|
||||
bool solenoid_on = false;
|
||||
bool solenoid_buzzing = false;
|
||||
uint16_t solenoid_start = 0;
|
||||
uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
|
||||
|
||||
extern haptic_config_t haptic_config;
|
||||
|
||||
|
||||
void solenoid_buzz_on(void) {
|
||||
haptic_set_buzz(1);
|
||||
}
|
||||
|
||||
void solenoid_buzz_off(void) {
|
||||
haptic_set_buzz(0);
|
||||
}
|
||||
|
||||
void solenoid_set_buzz(int buzz) {
|
||||
haptic_set_buzz(buzz);
|
||||
}
|
||||
|
||||
|
||||
void solenoid_dwell_minus(uint8_t solenoid_dwell) {
|
||||
if (solenoid_dwell > 0) solenoid_dwell--;
|
||||
}
|
||||
|
||||
void solenoid_dwell_plus(uint8_t solenoid_dwell) {
|
||||
if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++;
|
||||
}
|
||||
|
||||
void solenoid_set_dwell(uint8_t dwell) {
|
||||
solenoid_dwell = dwell;
|
||||
}
|
||||
|
||||
void solenoid_stop(void) {
|
||||
writePinLow(SOLENOID_PIN);
|
||||
solenoid_on = false;
|
||||
solenoid_buzzing = false;
|
||||
}
|
||||
|
||||
void solenoid_fire(void) {
|
||||
if (!haptic_config.buzz && solenoid_on) return;
|
||||
if (haptic_config.buzz && solenoid_buzzing) return;
|
||||
|
||||
solenoid_on = true;
|
||||
solenoid_buzzing = true;
|
||||
solenoid_start = timer_read();
|
||||
writePinHigh(SOLENOID_PIN);
|
||||
}
|
||||
|
||||
void solenoid_check(void) {
|
||||
uint16_t elapsed = 0;
|
||||
|
||||
if (!solenoid_on) return;
|
||||
|
||||
elapsed = timer_elapsed(solenoid_start);
|
||||
|
||||
//Check if it's time to finish this solenoid click cycle
|
||||
if (elapsed > solenoid_dwell) {
|
||||
solenoid_stop();
|
||||
return;
|
||||
}
|
||||
|
||||
//Check whether to buzz the solenoid on and off
|
||||
if (haptic_config.buzz) {
|
||||
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
|
||||
if (!solenoid_buzzing) {
|
||||
solenoid_buzzing = true;
|
||||
writePinHigh(SOLENOID_PIN);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (solenoid_buzzing) {
|
||||
solenoid_buzzing = false;
|
||||
writePinLow(SOLENOID_PIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void solenoid_setup(void) {
|
||||
setPinOutput(SOLENOID_PIN);
|
||||
solenoid_fire();
|
||||
}
|
||||
|
||||
void solenoid_shutdown(void) {
|
||||
writePinLow(SOLENOID_PIN);
|
||||
|
||||
}
|
54
drivers/haptic/solenoid.h
Normal file
54
drivers/haptic/solenoid.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* Copyright 2018 mtdjr - modified by ishtob
|
||||
* Driver for solenoid written for QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef SOLENOID_DEFAULT_DWELL
|
||||
#define SOLENOID_DEFAULT_DWELL 12
|
||||
#endif
|
||||
|
||||
#ifndef SOLENOID_MAX_DWELL
|
||||
#define SOLENOID_MAX_DWELL 100
|
||||
#endif
|
||||
|
||||
#ifndef SOLENOID_MIN_DWELL
|
||||
#define SOLENOID_MIN_DWELL 4
|
||||
#endif
|
||||
|
||||
#ifndef SOLENOID_ACTIVE
|
||||
#define SOLENOID_ACTIVE false
|
||||
#endif
|
||||
|
||||
#ifndef SOLENOID_PIN
|
||||
#define SOLENOID_PIN F6
|
||||
#endif
|
||||
|
||||
void solenoid_buzz_on(void);
|
||||
void solenoid_buzz_off(void);
|
||||
void solenoid_set_buzz(int buzz);
|
||||
|
||||
void solenoid_dwell_minus(uint8_t solenoid_dwell);
|
||||
void solenoid_dwell_plus(uint8_t solenoid_dwell);
|
||||
void solenoid_set_dwell(uint8_t dwell);
|
||||
|
||||
void solenoid_stop(void);
|
||||
void solenoid_fire(void);
|
||||
|
||||
void solenoid_check(void);
|
||||
|
||||
void solenoid_setup(void);
|
||||
void solenoid_shutdown(void);
|
@ -46,3 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#undef PRODUCT
|
||||
#define PRODUCT "Vee's hotswappable Helidox/Corne/CRKBD split keeb"
|
||||
|
||||
#define NO_ACTION_MACRO
|
||||
#define NO_ACTION_FUNCTION
|
||||
|
@ -100,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
//,-----------------------------------------. ,-----------------------------------------.
|
||||
RST, LRST, XXXXX, XXXXX, XXXXX, ERST, MNXT, MPRV, MFFD, MRWD, XXXXX, EJCT,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
LTOG, LHUI, LSAI, LVAI, PGUP, HOME, LEFT, DOWN, UP, RIGHT, XXXXX, XXXXX,\
|
||||
LTOG, LHUI, LSAI, LVAI, PGUP, HOME, LEFT, DOWN, UP, RIGHT, XXXXX, INS,\
|
||||
//|------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||
LMOD, LHUD, LSAD, LVAD, PGDN, END, BRID, BRIU, VOLD, VOLU, MUTE, MPLY,\
|
||||
//|------+------+------+------+------+------+------| |------+------+------+------+------+------+------|
|
||||
|
@ -3,13 +3,14 @@
|
||||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
EXTRAFLAGS += -flto
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
|
@ -192,4 +192,7 @@
|
||||
//#define DRIVER_LED_TOTAL RGBLED_NUM
|
||||
|
||||
//#define RGB_MATRIX_KEYPRESSES
|
||||
|
||||
#define SOLENOID_PIN A14
|
||||
|
||||
#endif
|
||||
|
@ -190,8 +190,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
RESET, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, _______, \
|
||||
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG\
|
||||
|
@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = LAYOUT_wrapper(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
_______, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST, _______, _______, _______, _______, _______, _______, \
|
||||
RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, MAGIC_TOGGLE_NKRO, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
|
||||
|
@ -52,6 +52,6 @@ NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
CUSTOM_MATRIX = yes # Custom matrix file
|
||||
AUDIO_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
HAPTIC_ENABLE = DRV2605L
|
||||
HAPTIC_ENABLE += DRV2605L
|
||||
QWIIC_ENABLE += MICRO_OLED
|
||||
# SERIAL_LINK_ENABLE = yes
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "qwiic.h"
|
||||
#include "action_layer.h"
|
||||
#include "matrix.h"
|
||||
#include "DRV2605L.h"
|
||||
#include "haptic.h"
|
||||
|
||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
||||
|
||||
@ -167,20 +167,12 @@ void encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
#endif
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
#ifdef DRV2605L
|
||||
DRV_init();
|
||||
#endif
|
||||
queue_for_send = true;
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
|
||||
if (queue_for_send) {
|
||||
#ifdef DRV2605L
|
||||
DRV_EFFECT play_eff = strong_click;
|
||||
DRV_pulse(play_eff);
|
||||
#endif
|
||||
#ifdef QWIIC_MICRO_OLED_ENABLE
|
||||
read_host_led_state();
|
||||
draw_ui();
|
||||
|
@ -10,4 +10,4 @@
|
||||
![Edulpn Keymap for the KBD75 PCB Mac Mode](https://i.imgur.com/t7oTjjc.png)
|
||||
|
||||
## Build
|
||||
To build the default keymap, simply run `make kbd75/rev2:edulpn`.
|
||||
To build the default keymap, simply run `make kbdfans/kbd75/rev2:edulpn`.
|
||||
|
@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
|
||||
[MAC_LAYER] = LAYOUT(
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, TG(MAC_LAYER), KC_DEL,
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, TG(WINDOWS_LAYER), KC_DEL,
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_HOME,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END,
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
|
||||
|
1
keyboards/planck/keymaps/oeywil/.gitignore
vendored
Normal file
1
keyboards/planck/keymaps/oeywil/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
secret.h
|
38
keyboards/planck/keymaps/oeywil/config.h
Normal file
38
keyboards/planck/keymaps/oeywil/config.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#define STARTUP_SONG SONG(PLANCK_SOUND)
|
||||
// #define STARTUP_SONG SONG(NO_SOUND)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
|
||||
#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 2
|
||||
|
||||
// Most tactile encoders have detents every 4 stages
|
||||
#define ENCODER_RESOLUTION 4
|
||||
|
||||
#endif
|
196
keyboards/planck/keymaps/oeywil/keymap.c
Normal file
196
keyboards/planck/keymaps/oeywil/keymap.c
Normal file
@ -0,0 +1,196 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "secret.h"
|
||||
|
||||
enum planck_layers {
|
||||
_DEFAULT,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_FUNCTION,
|
||||
_GAME,
|
||||
_GAMERAISE
|
||||
};
|
||||
|
||||
#define LOWER MO(_LOWER)
|
||||
#define RAISE MO(_RAISE)
|
||||
#define FUNCTION MO(_FUNCTION)
|
||||
#define GAMER MO(_GAMERAISE)
|
||||
|
||||
#define NO_OE KC_SCLN
|
||||
#define NO_AE KC_QUOT
|
||||
#define NO_AA KC_LBRC
|
||||
#define NO_EXCL LSFT(KC_1)
|
||||
#define NO_QEST LSFT(KC_MINS)
|
||||
#define NO_APOS KC_BSLS
|
||||
#define NO_QUOT LSFT(KC_2)
|
||||
#define NO_UMLA KC_RBRC
|
||||
#define NO_HASH LSFT(KC_3)
|
||||
#define NO_FSLS LSFT(KC_7)
|
||||
#define NO_LPAR LSFT(KC_8)
|
||||
#define NO_RPAR LSFT(KC_9)
|
||||
#define NO_ALFA ALGR(KC_2)
|
||||
#define NO_AMPE LSFT(KC_6)
|
||||
#define NO_USDO ALGR(KC_4)
|
||||
#define NO_PERC LSFT(KC_5)
|
||||
#define NO_BSLS KC_EQL
|
||||
#define NO_ASTE LSFT(KC_BSLS)
|
||||
#define NO_LBRA ALGR(KC_7)
|
||||
#define NO_RBRA ALGR(KC_0)
|
||||
#define NO_LBRC ALGR(KC_8)
|
||||
#define NO_RBRC ALGR(KC_9)
|
||||
#define NO_ANBR KC_NUBS
|
||||
#define NO_DASH KC_SLSH
|
||||
#define NO_PLUS KC_MINS
|
||||
#define NO_EQUA LSFT(KC_0)
|
||||
|
||||
#define TSKMGR LCTL(LSFT(KC_ESC))
|
||||
#define STEAM LSFT(KC_F7)
|
||||
#define WKILL LALT(KC_F4)
|
||||
#define BWORD LCTL(KC_LEFT)
|
||||
#define FWORD LCTL(KC_RIGHT)
|
||||
|
||||
float onsong[][2] = SONG(MARIO_MUSHROOM);
|
||||
float offsong[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
||||
|
||||
enum custom_keycodes {
|
||||
PWD = SAFE_RANGE,
|
||||
MAIL,
|
||||
GAMEON,
|
||||
GAMEOFF
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case PWD:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(pwd_str);
|
||||
}
|
||||
break;
|
||||
case MAIL:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(mail_str);
|
||||
}
|
||||
break;
|
||||
case GAMEON:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(onsong);
|
||||
#endif
|
||||
layer_on(_GAME);
|
||||
}
|
||||
break;
|
||||
case GAMEOFF:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(offsong);
|
||||
#endif
|
||||
layer_off(_GAME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Default
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | BkSp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | S | D | F | G | H | J | K | L | Ø | Æ |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | , | . | Å | Shift|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Win | Alt | Lower| Space | Enter | Raise| AltGr| Game | Fn |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_DEFAULT] = LAYOUT_planck_grid(
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
|
||||
KC_GESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, NO_OE, NO_AE,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, NO_AA, KC_RSFT,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, LOWER, KC_NO, KC_SPC, KC_NO, KC_ENT, RAISE, KC_RALT, GAMEON, FUNCTION
|
||||
),
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | <Word| Up | Word>| PgUp | | | | F7 | F8 | F9 | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | BkSp | Left | Down | Right| PgDn | | | | F4 | F5 | F6 | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Home | | End | | | | | F1 | F2 | F3 | Shift|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Win | Alt | Lower| Space | Enter | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = LAYOUT_planck_grid(
|
||||
KC_TRNS, BWORD, KC_UP, FWORD, KC_PGUP, KC_NO, KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_DEL,
|
||||
KC_BSPC, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_F4, KC_F5, KC_F6, KC_NO,
|
||||
KC_TRNS, KC_HOME, KC_NO, KC_END, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO
|
||||
),
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | ! | ? | ' | " | ¨ | | / | 7 | 8 | 9 | Ins |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | BkSp | @ | & | # | $ | % | <> | \ | 4 | 5 | 6 | * |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| ( | ) | { | } | [ | ] | 0 | 1 | 2 | 3 | Shift|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Win | Alt | | Space | Enter | Raise| - | + | = |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = LAYOUT_planck_grid(
|
||||
KC_TRNS, NO_EXCL, NO_QEST, NO_APOS, NO_QUOT, NO_UMLA, KC_NO, NO_FSLS, KC_7, KC_8, KC_9, KC_INS,
|
||||
KC_BSPC, NO_ALFA, NO_AMPE, NO_HASH, NO_USDO, NO_PERC, NO_ANBR, NO_BSLS, KC_4, KC_5, KC_6, NO_ASTE,
|
||||
KC_TRNS, NO_LPAR, NO_RPAR, NO_LBRA, NO_RBRA, NO_LBRC, NO_RBRC, KC_0, KC_1, KC_2, KC_3, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, NO_DASH, NO_PLUS, NO_EQUA
|
||||
),
|
||||
/* Function
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | |TskMgr| | | | | Pwd | Vol+ |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Reset| | | | | | | | Wkill| | | Vol- |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | Mail | | | | VolM |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | Play/Pause | Next | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_FUNCTION] = LAYOUT_planck_grid(
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TSKMGR, KC_NO, KC_NO, KC_NO, KC_NO, PWD, KC_VOLU,
|
||||
RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, WKILL, KC_NO, KC_NO, KC_VOLD,
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, MAIL, KC_NO, KC_NO, KC_NO, KC_MUTE,
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MPLY, KC_NO, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO
|
||||
),
|
||||
/* Game
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | BkSp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | S | D | F | G | H | J | K | L | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | | Alt | Raise| Space | Enter | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_GAME] = LAYOUT_planck_grid(
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_NO,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||
KC_LCTL, KC_NO, KC_LALT, GAMER, KC_NO, KC_SPC, KC_NO, KC_ENT, KC_NO, KC_NO, KC_NO, KC_NO
|
||||
),
|
||||
/* Game raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | 1 | 2 | 3 | 4 | 5 | | | | | | Vol+ |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | F1 | F2 | F3 | F4 | F5 | | | | | | Vol- |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| | | | | | | | | | | VolM |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | | Alt | | Space | Enter | | | Def | Steam|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_GAMERAISE] = LAYOUT_planck_grid(
|
||||
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU,
|
||||
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD,
|
||||
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MUTE,
|
||||
KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_TRNS, KC_NO, KC_NO, GAMEOFF, STEAM
|
||||
)
|
||||
};
|
9
keyboards/planck/keymaps/oeywil/readme.md
Normal file
9
keyboards/planck/keymaps/oeywil/readme.md
Normal file
@ -0,0 +1,9 @@
|
||||
About
|
||||
------
|
||||
|
||||
A simple Norwegian Layout.
|
||||
|
||||
Layout
|
||||
-------
|
||||
|
||||
![Layout](https://i.imgur.com/GQ4iM6B.png "Keyboard Layout")
|
9
keyboards/planck/keymaps/oeywil/rules.mk
Normal file
9
keyboards/planck/keymaps/oeywil/rules.mk
Normal file
@ -0,0 +1,9 @@
|
||||
SRC += muse.c
|
||||
|
||||
# Build Options
|
||||
AUDIO_ENABLE = yes
|
||||
CONSOLE_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
|
||||
DEFAULT_FOLDER = planck/rev6
|
431
keyboards/planck/keymaps/samuel/README.org
Normal file
431
keyboards/planck/keymaps/samuel/README.org
Normal file
File diff suppressed because it is too large
Load Diff
1
keyboards/planck/keymaps/samuel/config.h
Normal file
1
keyboards/planck/keymaps/samuel/config.h
Normal file
@ -0,0 +1 @@
|
||||
#define TAPPING_TERM 250
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user