Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
e05b32d894 | |||
0e96068d23 | |||
42bf60751e | |||
fd19795879 | |||
f069e9fc09 | |||
63a0b1241d | |||
75c9747787 | |||
2df3799e3d | |||
ea96c4b787 | |||
7f65323e10 | |||
3642a82d37 | |||
c7d0262be7 | |||
de4a47f1cc | |||
beb4a12c9d | |||
59000f491f | |||
44c5be0a3e | |||
f34299efd7 | |||
911b8915cc | |||
7a5a2591eb | |||
7142b60405 | |||
095b88bca5 | |||
46c49ae4e6 | |||
e5aa28455e | |||
6f5f943bb9 | |||
7d8dea30a4 | |||
37c2996137 | |||
54503168c9 | |||
23186d32a3 | |||
12cdcd5e10 | |||
86d59f1034 | |||
c427023b31 | |||
2493eecc7b | |||
bb3569dce3 | |||
b364a40e60 | |||
d137fdea78 | |||
ab48ffd5c5 | |||
32b2486c6b | |||
55432d0d91 | |||
59af2cbe64 | |||
7c1bb9decf | |||
140c08e521 | |||
a9c1a5a873 | |||
3b4b54f6ed | |||
9c280089aa | |||
38a0a6a092 | |||
8294a0de2c | |||
65c4b6cff1 | |||
9508b3f333 | |||
6c871408df |
12
.vscode/settings.json
vendored
12
.vscode/settings.json
vendored
@ -8,10 +8,12 @@
|
||||
"**/*.hex": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.h": "c",
|
||||
"*.c": "c",
|
||||
"*.cpp": "cpp",
|
||||
"*.hpp": "cpp",
|
||||
"xstddef": "c"
|
||||
"*.h": "c",
|
||||
"*.c": "c",
|
||||
"*.cpp": "cpp",
|
||||
"*.hpp": "cpp",
|
||||
"xstddef": "c",
|
||||
"type_traits": "c",
|
||||
"utility": "c"
|
||||
}
|
||||
}
|
||||
|
13
Makefile
13
Makefile
@ -371,6 +371,9 @@ define PARSE_KEYBOARD
|
||||
# The same if all was specified
|
||||
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
|
||||
$$(eval $$(call PARSE_ALL_KEYMAPS))
|
||||
# List all keymaps for the given keyboard
|
||||
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,list-keymaps),true)
|
||||
$$(eval $$(call LIST_ALL_KEYMAPS))
|
||||
# Try to match the specified keyamp with the list of known keymaps
|
||||
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
|
||||
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
|
||||
@ -407,6 +410,16 @@ endef
|
||||
# endif
|
||||
# endef
|
||||
|
||||
# Prints a list of all known keymaps for the given keyboard
|
||||
define LIST_ALL_KEYMAPS
|
||||
COMMAND_true_LIST_KEYMAPS := \
|
||||
printf "$$(KEYMAPS)\n";
|
||||
COMMAND_false_LIST_KEYMAPS := \
|
||||
printf "$$(MSG_AVAILABLE_KEYMAPS)\n"; \
|
||||
printf "$$(KEYMAPS)\n";
|
||||
COMMANDS += LIST_KEYMAPS
|
||||
endef
|
||||
|
||||
# $1 Keymap
|
||||
# This is the meat of compiling a keyboard, when entering this, everything is known
|
||||
# keyboard, subproject, and keymap
|
||||
|
@ -19,12 +19,14 @@
|
||||
#
|
||||
# Sets the bootloader defined in the keyboard's/keymap's rules.mk
|
||||
# Current options:
|
||||
# atmel-dfu
|
||||
# lufa-dfu
|
||||
# qmk-dfu
|
||||
# halfkay
|
||||
# caterina
|
||||
# bootloadHID
|
||||
#
|
||||
# halfkay PJRC Teensy
|
||||
# caterina Pro Micro (Sparkfun/generic)
|
||||
# atmel-dfu Atmel factory DFU
|
||||
# lufa-dfu LUFA DFU
|
||||
# qmk-dfu QMK DFU (LUFA + blinkenlight)
|
||||
# bootloadHID HIDBootFlash compatible (ATmega32A)
|
||||
# USBasp USBaspLoader (ATmega328P)
|
||||
#
|
||||
# BOOTLOADER_SIZE can still be defined manually, but it's recommended
|
||||
# you add any possible configuration to this list
|
||||
@ -32,40 +34,40 @@
|
||||
ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
|
||||
OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
|
||||
OPT_DEFS += -DBOOTLOADER_DFU
|
||||
ifeq ($(strip $(MCU)), atmega32u4)
|
||||
BOOTLOADER_SIZE = 4096
|
||||
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
|
||||
BOOTLOADER_SIZE = 4096
|
||||
endif
|
||||
ifeq ($(strip $(MCU)), at90usb1286)
|
||||
BOOTLOADER_SIZE = 8192
|
||||
BOOTLOADER_SIZE = 8192
|
||||
endif
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
|
||||
OPT_DEFS += -DBOOTLOADER_LUFA_DFU
|
||||
OPT_DEFS += -DBOOTLOADER_DFU
|
||||
ifeq ($(strip $(MCU)), atmega32u4)
|
||||
BOOTLOADER_SIZE = 4096
|
||||
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
|
||||
BOOTLOADER_SIZE = 4096
|
||||
endif
|
||||
ifeq ($(strip $(MCU)), at90usb1286)
|
||||
BOOTLOADER_SIZE = 8192
|
||||
BOOTLOADER_SIZE = 8192
|
||||
endif
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
|
||||
OPT_DEFS += -DBOOTLOADER_QMK_DFU
|
||||
OPT_DEFS += -DBOOTLOADER_DFU
|
||||
ifeq ($(strip $(MCU)), atmega32u4)
|
||||
BOOTLOADER_SIZE = 4096
|
||||
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
|
||||
BOOTLOADER_SIZE = 4096
|
||||
endif
|
||||
ifeq ($(strip $(MCU)), at90usb1286)
|
||||
BOOTLOADER_SIZE = 8192
|
||||
BOOTLOADER_SIZE = 8192
|
||||
endif
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), halfkay)
|
||||
OPT_DEFS += -DBOOTLOADER_HALFKAY
|
||||
ifeq ($(strip $(MCU)), atmega32u4)
|
||||
BOOTLOADER_SIZE = 512
|
||||
BOOTLOADER_SIZE = 512
|
||||
endif
|
||||
ifeq ($(strip $(MCU)), at90usb1286)
|
||||
BOOTLOADER_SIZE = 1024
|
||||
BOOTLOADER_SIZE = 1024
|
||||
endif
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), caterina)
|
||||
|
@ -14,7 +14,7 @@ The next Breaking Change is scheduled for Nov 29.
|
||||
|
||||
### Important Dates
|
||||
|
||||
* [ ] 2019 Oct 04 - `future` is created. It will be rebased weekly.
|
||||
* [x] 2019 Sep 21 - `future` is created. It will be rebased weekly.
|
||||
* [ ] 2019 Nov 01 - `future` closed to new PR's.
|
||||
* [ ] 2019 Nov 01 - Call for testers.
|
||||
* [ ] 2019 Nov 27 - `master` is locked, no PR's merged.
|
||||
@ -51,7 +51,9 @@ git rebase master
|
||||
git push --force
|
||||
```
|
||||
|
||||
## 8 Weeks Before Merge
|
||||
## Creating the `future` branch
|
||||
|
||||
This happens immediately after the previous `future` branch is merged.
|
||||
|
||||
* `qmk_firmware` git commands
|
||||
* [ ] `git checkout master`
|
||||
@ -65,9 +67,6 @@ git push --force
|
||||
* [ ] `git tag <next_version>` # Prevent the breakpoint tag from confusing version incrementing
|
||||
* [ ] `git push origin future`
|
||||
* [ ] `git push --tags`
|
||||
* GitHub Actions
|
||||
* [ ] Switch all [breaking_change PR's](https://github.com/qmk/qmk_firmware/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+label%3Abreaking_change) to `future`
|
||||
* [ ] Any that have a ChangeLog entry may be merged immediately.
|
||||
|
||||
## 4 Weeks Before Merge
|
||||
|
||||
|
@ -8,10 +8,14 @@ We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have
|
||||
|
||||
## Installation
|
||||
|
||||
Place your keyboard into the bootloader mode, either by hitting the `RESET` keycode (which may be on a different layer), or by pressing the reset switch usually located on the underside of the board. If your keyboard has neither, try holding Escape, or Space+`B`, as you plug it in (see the [Bootmagic](feature_bootmagic.md) docs for more details).
|
||||
Some keyboards may have specific instructions for entering the bootloader, for example the [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite) key (Escape) might be on a different key, such as Left Control. Refer to the board's README if you are unsure.
|
||||
Put your keyboard into bootloader mode, either by hitting the `RESET` keycode (which may be on a different layer), or by pressing the reset switch that's usually located on the underside of the board. If your keyboard has neither, try holding Escape or Space+`B` as you plug it in (see the [Bootmagic](feature_bootmagic.md) docs for more details). Some boards use [Command](feature_command.md) instead of Bootmagic; in this case, you can enter bootloader mode by hitting Left Shift+Right Shift+`B` or Left Shift+Right Shift+Escape at any point while the keyboard is plugged in.
|
||||
Some keyboards may have specific instructions for entering the bootloader. For example, the [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite) key (default: Escape) might be on a different key, e.g. Left Control; or the magic combination for Command (default: Left Shift+Right Shift) might require you to hold something else, e.g. Left Control+Right Control. Refer to the board's README file if you are unsure.
|
||||
|
||||
To put a device in bootloader mode with USBaspLoader, tap the `RESET` button while holding down the `BOOT` button.
|
||||
Alternatively, hold `BOOT` while inserting the USB cable.
|
||||
|
||||
Zadig will automatically detect the bootloader device. You may sometimes need to check **Options → List All Devices**.
|
||||
|
||||
Zadig will automatically detect the bootloader device. You may sometimes need to check **Options -> List All Devices**.
|
||||
- For keyboards with Atmel AVR MCUs, the bootloader will be named something similar to `ATm32U4DFU`, and have a Vendor ID of `03EB`.
|
||||
- USBasp bootloaders will appear as `USBasp`, with a VID/PID of `16C0:05DC`.
|
||||
- AVR keyboards flashed with the QMK-DFU bootloader will be named `<keyboard name> Bootloader` and will also have the VID `03EB`.
|
||||
@ -19,7 +23,7 @@ Zadig will automatically detect the bootloader device. You may sometimes need to
|
||||
|
||||
!> If Zadig lists one or more devices with the `HidUsb` driver, your keyboard is probably not in bootloader mode. The arrow will be colored orange and you will be asked to confirm modifying a system driver. **Do not** proceed if this is the case!
|
||||
|
||||
If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list.
|
||||
If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list. For flashing a USBaspLoader device via command line with msys2, the `libusbk` driver is recommended, otherwise `libusb-win32` will work fine if you are using QMK Toolbox for flashing.
|
||||
|
||||

|
||||
|
||||
@ -39,4 +43,4 @@ Right-click it and hit **Uninstall device**. Make sure to tick **Delete the driv
|
||||
|
||||

|
||||
|
||||
Click **Action -> Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again!
|
||||
Click **Action → Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again!
|
||||
|
@ -32,16 +32,18 @@ This feature is distinct from both the [RGB underglow](feature_rgblight.md) and
|
||||
|
||||
Hardware PWM is supported according to the following table:
|
||||
|
||||
|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|
|
||||
|-------------|-------------|-------------|-------------|---------|
|
||||
|`B5` |Timer 1 |Timer 1 | | |
|
||||
|`B6` |Timer 1 |Timer 1 | | |
|
||||
|`B7` |Timer 1 |Timer 1 |Timer 1 | |
|
||||
|`C4` |Timer 3 | | | |
|
||||
|`C5` |Timer 3 | |Timer 1 | |
|
||||
|`C6` |Timer 3 |Timer 3 |Timer 1 | |
|
||||
|`D4` | | | |Timer 1 |
|
||||
|`D5` | | | |Timer 1 |
|
||||
|Backlight Pin|AT90USB64/128|ATmega16/32U4|ATmega16/32U2|ATmega32A|ATmega328P|
|
||||
|-------------|-------------|-------------|-------------|---------|----------|
|
||||
|`B1` | | | | |Timer 1 |
|
||||
|`B2` | | | | |Timer 1 |
|
||||
|`B5` |Timer 1 |Timer 1 | | | |
|
||||
|`B6` |Timer 1 |Timer 1 | | | |
|
||||
|`B7` |Timer 1 |Timer 1 |Timer 1 | | |
|
||||
|`C4` |Timer 3 | | | | |
|
||||
|`C5` |Timer 3 | |Timer 1 | | |
|
||||
|`C6` |Timer 3 |Timer 3 |Timer 1 | | |
|
||||
|`D4` | | | |Timer 1 | |
|
||||
|`D5` | | | |Timer 1 | |
|
||||
|
||||
All other pins will use software PWM. If the [Audio](feature_audio.md) feature is disabled or only using one timer, the backlight PWM can be triggered by a hardware timer:
|
||||
|
||||
@ -119,7 +121,8 @@ The breathing effect is the same as in the hardware PWM implementation.
|
||||
|`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 |
|
||||
|`backlight_level(x)` |Sets the backlight level, from 0 to |
|
||||
| |`BACKLIGHT_LEVELS` |
|
||||
|`get_backlight_level()` |Return the current backlight level |
|
||||
|`is_backlight_enabled()`|Return whether the backlight is currently on |
|
||||
|
||||
|
@ -29,6 +29,9 @@ Not all keycodes below will work depending on which haptic mechanism you have ch
|
||||
|`HPT_BUZ` | Toggle solenoid buzz on/off |
|
||||
|`HPT_MODI` | Go to next DRV2605L waveform |
|
||||
|`HPT_MODD` | Go to previous DRV2605L waveform |
|
||||
|`HPT_CONT` | Toggle continuous haptic mode on/off |
|
||||
|`HPT_CONI` | Increase DRV2605L continous haptic strength |
|
||||
|`HPT_COND` | Decrease DRV2605L continous haptic strength |
|
||||
|`HPT_DWLI` | Increase Solenoid dwell time |
|
||||
|`HPT_DWLD` | Decrease Solenoid dwell time |
|
||||
|
||||
@ -145,3 +148,7 @@ If haptic feedback is enabled, the keyboard will vibrate to a specific sqeuence
|
||||
#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.
|
||||
|
||||
### DRV2605L Continuous Haptic Mode
|
||||
|
||||
This mode sets continuous haptic feedback with the option to increase or decrease strength.
|
@ -30,7 +30,9 @@ Next, you will want to define some tap-dance keys, which is easiest to do with t
|
||||
After this, you'll want to use the `tap_dance_actions` array to specify what actions shall be taken when a tap-dance key is in action. Currently, there are five possible options:
|
||||
|
||||
* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
|
||||
* `ACTION_TAP_DANCE_DUAL_ROLE(kc, layer)`: Sends the `kc` keycode when tapped once, or moves to `layer`. (this functions like the `TO` layer keycode).
|
||||
* `ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)`: Sends the `kc` keycode when tapped once, or moves to `layer`. (this functions like the `TO` layer keycode).
|
||||
* This is the same as `ACTION_TAP_DANCE_DUAL_ROLE`, but renamed to something that is clearer about its functionality. Both names will work.
|
||||
* `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: Sends the `kc` keycode when tapped once, or toggles the state of `layer`. (this functions like the `TG` layer keycode).
|
||||
* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
|
||||
* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
|
||||
* `ACTION_TAP_DANCE_FN_ADVANCED_TIME(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn, tap_specific_tapping_term)`: This functions identically to the `ACTION_TAP_DANCE_FN_ADVANCED` function, but uses a custom tapping term for it, instead of the predefined `TAPPING_TERM`.
|
||||
|
@ -10,11 +10,17 @@ Atmel's DFU bootloader comes on all atmega32u4 chips by default, and is used by
|
||||
|
||||
To ensure compatibility with the DFU bootloader, make sure this block is present your `rules.mk` (optionally with `lufa-dfu` or `qmk-dfu` instead):
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = atmel-dfu
|
||||
```make
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = atmel-dfu
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
@ -64,11 +70,17 @@ Arduino boards and their clones use the [Caterina bootloader](https://github.com
|
||||
|
||||
To ensure compatibility with the Caterina bootloader, make sure this block is present your `rules.mk`:
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = caterina
|
||||
```make
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = caterina
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
@ -100,11 +112,17 @@ Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on al
|
||||
|
||||
To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`:
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = halfkay
|
||||
```make
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = halfkay
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
@ -125,11 +143,17 @@ USBasploader is a bootloader developed by matrixstorm. It is used in some non-US
|
||||
|
||||
To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`:
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = USBasp
|
||||
```make
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = USBasp
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
@ -150,11 +174,17 @@ BootloadHID is a USB bootloader for AVR microcontrollers. The uploader tool requ
|
||||
|
||||
To ensure compatibility with the bootloadHID bootloader, make sure this block is present your `rules.mk`:
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = bootloadHID
|
||||
```make
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = bootloadHID
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
|
@ -114,6 +114,17 @@ void DRV_init(void) {
|
||||
DRV_write(DRV_GO, 0x01);
|
||||
}
|
||||
|
||||
void DRV_rtp_init(void) {
|
||||
DRV_write(DRV_GO, 0x00);
|
||||
DRV_write(DRV_RTP_INPUT, 20); //20 is the lowest value I've found where haptics can still be felt.
|
||||
DRV_write(DRV_MODE, 0x05);
|
||||
DRV_write(DRV_GO, 0x01);
|
||||
}
|
||||
|
||||
void DRV_amplitude(uint8_t amplitude) {
|
||||
DRV_write(DRV_RTP_INPUT, amplitude);
|
||||
}
|
||||
|
||||
void DRV_pulse(uint8_t sequence) {
|
||||
DRV_write(DRV_GO, 0x00);
|
||||
DRV_write(DRV_WAVEFORM_SEQ_1, sequence);
|
||||
|
@ -170,6 +170,8 @@
|
||||
void DRV_init(void);
|
||||
void DRV_write(const uint8_t drv_register, const uint8_t settings);
|
||||
uint8_t DRV_read(const uint8_t regaddress);
|
||||
void DRV_rtp_init(void);
|
||||
void DRV_amplitude(const uint8_t amplitude);
|
||||
void DRV_pulse(const uint8_t sequence);
|
||||
|
||||
typedef enum DRV_EFFECT {
|
||||
|
@ -168,6 +168,15 @@ void haptic_set_mode(uint8_t mode) {
|
||||
xprintf("haptic_config.mode = %u\n", haptic_config.mode);
|
||||
}
|
||||
|
||||
void haptic_set_amplitude(uint8_t amp) {
|
||||
haptic_config.amplitude = amp;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
|
||||
#ifdef DRV2605L
|
||||
DRV_amplitude(amp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void haptic_set_buzz(uint8_t buzz) {
|
||||
haptic_config.buzz = buzz;
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
@ -201,6 +210,53 @@ uint8_t haptic_get_dwell(void) {
|
||||
return haptic_config.dwell;
|
||||
}
|
||||
|
||||
void haptic_enable_continuous(void) {
|
||||
haptic_config.cont = 1;
|
||||
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
#ifdef DRV2605L
|
||||
DRV_rtp_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void haptic_disable_continuous(void) {
|
||||
haptic_config.cont = 0;
|
||||
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
#ifdef DRV2605L
|
||||
DRV_write(DRV_MODE,0x00);
|
||||
#endif
|
||||
}
|
||||
|
||||
void haptic_toggle_continuous(void) {
|
||||
#ifdef DRV2605L
|
||||
if (haptic_config.cont) {
|
||||
haptic_disable_continuous();
|
||||
} else {
|
||||
haptic_enable_continuous();
|
||||
}
|
||||
eeconfig_update_haptic(haptic_config.raw);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void haptic_cont_increase(void) {
|
||||
uint8_t amp = haptic_config.amplitude + 10;
|
||||
if (haptic_config.amplitude >= 120) {
|
||||
amp = 120;
|
||||
}
|
||||
haptic_set_amplitude(amp);
|
||||
}
|
||||
|
||||
void haptic_cont_decrease(void) {
|
||||
uint8_t amp = haptic_config.amplitude - 10;
|
||||
if (haptic_config.amplitude < 20) {
|
||||
amp = 20;
|
||||
}
|
||||
haptic_set_amplitude(amp);
|
||||
}
|
||||
|
||||
|
||||
void haptic_play(void) {
|
||||
#ifdef DRV2605L
|
||||
uint8_t play_eff = 0;
|
||||
@ -213,6 +269,7 @@ void haptic_play(void) {
|
||||
}
|
||||
|
||||
bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (keycode == HPT_ON && record->event.pressed) {
|
||||
haptic_enable();
|
||||
}
|
||||
@ -243,6 +300,16 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == HPT_DWLD && record->event.pressed) {
|
||||
haptic_dwell_decrease();
|
||||
}
|
||||
if (keycode == HPT_CONT && record->event.pressed) {
|
||||
haptic_toggle_continuous();
|
||||
}
|
||||
if (keycode == HPT_CONI && record->event.pressed) {
|
||||
haptic_cont_increase();
|
||||
}
|
||||
if (keycode == HPT_COND && record->event.pressed) {
|
||||
haptic_cont_decrease();
|
||||
}
|
||||
|
||||
if (haptic_config.enable) {
|
||||
if (record->event.pressed) {
|
||||
// keypress
|
||||
|
@ -34,12 +34,14 @@
|
||||
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;
|
||||
bool enable :1;
|
||||
uint8_t feedback :2;
|
||||
uint8_t mode :7;
|
||||
bool buzz :1;
|
||||
uint8_t dwell :7;
|
||||
bool cont :1;
|
||||
uint8_t amplitude :8;
|
||||
uint16_t reserved :7;
|
||||
};
|
||||
} haptic_config_t;
|
||||
|
||||
@ -71,6 +73,9 @@ uint8_t haptic_get_mode(void);
|
||||
uint8_t haptic_get_feedback(void);
|
||||
void haptic_dwell_increase(void);
|
||||
void haptic_dwell_decrease(void);
|
||||
void haptic_toggle_continuous(void);
|
||||
void haptic_cont_increase(void);
|
||||
void haptic_cont_decrease(void);
|
||||
|
||||
void haptic_play(void);
|
||||
void haptic_shutdown(void);
|
||||
|
@ -16,3 +16,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "1up60hte.h"
|
||||
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
setPinOutput(B6);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void led_set_kb(uint8_t usb_led) {
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
writePinLow(B6);
|
||||
} else {
|
||||
writePinHigh(B6);
|
||||
}
|
||||
led_set_user(usb_led);
|
||||
}
|
@ -31,22 +31,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
};
|
||||
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B6);
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
writePinLow(B6);
|
||||
} else {
|
||||
writePinHigh(B6);
|
||||
}
|
||||
}
|
||||
|
@ -31,22 +31,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
};
|
||||
|
||||
void matrix_init_user(void) {
|
||||
setPinOutput(B6);
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
writePinLow(B6);
|
||||
} else {
|
||||
writePinHigh(B6);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ A 60% PCB with USB C, RGB underglow, backlighting, hotswappable switches, and a
|
||||
|
||||
Keyboard Maintainer: [Bubnick](https://github.com/bubnick)
|
||||
Hardware Supported: 1up60hte 60% PCB
|
||||
|
||||
Hardware Availability: [1upkeyboards.com](https://www.1upkeyboards.com/shop/controllers/1up-rgb-60-pcb-hte/)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
@ -1,50 +1,12 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
@ -54,6 +16,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https:/
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
||||
EXTRAFLAGS += -flto
|
||||
|
||||
LAYOUTS = 60_hhkb
|
||||
|
@ -1,18 +1,16 @@
|
||||
# MCU name
|
||||
MCU = atmega32u2
|
||||
|
||||
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# atmega32a bootloadHID
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
|
@ -55,16 +55,16 @@
|
||||
|
||||
// TODO: refactor with new user EEPROM code (coming soon)
|
||||
#define EEPROM_MAGIC 0x451F
|
||||
#define EEPROM_MAGIC_ADDR 32
|
||||
#define EEPROM_MAGIC_ADDR 34
|
||||
// Bump this every time we change what we store
|
||||
// This will automatically reset the EEPROM with defaults
|
||||
// and avoid loading invalid data from the EEPROM
|
||||
#define EEPROM_VERSION 0x08
|
||||
#define EEPROM_VERSION_ADDR 34
|
||||
#define EEPROM_VERSION_ADDR 36
|
||||
|
||||
// Dynamic keymap starts after EEPROM version
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 35
|
||||
// Dynamic macro starts after dynamic keymaps (35+(4*12*9*2)) = (35+864)
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 899
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 125
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 37
|
||||
// Dynamic macro starts after dynamic keymaps (37+(4*12*9*2)) = (37+864)
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 901
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 123
|
||||
#define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
|
@ -55,17 +55,17 @@
|
||||
|
||||
// TODO: refactor with new user EEPROM code (coming soon)
|
||||
#define EEPROM_MAGIC 0x451F
|
||||
#define EEPROM_MAGIC_ADDR 32
|
||||
#define EEPROM_MAGIC_ADDR 34
|
||||
// Bump this every time we change what we store
|
||||
// This will automatically reset the EEPROM with defaults
|
||||
// and avoid loading invalid data from the EEPROM
|
||||
#define EEPROM_VERSION 0x08
|
||||
#define EEPROM_VERSION_ADDR 34
|
||||
#define EEPROM_VERSION_ADDR 36
|
||||
|
||||
// Dynamic keymap starts after EEPROM version
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 35
|
||||
// Dynamic macro starts after dynamic keymaps (35+(4*10*10*2)) = (35+800)
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 835
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 189
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 37
|
||||
// Dynamic macro starts after dynamic keymaps (37+(4*10*10*2)) = (37+800)
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 837
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 187
|
||||
#define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
|
||||
|
@ -250,17 +250,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// EEPROM usage
|
||||
|
||||
#define EEPROM_MAGIC 0x451F
|
||||
#define EEPROM_MAGIC_ADDR 32
|
||||
#define EEPROM_MAGIC_ADDR 34
|
||||
// Bump this every time we change what we store
|
||||
// This will automatically reset the EEPROM with defaults
|
||||
// and avoid loading invalid data from the EEPROM
|
||||
#define EEPROM_VERSION 0x08
|
||||
#define EEPROM_VERSION_ADDR 34
|
||||
#define EEPROM_VERSION_ADDR 36
|
||||
|
||||
// Dynamic keymap starts after EEPROM version
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 35
|
||||
#define DYNAMIC_KEYMAP_EEPROM_ADDR 37
|
||||
// DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR = DYNAMIC_KEYMAP_EEPROM_ADDR + (DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2)
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 635
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 637
|
||||
// DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE = 1024 - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 389
|
||||
#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 387
|
||||
#define DYNAMIC_KEYMAP_MACRO_COUNT 16
|
||||
|
@ -14,17 +14,24 @@ 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 "quantum.h"
|
||||
#include "alps64.h"
|
||||
|
||||
#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0)
|
||||
#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0)
|
||||
#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0)
|
||||
void keyboard_pre_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
setPinOutput(C5);
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void led_set_kb(uint8_t usb_led)
|
||||
{
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
// output high
|
||||
writePinHigh(C5);
|
||||
} else {
|
||||
// Hi-Z
|
||||
writePinLow(C5);
|
||||
}
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
LED_ON();
|
||||
_delay_ms(500);
|
||||
LED_OFF();
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ 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/>.
|
||||
*/
|
||||
#ifndef ALPS64_H
|
||||
#define ALPS64_H
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
@ -105,22 +104,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \
|
||||
{ KC_NO, K71, K72, K73, K74, K75, K76, K77 } \
|
||||
}
|
||||
|
||||
#define LAYOUT_kc( \
|
||||
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \
|
||||
K34, K35, K44, K45, K54, K55, K64, K65, K75, K05, K15, K16, K25, K24, \
|
||||
K32, K33, K43, K52, K53, K63, K73, K74, K03, K04, K13, K14, K23, \
|
||||
K31, K41, K42, K51, K61, K62, K71, K72, K01, K02, K11, K12, K21, K22, \
|
||||
K30, K40, K50, K60, K70, K00, K10, K20 \
|
||||
) { \
|
||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
|
||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
|
||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
|
||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \
|
||||
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
|
||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
|
||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
|
||||
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 } \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
@ -24,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6464
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER TMK
|
||||
#define MANUFACTURER Hasu
|
||||
#define PRODUCT Alps64
|
||||
#define DESCRIPTION TMK keyboard firmware for Alps64
|
||||
|
||||
@ -64,5 +63,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
#endif
|
||||
|
@ -1,199 +0,0 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* scan matrix
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
static matrix_row_t read_cols(void);
|
||||
static void init_cols(void);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void)
|
||||
{
|
||||
return MATRIX_ROWS;
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_cols(void)
|
||||
{
|
||||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
// initialize row and col
|
||||
unselect_rows();
|
||||
init_cols();
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
//debug
|
||||
debug_matrix = true;
|
||||
LED_ON();
|
||||
_delay_ms(500);
|
||||
LED_OFF();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
select_row(i);
|
||||
_delay_us(30); // without this wait read unstable value.
|
||||
matrix_row_t cols = read_cols();
|
||||
if (matrix_debouncing[i] != cols) {
|
||||
matrix_debouncing[i] = cols;
|
||||
if (debouncing) {
|
||||
debug("bounce!: "); debug_hex(debouncing); debug("\n");
|
||||
}
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
unselect_rows();
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
_delay_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
matrix_row_t matrix_get_row(uint8_t row)
|
||||
{
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print("\nr/c 0123456789ABCDEF\n");
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
pbin_reverse16(matrix_get_row(row));
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Column pin configuration
|
||||
* col: 0 1 2 3 4 5 6 7
|
||||
* pin: B0 B1 B2 B3 B4 B5 B6 B7
|
||||
*/
|
||||
static void init_cols(void)
|
||||
{
|
||||
// Input with pull-up(DDR:0, PORT:1)
|
||||
DDRB &= ~0b11111111;
|
||||
PORTB |= 0b11111111;
|
||||
}
|
||||
|
||||
/* Returns status of switches(1:on, 0:off) */
|
||||
static matrix_row_t read_cols(void)
|
||||
{
|
||||
// Invert because PIN indicates 'switch on' with low(0) and 'off' with high(1)
|
||||
return ~PINB;
|
||||
}
|
||||
|
||||
/* Row pin configuration
|
||||
* row: 0 1 2 3 4 5 6 7
|
||||
* pin: D0 D1 D2 D3 D4 D5 D6 C2
|
||||
*/
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
// Hi-Z(DDR:0, PORT:0) to unselect
|
||||
DDRD &= ~0b01111111;
|
||||
PORTD &= ~0b01111111;
|
||||
DDRC &= ~0b00000100;
|
||||
PORTC &= ~0b00000100;
|
||||
}
|
||||
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
// Output low(DDR:1, PORT:0) to select
|
||||
switch (row) {
|
||||
case 0:
|
||||
DDRD |= (1<<0);
|
||||
PORTD &= ~(1<<0);
|
||||
break;
|
||||
case 1:
|
||||
DDRD |= (1<<1);
|
||||
PORTD &= ~(1<<1);
|
||||
break;
|
||||
case 2:
|
||||
DDRD |= (1<<2);
|
||||
PORTD &= ~(1<<2);
|
||||
break;
|
||||
case 3:
|
||||
DDRD |= (1<<3);
|
||||
PORTD &= ~(1<<3);
|
||||
break;
|
||||
case 4:
|
||||
DDRD |= (1<<4);
|
||||
PORTD &= ~(1<<4);
|
||||
break;
|
||||
case 5:
|
||||
DDRD |= (1<<5);
|
||||
PORTD &= ~(1<<5);
|
||||
break;
|
||||
case 6:
|
||||
DDRD |= (1<<6);
|
||||
PORTD &= ~(1<<6);
|
||||
break;
|
||||
case 7:
|
||||
DDRC |= (1<<2);
|
||||
PORTC &= ~(1<<2);
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,63 +1,20 @@
|
||||
|
||||
|
||||
# Target file name (without extension).
|
||||
|
||||
# project specific files
|
||||
SRC = led.c
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32u2
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# change to no to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
|
@ -15,18 +15,15 @@
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32a
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# unsupported features for now
|
||||
NO_SUSPEND_POWER_DOWN = yes
|
||||
|
||||
# processor frequency
|
||||
F_CPU = 12000000
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = bootloadHID
|
||||
|
||||
# build options
|
||||
@ -38,11 +35,7 @@ COMMAND_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||
NO_UART = yes
|
||||
|
||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||
|
||||
SRC += i2c_master.c
|
||||
|
||||
# programming options
|
||||
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||
|
1
keyboards/at_at/660m/660m.c
Normal file
1
keyboards/at_at/660m/660m.c
Normal file
@ -0,0 +1 @@
|
||||
#include "660m.h"
|
19
keyboards/at_at/660m/660m.h
Normal file
19
keyboards/at_at/660m/660m.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define KNO KC_NO
|
||||
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0F, \
|
||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1F, \
|
||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2D, \
|
||||
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3E, \
|
||||
k40, k41, k42, k46, k4A, k4B, k4C, k4D, k4E, k4F \
|
||||
) { \
|
||||
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, KNO, k0F }, \
|
||||
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, KNO, k1F }, \
|
||||
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, KNO, k2D, KNO, KNO }, \
|
||||
{ k30, KNO, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, KNO, k3E, KNO }, \
|
||||
{ k40, k41, k42, KNO, KNO, KNO, k46, KNO, KNO, KNO, k4A, k4B, k4C, k4D, k4E, k4F } \
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user