forked from mirrors/qmk_firmware
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbd33782f2 | ||
|
|
1d703a476a | ||
|
|
f5a9758cea | ||
|
|
f07e2cdd9d | ||
|
|
f2c32b3ea4 | ||
|
|
92d47a55d4 | ||
|
|
41f3f01167 | ||
|
|
a8c4af5a45 | ||
|
|
858c09f370 | ||
|
|
179d64d33c | ||
|
|
eac4bab342 | ||
|
|
a8466df62d |
1
.gitmodules
vendored
1
.gitmodules
vendored
@@ -4,6 +4,7 @@
|
|||||||
[submodule "lib/chibios-contrib"]
|
[submodule "lib/chibios-contrib"]
|
||||||
path = lib/chibios-contrib
|
path = lib/chibios-contrib
|
||||||
url = https://github.com/qmk/ChibiOS-Contrib
|
url = https://github.com/qmk/ChibiOS-Contrib
|
||||||
|
branch = k-type-fix
|
||||||
[submodule "lib/ugfx"]
|
[submodule "lib/ugfx"]
|
||||||
path = lib/ugfx
|
path = lib/ugfx
|
||||||
url = https://github.com/qmk/uGFX
|
url = https://github.com/qmk/uGFX
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -19,9 +19,9 @@ endif
|
|||||||
# Otherwise the [OK], [ERROR] and [WARN] messages won't be displayed correctly
|
# Otherwise the [OK], [ERROR] and [WARN] messages won't be displayed correctly
|
||||||
override SILENT := false
|
override SILENT := false
|
||||||
|
|
||||||
|
ifndef SUB_IS_SILENT
|
||||||
QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null)
|
QMK_VERSION := $(shell git describe --abbrev=0 --tags 2>/dev/null)
|
||||||
ifneq ($(QMK_VERSION),)
|
ifneq ($(QMK_VERSION),)
|
||||||
ifneq ($(SILENT),)
|
|
||||||
$(info QMK Firmware $(QMK_VERSION))
|
$(info QMK Firmware $(QMK_VERSION))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,34 +8,78 @@ Macros allow you to send multiple keystrokes when pressing just one key. QMK has
|
|||||||
|
|
||||||
## The new way: `SEND_STRING()` & `process_record_user`
|
## The new way: `SEND_STRING()` & `process_record_user`
|
||||||
|
|
||||||
Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you. All ascii that is easily translated to a keycode is supported (eg `\n\t`).
|
Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string (i.e. a sequence of characters) for you. All ASCII characters that are easily translated to a keycode are supported (e.g. `\n\t`).
|
||||||
|
|
||||||
For example:
|
Here is an example `keymap.c` for a two-key keyboard:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
PRINT_TRUTH = SAFE_RANGE
|
MY_CUSTOM_MACRO = SAFE_RANGE
|
||||||
};
|
};
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
switch(keycode) {
|
switch(keycode) {
|
||||||
case PRINT_TRUTH:
|
case MY_CUSTOM_MACRO:
|
||||||
SEND_STRING("QMK is the best thing ever!");
|
SEND_STRING("QMK is the best thing ever!"); // this is our macro!
|
||||||
return false; break;
|
return false; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = {
|
||||||
|
{MY_CUSTOM_MACRO, KC_ESC}
|
||||||
|
}
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### Tap/down/up
|
What happens here is this:
|
||||||
|
We first define a new custom keycode in the range not occupied by any other keycodes.
|
||||||
|
Then we use the `process_record_user` function, which is called whenever a key is pressed or released, to check if our custom keycode has been activated.
|
||||||
|
If yes, we send the string `"QMK is the best thing ever!"` to the computer via the `SEND_STRING` macro (this is a C preprocessor macro, not to be confused with QMK macros).
|
||||||
|
We return `false` to indicate to the caller that the key press we just processed need not be processed any further.
|
||||||
|
Finally, we define the keymap so that the first button activates our macro and the second button is just an escape button.
|
||||||
|
|
||||||
|
You might want to add more than one macro.
|
||||||
|
You can do that by adding another keycode and adding another case to the switch statement, like so:
|
||||||
|
|
||||||
|
```c
|
||||||
|
enum custom_keycodes {
|
||||||
|
MY_CUSTOM_MACRO = SAFE_RANGE,
|
||||||
|
MY_OTHER_MACRO
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch(keycode) {
|
||||||
|
case MY_CUSTOM_MACRO:
|
||||||
|
SEND_STRING("QMK is the best thing ever!");
|
||||||
|
return false; break;
|
||||||
|
case MY_OTHER_MACRO:
|
||||||
|
SEND_STRING(SS_LCTRL("ac")); // selects all and copies
|
||||||
|
return false; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = {
|
||||||
|
{MY_CUSTOM_MACRO, MY_OTHER_MACRO}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### TAP, DOWN and UP
|
||||||
|
|
||||||
|
You may want to use keys in your macros that you can't write down, such as `Ctrl` or `Home`.
|
||||||
You can send arbitary keycodes by wrapping them in:
|
You can send arbitary keycodes by wrapping them in:
|
||||||
|
|
||||||
* `SS_TAP()`
|
* `SS_TAP()` presses and releases a key.
|
||||||
* `SS_DOWN()`
|
* `SS_DOWN()` presses (but does not release) a key.
|
||||||
* `SS_UP()`
|
* `SS_UP()` releases a key.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -53,11 +97,12 @@ There's also a couple of mod shortcuts you can use:
|
|||||||
* `SS_LGUI(string)`
|
* `SS_LGUI(string)`
|
||||||
* `SS_LALT(string)`
|
* `SS_LALT(string)`
|
||||||
|
|
||||||
That can be used like this:
|
These press the respective modifier, send the supplied string and then release the modifier.
|
||||||
|
They can be used like this:
|
||||||
|
|
||||||
SEND_STRING(SS_LCTRL("a"));
|
SEND_STRING(SS_LCTRL("a"));
|
||||||
|
|
||||||
Which would send LCTRL+a (LTRL down, a, LTRL up) - notice that they take strings (eg `"k"`), and not the `X_K` keycodes.
|
Which would send LCTRL+a (LCTRL down, a, LCTRL up) - notice that they take strings (eg `"k"`), and not the `X_K` keycodes.
|
||||||
|
|
||||||
### Alternative keymaps
|
### Alternative keymaps
|
||||||
|
|
||||||
|
|||||||
45
keyboards/bfake/bfake.c
Normal file
45
keyboards/bfake/bfake.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bfake.h"
|
||||||
|
#include "rgblight.h"
|
||||||
|
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "i2c.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
extern rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
|
void rgblight_set(void) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
led[i].r = 0;
|
||||||
|
led[i].g = 0;
|
||||||
|
led[i].b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_init();
|
||||||
|
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
rgblight_task();
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BFAKE_H
|
#define BFAKE_H
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "ps2avrGB.h"
|
|
||||||
|
|
||||||
#define KEYMAP( \
|
#define KEYMAP( \
|
||||||
K61, K71, K72, K73, K74, K64, K65, K75, K76, K77, K78, K68, K66, K10, K60,\
|
K61, K71, K72, K73, K74, K64, K65, K75, K76, K77, K78, K68, K66, K10, K60,\
|
||||||
@@ -14,12 +14,18 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BFAKE_CONFIG_H
|
#ifndef BFAKE_CONFIG_H
|
||||||
#define BFAKE_CONFIG_H
|
#define BFAKE_CONFIG_H
|
||||||
|
|
||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#define VENDOR_ID 0x20A0
|
||||||
|
#define PRODUCT_ID 0x422D
|
||||||
#define MANUFACTURER NotActuallyWinkeyless
|
#define MANUFACTURER NotActuallyWinkeyless
|
||||||
|
#define PRODUCT b.fake
|
||||||
|
|
||||||
|
#define RGBLED_NUM 16
|
||||||
|
|
||||||
#define MATRIX_ROWS 8
|
#define MATRIX_ROWS 8
|
||||||
#define MATRIX_COLS 11
|
#define MATRIX_COLS 11
|
||||||
@@ -31,4 +37,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
#define DEBOUNCING_DELAY 5
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
|
||||||
|
#define NO_UART 1
|
||||||
|
#define BOOTLOADHID_BOOTLOADER 1
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
106
keyboards/bfake/i2c.c
Normal file
106
keyboards/bfake/i2c.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/twi.h>
|
||||||
|
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||||
|
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||||
|
if (bitrate_div >= 16) {
|
||||||
|
bitrate_div = (bitrate_div - 16) / 2;
|
||||||
|
}
|
||||||
|
TWBR = bitrate_div;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_init(void) {
|
||||||
|
// set pull-up resistors on I2C bus pins
|
||||||
|
PORTC |= 0b11;
|
||||||
|
|
||||||
|
i2c_set_bitrate(400);
|
||||||
|
|
||||||
|
// enable TWI (two-wire interface)
|
||||||
|
TWCR |= (1 << TWEN);
|
||||||
|
|
||||||
|
// enable TWI interrupt and slave address ACK
|
||||||
|
TWCR |= (1 << TWIE);
|
||||||
|
TWCR |= (1 << TWEA);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_start(uint8_t address) {
|
||||||
|
// reset TWI control register
|
||||||
|
TWCR = 0;
|
||||||
|
|
||||||
|
// begin transmission and wait for it to end
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the start condition was successfully transmitted
|
||||||
|
if ((TWSR & 0xF8) != TW_START) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// transmit address and wait
|
||||||
|
TWDR = address;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the device has acknowledged the READ / WRITE mode
|
||||||
|
uint8_t twst = TW_STATUS & 0xF8;
|
||||||
|
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_stop(void) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_write(uint8_t data) {
|
||||||
|
TWDR = data;
|
||||||
|
|
||||||
|
// transmit data and wait
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||||
|
if (i2c_start(address)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < length; i++) {
|
||||||
|
if (i2c_write(data[i])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_stop();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,13 +15,13 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BMINI_CONFIG_H
|
// Please do not modify this file
|
||||||
#define BMINI_CONFIG_H
|
|
||||||
|
|
||||||
#define MANUFACTURER winkeyless.kr
|
#ifndef __I2C_H__
|
||||||
|
#define __I2C_H__
|
||||||
|
|
||||||
/* matrix size */
|
void i2c_init(void);
|
||||||
#define MATRIX_ROWS 8
|
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||||
#define MATRIX_COLS 15
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
106
keyboards/bfake/matrix.c
Normal file
106
keyboards/bfake/matrix.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
#include "matrix.h"
|
||||||
|
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
|
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
void matrix_init(void) {
|
||||||
|
// all outputs for rows high
|
||||||
|
DDRB = 0xFF;
|
||||||
|
PORTB = 0xFF;
|
||||||
|
// all inputs for columns
|
||||||
|
DDRA = 0x00;
|
||||||
|
DDRC &= ~(0x111111<<2);
|
||||||
|
DDRD &= ~(1<<PIND7);
|
||||||
|
// all columns are pulled-up
|
||||||
|
PORTA = 0xFF;
|
||||||
|
PORTC |= (0b111111<<2);
|
||||||
|
PORTD |= (1<<PIND7);
|
||||||
|
|
||||||
|
// initialize matrix state: all keys off
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix[row] = 0x00;
|
||||||
|
matrix_debouncing[row] = 0x00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_set_row_status(uint8_t row) {
|
||||||
|
DDRB = (1 << row);
|
||||||
|
PORTB = ~(1 << row);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t bit_reverse(uint8_t x) {
|
||||||
|
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||||
|
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||||
|
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void) {
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix_set_row_status(row);
|
||||||
|
_delay_us(5);
|
||||||
|
|
||||||
|
matrix_row_t cols = (
|
||||||
|
// cols 0..7, PORTA 0 -> 7
|
||||||
|
(~PINA) & 0xFF
|
||||||
|
) | (
|
||||||
|
// cols 8..13, PORTC 7 -> 0
|
||||||
|
bit_reverse((~PINC) & 0xFF) << 8
|
||||||
|
) | (
|
||||||
|
// col 14, PORTD 7
|
||||||
|
((~PIND) & (1 << PIND7)) << 7
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matrix_debouncing[row] != cols) {
|
||||||
|
matrix_debouncing[row] = cols;
|
||||||
|
debouncing = DEBOUNCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing) {
|
||||||
|
if (--debouncing) {
|
||||||
|
_delay_ms(1);
|
||||||
|
} else {
|
||||||
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
matrix[i] = matrix_debouncing[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_scan_user();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void) {
|
||||||
|
}
|
||||||
14
keyboards/bfake/readme.md
Normal file
14
keyboards/bfake/readme.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
B.fake
|
||||||
|
========
|
||||||
|
|
||||||
|
A 60% keyboard with RGB
|
||||||
|
|
||||||
|
Keyboard Maintainer: QMK Community
|
||||||
|
Hardware Supported: B.fake PCB
|
||||||
|
Hardware Availability: https://www.aliexpress.com/store/product/bface-60-RGB-underground-copy-pcb-from-china-gh60-pcb-Customize-keyboard-PCB/2230037_32731084597.html
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make bfake:default
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
45
keyboards/bfake/rules.mk
Normal file
45
keyboards/bfake/rules.mk
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
|
||||||
|
# MCU name
|
||||||
|
MCU = atmega32a
|
||||||
|
PROTOCOL = VUSB
|
||||||
|
|
||||||
|
# unsupported features for now
|
||||||
|
NO_UART = yes
|
||||||
|
NO_SUSPEND_POWER_DOWN = yes
|
||||||
|
|
||||||
|
# processor frequency
|
||||||
|
F_CPU = 12000000
|
||||||
|
|
||||||
|
# build options
|
||||||
|
BOOTMAGIC_ENABLE = yes
|
||||||
|
MOUSEKEY_ENABLE = yes
|
||||||
|
EXTRAKEY_ENABLE = yes
|
||||||
|
CONSOLE_ENABLE = yes
|
||||||
|
COMMAND_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||||
|
|
||||||
|
# custom matrix setup
|
||||||
|
CUSTOM_MATRIX = yes
|
||||||
|
SRC = matrix.c i2c.c
|
||||||
|
|
||||||
|
# programming options
|
||||||
|
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||||
396
keyboards/bfake/usbconfig.h
Normal file
396
keyboards/bfake/usbconfig.h
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
/* Name: usbconfig.h
|
||||||
|
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||||
|
* Author: Christian Starkjohann
|
||||||
|
* Creation Date: 2005-04-01
|
||||||
|
* Tabsize: 4
|
||||||
|
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||||
|
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||||
|
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __usbconfig_h_included__
|
||||||
|
#define __usbconfig_h_included__
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
General Description:
|
||||||
|
This file is an example configuration (with inline documentation) for the USB
|
||||||
|
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||||
|
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||||
|
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||||
|
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||||
|
section at the end of this file).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ---------------------------- Hardware Config ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_IOPORTNAME D
|
||||||
|
/* This is the port where the USB bus is connected. When you configure it to
|
||||||
|
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DMINUS_BIT 3
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||||
|
* This may be any bit in the port.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DPLUS_BIT 2
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||||
|
* This may be any bit in the port. Please note that D+ must also be connected
|
||||||
|
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||||
|
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||||
|
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||||
|
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||||
|
* markers every millisecond.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||||
|
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||||
|
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||||
|
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||||
|
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||||
|
* crystal!
|
||||||
|
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||||
|
* not need to modify this setting.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_CRC 0
|
||||||
|
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||||
|
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||||
|
* currently only available for 18 MHz crystal clock. You must choose
|
||||||
|
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||||
|
|
||||||
|
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||||
|
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||||
|
* V+, you can connect and disconnect the device from firmware by calling
|
||||||
|
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||||
|
* This constant defines the port on which the pullup resistor is connected.
|
||||||
|
*/
|
||||||
|
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||||
|
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||||
|
* above) where the 1.5k pullup resistor is connected. See description
|
||||||
|
* above for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* --------------------------- Functional Range ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||||
|
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||||
|
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||||
|
* number).
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||||
|
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||||
|
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||||
|
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||||
|
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_EP3_NUMBER 3
|
||||||
|
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||||
|
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||||
|
*/
|
||||||
|
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||||
|
/* The above macro defines the startup condition for data toggling on the
|
||||||
|
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||||
|
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||||
|
* sent with the oposite value of this configuration!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_HALT 0
|
||||||
|
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||||
|
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||||
|
* it is required by the standard. We have made it a config option because it
|
||||||
|
* bloats the code considerably.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||||
|
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||||
|
* want to send any data over them. If this macro is defined to 1, functions
|
||||||
|
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||||
|
* you need the interrupt-in endpoints in order to comply to an interface
|
||||||
|
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||||
|
* of bytes in flash memory and the transmit buffers in RAM.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||||
|
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||||
|
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||||
|
* low speed devices.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IS_SELF_POWERED 0
|
||||||
|
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||||
|
* device is powered from the USB bus.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_MAX_BUS_POWER 500
|
||||||
|
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||||
|
* The value is in milliamperes. [It will be divided by two since USB
|
||||||
|
* communicates power requirements in units of 2 mA.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||||
|
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||||
|
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||||
|
* bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||||
|
/* Set this to 1 if you need to send control replies which are generated
|
||||||
|
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||||
|
* data from a static buffer, set it to 0 and return the data from
|
||||||
|
* usbFunctionSetup(). This saves a couple of bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||||
|
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||||
|
* You must implement the function usbFunctionWriteOut() which receives all
|
||||||
|
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||||
|
* can be found in 'usbRxToken'.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||||
|
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||||
|
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||||
|
* usbdrv.h.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||||
|
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||||
|
* where the driver's constants (descriptors) are located. Or in other words:
|
||||||
|
* Define this to 1 for boot loaders on the ATMega128.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_LONG_TRANSFERS 0
|
||||||
|
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||||
|
* in a single control-in or control-out transfer. Note that the capability
|
||||||
|
* for long transfers increases the driver size.
|
||||||
|
*/
|
||||||
|
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||||
|
/* This macro is a hook if you want to do unconventional things. If it is
|
||||||
|
* defined, it's inserted at the beginning of received message processing.
|
||||||
|
* If you eat the received message and don't want default processing to
|
||||||
|
* proceed, do a return after doing your things. One possible application
|
||||||
|
* (besides debugging) is to flash a status LED on each packet.
|
||||||
|
*/
|
||||||
|
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||||
|
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||||
|
* one parameter which distinguishes between the start of RESET state and its
|
||||||
|
* end.
|
||||||
|
*/
|
||||||
|
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||||
|
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||||
|
* received.
|
||||||
|
*/
|
||||||
|
#define USB_COUNT_SOF 1
|
||||||
|
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||||
|
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||||
|
* connected to D- instead of D+.
|
||||||
|
*/
|
||||||
|
/* #ifdef __ASSEMBLER__
|
||||||
|
* macro myAssemblerMacro
|
||||||
|
* in YL, TCNT0
|
||||||
|
* sts timer0Snapshot, YL
|
||||||
|
* endm
|
||||||
|
* #endif
|
||||||
|
* #define USB_SOF_HOOK myAssemblerMacro
|
||||||
|
* This macro (if defined) is executed in the assembler module when a
|
||||||
|
* Start Of Frame condition is detected. It is recommended to define it to
|
||||||
|
* the name of an assembler macro which is defined here as well so that more
|
||||||
|
* than one assembler instruction can be used. The macro may use the register
|
||||||
|
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||||
|
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||||
|
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||||
|
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||||
|
* designs running on the internal RC oscillator.
|
||||||
|
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||||
|
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||||
|
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||||
|
* sent by the host. Duplicates occur only as a consequence of communication
|
||||||
|
* errors, when the host does not receive an ACK. Please note that you need to
|
||||||
|
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||||
|
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||||
|
* for each control- and out-endpoint to check for duplicate packets.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||||
|
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||||
|
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||||
|
*/
|
||||||
|
#define USB_USE_FAST_CRC 0
|
||||||
|
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||||
|
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||||
|
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||||
|
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||||
|
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||||
|
* run the AVR close to its limit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -------------------------- Device Description --------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||||
|
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||||
|
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||||
|
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||||
|
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||||
|
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||||
|
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||||
|
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||||
|
* USB-IDs-for-free.txt for details!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||||
|
/* Version number of the device: Minor number first, then major number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
|
||||||
|
#define USB_CFG_VENDOR_NAME_LEN 13
|
||||||
|
/* These two values define the vendor name returned by the USB device. The name
|
||||||
|
* must be given as a list of characters under single quotes. The characters
|
||||||
|
* are interpreted as Unicode (UTF-16) entities.
|
||||||
|
* If you don't want a vendor name string, undefine these macros.
|
||||||
|
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||||
|
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||||
|
* details.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
|
||||||
|
#define USB_CFG_DEVICE_NAME_LEN 8
|
||||||
|
/* Same as above for the device name. If you don't want a device name, undefine
|
||||||
|
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||||
|
* you use a shared VID/PID.
|
||||||
|
*/
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||||
|
/* Same as above for the serial number. If you don't want a serial number,
|
||||||
|
* undefine the macros.
|
||||||
|
* It may be useful to provide the serial number through other means than at
|
||||||
|
* compile time. See the section about descriptor properties below for how
|
||||||
|
* to fine tune control over USB descriptors such as the string descriptor
|
||||||
|
* for the serial number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_CLASS 0
|
||||||
|
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||||
|
/* See USB specification if you want to conform to an existing device class.
|
||||||
|
* Class 0xff is "vendor specific".
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||||
|
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||||
|
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||||
|
/* See USB specification if you want to conform to an existing device class or
|
||||||
|
* protocol. The following classes must be set at interface level:
|
||||||
|
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||||
|
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||||
|
/* Define this to the length of the HID report descriptor, if you implement
|
||||||
|
* an HID device. Otherwise don't define it or define it to 0.
|
||||||
|
* If you use this define, you must add a PROGMEM character array named
|
||||||
|
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||||
|
* Don't forget to keep the array and this define in sync!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #define USB_PUBLIC static */
|
||||||
|
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||||
|
* This technique saves a couple of bytes in flash memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||||
|
/* If you don't want to use the driver's default USB descriptors, you can
|
||||||
|
* provide our own. These can be provided as (1) fixed length static data in
|
||||||
|
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||||
|
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||||
|
* information about this function.
|
||||||
|
* Descriptor handling is configured through the descriptor's properties. If
|
||||||
|
* no properties are defined or if they are 0, the default descriptor is used.
|
||||||
|
* Possible properties are:
|
||||||
|
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||||
|
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||||
|
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||||
|
* you want RAM pointers.
|
||||||
|
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||||
|
* in static memory is in RAM, not in flash memory.
|
||||||
|
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||||
|
* the driver must know the descriptor's length. The descriptor itself is
|
||||||
|
* found at the address of a well known identifier (see below).
|
||||||
|
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||||
|
* char usbDescriptorDevice[];
|
||||||
|
* char usbDescriptorConfiguration[];
|
||||||
|
* char usbDescriptorHidReport[];
|
||||||
|
* char usbDescriptorString0[];
|
||||||
|
* int usbDescriptorStringVendor[];
|
||||||
|
* int usbDescriptorStringDevice[];
|
||||||
|
* int usbDescriptorStringSerialNumber[];
|
||||||
|
* Other descriptors can't be provided statically, they must be provided
|
||||||
|
* dynamically at runtime.
|
||||||
|
*
|
||||||
|
* Descriptor properties are or-ed or added together, e.g.:
|
||||||
|
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||||
|
*
|
||||||
|
* The following descriptors are defined:
|
||||||
|
* USB_CFG_DESCR_PROPS_DEVICE
|
||||||
|
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||||
|
* USB_CFG_DESCR_PROPS_STRINGS
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_0
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||||
|
* USB_CFG_DESCR_PROPS_HID
|
||||||
|
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||||
|
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||||
|
*
|
||||||
|
* Note about string descriptors: String descriptors are not just strings, they
|
||||||
|
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||||
|
* int serialNumberDescriptor[] = {
|
||||||
|
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||||
|
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||||
|
|
||||||
|
#define usbMsgPtr_t unsigned short
|
||||||
|
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||||
|
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||||
|
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||||
|
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||||
|
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional MCU Description ------------------------ */
|
||||||
|
|
||||||
|
/* The following configurations have working defaults in usbdrv.h. You
|
||||||
|
* usually don't need to set them explicitly. Only if you want to run
|
||||||
|
* the driver on a device which is not yet supported or with a compiler
|
||||||
|
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||||
|
* interrupt than INT0, you may have to define some of these.
|
||||||
|
*/
|
||||||
|
/* #define USB_INTR_CFG MCUCR */
|
||||||
|
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE GIMSK */
|
||||||
|
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||||
|
/* #define USB_INTR_PENDING GIFR */
|
||||||
|
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||||
|
/* #define USB_INTR_VECTOR INT0_vect */
|
||||||
|
|
||||||
|
/* Set INT1 for D- falling edge to count SOF */
|
||||||
|
/* #define USB_INTR_CFG EICRA */
|
||||||
|
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE EIMSK */
|
||||||
|
#define USB_INTR_ENABLE_BIT INT1
|
||||||
|
/* #define USB_INTR_PENDING EIFR */
|
||||||
|
#define USB_INTR_PENDING_BIT INTF1
|
||||||
|
#define USB_INTR_VECTOR INT1_vect
|
||||||
|
|
||||||
|
#endif /* __usbconfig_h_included__ */
|
||||||
45
keyboards/bmini/bmini.c
Normal file
45
keyboards/bmini/bmini.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bmini.h"
|
||||||
|
#include "rgblight.h"
|
||||||
|
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "i2c.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
extern rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
|
void rgblight_set(void) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
led[i].r = 0;
|
||||||
|
led[i].g = 0;
|
||||||
|
led[i].b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_init();
|
||||||
|
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
rgblight_task();
|
||||||
|
}
|
||||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BMINI_H
|
#define BMINI_H
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "ps2avrGB.h"
|
|
||||||
|
|
||||||
#define KEYMAP( \
|
#define KEYMAP( \
|
||||||
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
||||||
42
keyboards/bmini/config.h
Normal file
42
keyboards/bmini/config.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BMINI_CONFIG_H
|
||||||
|
#define BMINI_CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#define VENDOR_ID 0x20A0
|
||||||
|
#define PRODUCT_ID 0x422D
|
||||||
|
#define MANUFACTURER winkeyless.kr
|
||||||
|
#define PRODUCT B.mini
|
||||||
|
|
||||||
|
#define RGBLED_NUM 16
|
||||||
|
|
||||||
|
/* matrix size */
|
||||||
|
#define MATRIX_ROWS 8
|
||||||
|
#define MATRIX_COLS 15
|
||||||
|
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
|
||||||
|
#define NO_UART 1
|
||||||
|
#define BOOTLOADHID_BOOTLOADER 1
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||||
|
|
||||||
|
#endif
|
||||||
106
keyboards/bmini/i2c.c
Normal file
106
keyboards/bmini/i2c.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/twi.h>
|
||||||
|
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||||
|
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||||
|
if (bitrate_div >= 16) {
|
||||||
|
bitrate_div = (bitrate_div - 16) / 2;
|
||||||
|
}
|
||||||
|
TWBR = bitrate_div;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_init(void) {
|
||||||
|
// set pull-up resistors on I2C bus pins
|
||||||
|
PORTC |= 0b11;
|
||||||
|
|
||||||
|
i2c_set_bitrate(400);
|
||||||
|
|
||||||
|
// enable TWI (two-wire interface)
|
||||||
|
TWCR |= (1 << TWEN);
|
||||||
|
|
||||||
|
// enable TWI interrupt and slave address ACK
|
||||||
|
TWCR |= (1 << TWIE);
|
||||||
|
TWCR |= (1 << TWEA);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_start(uint8_t address) {
|
||||||
|
// reset TWI control register
|
||||||
|
TWCR = 0;
|
||||||
|
|
||||||
|
// begin transmission and wait for it to end
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the start condition was successfully transmitted
|
||||||
|
if ((TWSR & 0xF8) != TW_START) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// transmit address and wait
|
||||||
|
TWDR = address;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the device has acknowledged the READ / WRITE mode
|
||||||
|
uint8_t twst = TW_STATUS & 0xF8;
|
||||||
|
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_stop(void) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_write(uint8_t data) {
|
||||||
|
TWDR = data;
|
||||||
|
|
||||||
|
// transmit data and wait
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||||
|
if (i2c_start(address)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < length; i++) {
|
||||||
|
if (i2c_write(data[i])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_stop();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
27
keyboards/bmini/i2c.h
Normal file
27
keyboards/bmini/i2c.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
|
#ifndef __I2C_H__
|
||||||
|
#define __I2C_H__
|
||||||
|
|
||||||
|
void i2c_init(void);
|
||||||
|
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||||
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -15,7 +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/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bmini_x2.h"
|
#include "bmini.h"
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = KEYMAP(
|
[0] = KEYMAP(
|
||||||
106
keyboards/bmini/matrix.c
Normal file
106
keyboards/bmini/matrix.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
#include "matrix.h"
|
||||||
|
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
|
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
void matrix_init(void) {
|
||||||
|
// all outputs for rows high
|
||||||
|
DDRB = 0xFF;
|
||||||
|
PORTB = 0xFF;
|
||||||
|
// all inputs for columns
|
||||||
|
DDRA = 0x00;
|
||||||
|
DDRC &= ~(0x111111<<2);
|
||||||
|
DDRD &= ~(1<<PIND7);
|
||||||
|
// all columns are pulled-up
|
||||||
|
PORTA = 0xFF;
|
||||||
|
PORTC |= (0b111111<<2);
|
||||||
|
PORTD |= (1<<PIND7);
|
||||||
|
|
||||||
|
// initialize matrix state: all keys off
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix[row] = 0x00;
|
||||||
|
matrix_debouncing[row] = 0x00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_set_row_status(uint8_t row) {
|
||||||
|
DDRB = (1 << row);
|
||||||
|
PORTB = ~(1 << row);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t bit_reverse(uint8_t x) {
|
||||||
|
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||||
|
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||||
|
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void) {
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix_set_row_status(row);
|
||||||
|
_delay_us(5);
|
||||||
|
|
||||||
|
matrix_row_t cols = (
|
||||||
|
// cols 0..7, PORTA 0 -> 7
|
||||||
|
(~PINA) & 0xFF
|
||||||
|
) | (
|
||||||
|
// cols 8..13, PORTC 7 -> 0
|
||||||
|
bit_reverse((~PINC) & 0xFF) << 8
|
||||||
|
) | (
|
||||||
|
// col 14, PORTD 7
|
||||||
|
((~PIND) & (1 << PIND7)) << 7
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matrix_debouncing[row] != cols) {
|
||||||
|
matrix_debouncing[row] = cols;
|
||||||
|
debouncing = DEBOUNCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing) {
|
||||||
|
if (--debouncing) {
|
||||||
|
_delay_ms(1);
|
||||||
|
} else {
|
||||||
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
matrix[i] = matrix_debouncing[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_scan_user();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void) {
|
||||||
|
}
|
||||||
14
keyboards/bmini/readme.md
Normal file
14
keyboards/bmini/readme.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
B.mini
|
||||||
|
========
|
||||||
|
|
||||||
|
A 75% keyboard with RGB
|
||||||
|
|
||||||
|
Keyboard Maintainer: QMK Community
|
||||||
|
Hardware Supported: B.mini PCB
|
||||||
|
Hardware Availability: http://winkeyless.kr/product/b-mini-x2-pcb/
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make bmini:default
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
45
keyboards/bmini/rules.mk
Normal file
45
keyboards/bmini/rules.mk
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
|
||||||
|
# MCU name
|
||||||
|
MCU = atmega32a
|
||||||
|
PROTOCOL = VUSB
|
||||||
|
|
||||||
|
# unsupported features for now
|
||||||
|
NO_UART = yes
|
||||||
|
NO_SUSPEND_POWER_DOWN = yes
|
||||||
|
|
||||||
|
# processor frequency
|
||||||
|
F_CPU = 12000000
|
||||||
|
|
||||||
|
# build options
|
||||||
|
BOOTMAGIC_ENABLE = yes
|
||||||
|
MOUSEKEY_ENABLE = yes
|
||||||
|
EXTRAKEY_ENABLE = yes
|
||||||
|
CONSOLE_ENABLE = yes
|
||||||
|
COMMAND_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||||
|
|
||||||
|
# custom matrix setup
|
||||||
|
CUSTOM_MATRIX = yes
|
||||||
|
SRC = matrix.c i2c.c
|
||||||
|
|
||||||
|
# programming options
|
||||||
|
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||||
396
keyboards/bmini/usbconfig.h
Normal file
396
keyboards/bmini/usbconfig.h
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
/* Name: usbconfig.h
|
||||||
|
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||||
|
* Author: Christian Starkjohann
|
||||||
|
* Creation Date: 2005-04-01
|
||||||
|
* Tabsize: 4
|
||||||
|
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||||
|
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||||
|
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __usbconfig_h_included__
|
||||||
|
#define __usbconfig_h_included__
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
General Description:
|
||||||
|
This file is an example configuration (with inline documentation) for the USB
|
||||||
|
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||||
|
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||||
|
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||||
|
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||||
|
section at the end of this file).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ---------------------------- Hardware Config ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_IOPORTNAME D
|
||||||
|
/* This is the port where the USB bus is connected. When you configure it to
|
||||||
|
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DMINUS_BIT 3
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||||
|
* This may be any bit in the port.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DPLUS_BIT 2
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||||
|
* This may be any bit in the port. Please note that D+ must also be connected
|
||||||
|
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||||
|
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||||
|
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||||
|
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||||
|
* markers every millisecond.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||||
|
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||||
|
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||||
|
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||||
|
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||||
|
* crystal!
|
||||||
|
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||||
|
* not need to modify this setting.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_CRC 0
|
||||||
|
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||||
|
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||||
|
* currently only available for 18 MHz crystal clock. You must choose
|
||||||
|
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||||
|
|
||||||
|
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||||
|
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||||
|
* V+, you can connect and disconnect the device from firmware by calling
|
||||||
|
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||||
|
* This constant defines the port on which the pullup resistor is connected.
|
||||||
|
*/
|
||||||
|
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||||
|
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||||
|
* above) where the 1.5k pullup resistor is connected. See description
|
||||||
|
* above for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* --------------------------- Functional Range ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||||
|
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||||
|
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||||
|
* number).
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||||
|
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||||
|
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||||
|
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||||
|
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_EP3_NUMBER 3
|
||||||
|
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||||
|
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||||
|
*/
|
||||||
|
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||||
|
/* The above macro defines the startup condition for data toggling on the
|
||||||
|
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||||
|
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||||
|
* sent with the oposite value of this configuration!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_HALT 0
|
||||||
|
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||||
|
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||||
|
* it is required by the standard. We have made it a config option because it
|
||||||
|
* bloats the code considerably.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||||
|
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||||
|
* want to send any data over them. If this macro is defined to 1, functions
|
||||||
|
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||||
|
* you need the interrupt-in endpoints in order to comply to an interface
|
||||||
|
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||||
|
* of bytes in flash memory and the transmit buffers in RAM.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||||
|
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||||
|
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||||
|
* low speed devices.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IS_SELF_POWERED 0
|
||||||
|
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||||
|
* device is powered from the USB bus.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_MAX_BUS_POWER 500
|
||||||
|
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||||
|
* The value is in milliamperes. [It will be divided by two since USB
|
||||||
|
* communicates power requirements in units of 2 mA.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||||
|
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||||
|
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||||
|
* bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||||
|
/* Set this to 1 if you need to send control replies which are generated
|
||||||
|
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||||
|
* data from a static buffer, set it to 0 and return the data from
|
||||||
|
* usbFunctionSetup(). This saves a couple of bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||||
|
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||||
|
* You must implement the function usbFunctionWriteOut() which receives all
|
||||||
|
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||||
|
* can be found in 'usbRxToken'.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||||
|
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||||
|
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||||
|
* usbdrv.h.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||||
|
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||||
|
* where the driver's constants (descriptors) are located. Or in other words:
|
||||||
|
* Define this to 1 for boot loaders on the ATMega128.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_LONG_TRANSFERS 0
|
||||||
|
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||||
|
* in a single control-in or control-out transfer. Note that the capability
|
||||||
|
* for long transfers increases the driver size.
|
||||||
|
*/
|
||||||
|
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||||
|
/* This macro is a hook if you want to do unconventional things. If it is
|
||||||
|
* defined, it's inserted at the beginning of received message processing.
|
||||||
|
* If you eat the received message and don't want default processing to
|
||||||
|
* proceed, do a return after doing your things. One possible application
|
||||||
|
* (besides debugging) is to flash a status LED on each packet.
|
||||||
|
*/
|
||||||
|
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||||
|
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||||
|
* one parameter which distinguishes between the start of RESET state and its
|
||||||
|
* end.
|
||||||
|
*/
|
||||||
|
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||||
|
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||||
|
* received.
|
||||||
|
*/
|
||||||
|
#define USB_COUNT_SOF 1
|
||||||
|
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||||
|
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||||
|
* connected to D- instead of D+.
|
||||||
|
*/
|
||||||
|
/* #ifdef __ASSEMBLER__
|
||||||
|
* macro myAssemblerMacro
|
||||||
|
* in YL, TCNT0
|
||||||
|
* sts timer0Snapshot, YL
|
||||||
|
* endm
|
||||||
|
* #endif
|
||||||
|
* #define USB_SOF_HOOK myAssemblerMacro
|
||||||
|
* This macro (if defined) is executed in the assembler module when a
|
||||||
|
* Start Of Frame condition is detected. It is recommended to define it to
|
||||||
|
* the name of an assembler macro which is defined here as well so that more
|
||||||
|
* than one assembler instruction can be used. The macro may use the register
|
||||||
|
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||||
|
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||||
|
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||||
|
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||||
|
* designs running on the internal RC oscillator.
|
||||||
|
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||||
|
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||||
|
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||||
|
* sent by the host. Duplicates occur only as a consequence of communication
|
||||||
|
* errors, when the host does not receive an ACK. Please note that you need to
|
||||||
|
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||||
|
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||||
|
* for each control- and out-endpoint to check for duplicate packets.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||||
|
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||||
|
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||||
|
*/
|
||||||
|
#define USB_USE_FAST_CRC 0
|
||||||
|
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||||
|
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||||
|
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||||
|
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||||
|
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||||
|
* run the AVR close to its limit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -------------------------- Device Description --------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||||
|
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||||
|
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||||
|
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||||
|
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||||
|
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||||
|
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||||
|
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||||
|
* USB-IDs-for-free.txt for details!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||||
|
/* Version number of the device: Minor number first, then major number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
|
||||||
|
#define USB_CFG_VENDOR_NAME_LEN 13
|
||||||
|
/* These two values define the vendor name returned by the USB device. The name
|
||||||
|
* must be given as a list of characters under single quotes. The characters
|
||||||
|
* are interpreted as Unicode (UTF-16) entities.
|
||||||
|
* If you don't want a vendor name string, undefine these macros.
|
||||||
|
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||||
|
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||||
|
* details.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
|
||||||
|
#define USB_CFG_DEVICE_NAME_LEN 8
|
||||||
|
/* Same as above for the device name. If you don't want a device name, undefine
|
||||||
|
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||||
|
* you use a shared VID/PID.
|
||||||
|
*/
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||||
|
/* Same as above for the serial number. If you don't want a serial number,
|
||||||
|
* undefine the macros.
|
||||||
|
* It may be useful to provide the serial number through other means than at
|
||||||
|
* compile time. See the section about descriptor properties below for how
|
||||||
|
* to fine tune control over USB descriptors such as the string descriptor
|
||||||
|
* for the serial number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_CLASS 0
|
||||||
|
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||||
|
/* See USB specification if you want to conform to an existing device class.
|
||||||
|
* Class 0xff is "vendor specific".
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||||
|
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||||
|
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||||
|
/* See USB specification if you want to conform to an existing device class or
|
||||||
|
* protocol. The following classes must be set at interface level:
|
||||||
|
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||||
|
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||||
|
/* Define this to the length of the HID report descriptor, if you implement
|
||||||
|
* an HID device. Otherwise don't define it or define it to 0.
|
||||||
|
* If you use this define, you must add a PROGMEM character array named
|
||||||
|
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||||
|
* Don't forget to keep the array and this define in sync!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #define USB_PUBLIC static */
|
||||||
|
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||||
|
* This technique saves a couple of bytes in flash memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||||
|
/* If you don't want to use the driver's default USB descriptors, you can
|
||||||
|
* provide our own. These can be provided as (1) fixed length static data in
|
||||||
|
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||||
|
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||||
|
* information about this function.
|
||||||
|
* Descriptor handling is configured through the descriptor's properties. If
|
||||||
|
* no properties are defined or if they are 0, the default descriptor is used.
|
||||||
|
* Possible properties are:
|
||||||
|
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||||
|
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||||
|
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||||
|
* you want RAM pointers.
|
||||||
|
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||||
|
* in static memory is in RAM, not in flash memory.
|
||||||
|
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||||
|
* the driver must know the descriptor's length. The descriptor itself is
|
||||||
|
* found at the address of a well known identifier (see below).
|
||||||
|
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||||
|
* char usbDescriptorDevice[];
|
||||||
|
* char usbDescriptorConfiguration[];
|
||||||
|
* char usbDescriptorHidReport[];
|
||||||
|
* char usbDescriptorString0[];
|
||||||
|
* int usbDescriptorStringVendor[];
|
||||||
|
* int usbDescriptorStringDevice[];
|
||||||
|
* int usbDescriptorStringSerialNumber[];
|
||||||
|
* Other descriptors can't be provided statically, they must be provided
|
||||||
|
* dynamically at runtime.
|
||||||
|
*
|
||||||
|
* Descriptor properties are or-ed or added together, e.g.:
|
||||||
|
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||||
|
*
|
||||||
|
* The following descriptors are defined:
|
||||||
|
* USB_CFG_DESCR_PROPS_DEVICE
|
||||||
|
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||||
|
* USB_CFG_DESCR_PROPS_STRINGS
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_0
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||||
|
* USB_CFG_DESCR_PROPS_HID
|
||||||
|
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||||
|
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||||
|
*
|
||||||
|
* Note about string descriptors: String descriptors are not just strings, they
|
||||||
|
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||||
|
* int serialNumberDescriptor[] = {
|
||||||
|
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||||
|
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||||
|
|
||||||
|
#define usbMsgPtr_t unsigned short
|
||||||
|
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||||
|
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||||
|
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||||
|
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||||
|
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional MCU Description ------------------------ */
|
||||||
|
|
||||||
|
/* The following configurations have working defaults in usbdrv.h. You
|
||||||
|
* usually don't need to set them explicitly. Only if you want to run
|
||||||
|
* the driver on a device which is not yet supported or with a compiler
|
||||||
|
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||||
|
* interrupt than INT0, you may have to define some of these.
|
||||||
|
*/
|
||||||
|
/* #define USB_INTR_CFG MCUCR */
|
||||||
|
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE GIMSK */
|
||||||
|
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||||
|
/* #define USB_INTR_PENDING GIFR */
|
||||||
|
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||||
|
/* #define USB_INTR_VECTOR INT0_vect */
|
||||||
|
|
||||||
|
/* Set INT1 for D- falling edge to count SOF */
|
||||||
|
/* #define USB_INTR_CFG EICRA */
|
||||||
|
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE EIMSK */
|
||||||
|
#define USB_INTR_ENABLE_BIT INT1
|
||||||
|
/* #define USB_INTR_PENDING EIFR */
|
||||||
|
#define USB_INTR_PENDING_BIT INTF1
|
||||||
|
#define USB_INTR_VECTOR INT1_vect
|
||||||
|
|
||||||
|
#endif /* __usbconfig_h_included__ */
|
||||||
53
keyboards/dz60/keymaps/n0velty/keymap.c
Normal file
53
keyboards/dz60/keymaps/n0velty/keymap.c
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#include "dz60.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
|
||||||
|
#define _______ KC_TRNS //readability
|
||||||
|
|
||||||
|
#define _DL 0 //default
|
||||||
|
#define _F1 1 //function 1
|
||||||
|
#define _F2 2 //function 2
|
||||||
|
|
||||||
|
#define KC_NOPE LALT(KC_F4) //alt+f4
|
||||||
|
|
||||||
|
#define RGB_STA RGB_M_P //rgb static
|
||||||
|
#define RGB_BRE RGB_M_B //rgb breathe
|
||||||
|
#define RGB_RAI RGB_M_R //rgb rainbow
|
||||||
|
#define RGB_SWI RGB_M_SW //rgb swirl
|
||||||
|
#define RGB_SNA RGB_M_SN //rgb snake
|
||||||
|
#define RGB_KNI RGB_M_K //rgb knight
|
||||||
|
#define RGB_GRA RGB_M_G //rgb gradient
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_DL] = KEYMAP_TRUE_HHKB( //default Layer
|
||||||
|
KC_GESC, 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_BSLS, KC_DEL, \
|
||||||
|
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_BSPC, \
|
||||||
|
KC_LCTL, 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_LSPO, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, MO(_F1), \
|
||||||
|
MO(_F1), KC_LALT, KC_SPC, MO(_F2), KC_RGUI),
|
||||||
|
|
||||||
|
[_F1] = KEYMAP_TRUE_HHKB( //function Layer 1
|
||||||
|
KC_NOPE, 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_INS, KC_GRV, \
|
||||||
|
KC_BSPC, KC_HOME, KC_UP, KC_END, _______, _______, _______, _______, _______, KC_PAUS, KC_PSCR, KC_UP, KC_HOME, KC_END, \
|
||||||
|
KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_VOLU, _______, _______, _______, _______, KC_PGUP, KC_LEFT, KC_RGHT, _______, \
|
||||||
|
_______, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, _______, _______, _______, _______, KC_PGDN, KC_DOWN, _______, _______, \
|
||||||
|
_______, KC_MSEL, KC_MUTE, _______, _______),
|
||||||
|
|
||||||
|
[_F2] = KEYMAP_TRUE_HHKB( //function Layer 2
|
||||||
|
RESET, RGB_STA, RGB_BRE, RGB_RAI, RGB_SWI, RGB_SNA, RGB_KNI, RGB_GRA, _______, _______, _______, _______, _______, KC_SLEP, KC_PWR, \
|
||||||
|
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, KC_ACL2, KC_BTN1, KC_MS_U, KC_BTN2, _______, \
|
||||||
|
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_ACL1, KC_MS_L, KC_MS_R, _______, \
|
||||||
|
BL_TOGG, XXXXXXX, BL_STEP, BL_INC, BL_DEC, _______, _______, _______, _______, _______, KC_ACL0, KC_MS_D, _______, _______, \
|
||||||
|
_______, _______, _______, _______, M(0)),
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch(id) {
|
||||||
|
case 0:
|
||||||
|
SEND_STRING("https://www.reddit.com/r/MechanicalKeyboards/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
};
|
||||||
@@ -13,5 +13,6 @@
|
|||||||
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
||||||
#endif // RGBLIGHT_ENABLE
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#define FORCE_NKRO
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,125 +32,17 @@ bool skip_leds = false;
|
|||||||
|
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
#define KC_D3_1 TD(TD_D3_1)
|
||||||
//define diablo macro timer variables
|
#define KC_D3_2 TD(TD_D3_2)
|
||||||
static uint16_t diablo_timer[4];
|
#define KC_D3_3 TD(TD_D3_3)
|
||||||
static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
|
#define KC_D3_4 TD(TD_D3_4)
|
||||||
static uint8_t diablo_key_time[4];
|
#else
|
||||||
|
#define KC_D3_1 KC_1
|
||||||
bool check_dtimer(uint8_t dtimer) {
|
#define KC_D3_2 KC_2
|
||||||
// has the correct number of seconds elapsed (as defined by diablo_times)
|
#define KC_D3_3 KC_3
|
||||||
return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
|
#define KC_D3_4 KC_4
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
TD_FLSH = 0,
|
|
||||||
TD_DIABLO_1,
|
|
||||||
TD_DIABLO_2,
|
|
||||||
TD_DIABLO_3,
|
|
||||||
TD_DIABLO_4
|
|
||||||
};
|
|
||||||
|
|
||||||
// on each tap, light up one led, from right to left
|
|
||||||
// on the forth tap, turn them off from right to left
|
|
||||||
|
|
||||||
void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (!skip_leds) {
|
|
||||||
ergodox_board_led_off();
|
|
||||||
ergodox_right_led_1_off();
|
|
||||||
ergodox_right_led_2_off();
|
|
||||||
ergodox_right_led_3_off();
|
|
||||||
skip_leds = true;
|
|
||||||
}
|
|
||||||
switch (state->count) {
|
|
||||||
case 1:
|
|
||||||
ergodox_right_led_1_on();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ergodox_right_led_2_on();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
ergodox_right_led_3_on();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
ergodox_right_led_1_off();
|
|
||||||
_delay_ms(50);
|
|
||||||
ergodox_right_led_2_off();
|
|
||||||
_delay_ms(50);
|
|
||||||
ergodox_right_led_3_off();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// on the fourth tap, set the keyboard on flash state
|
|
||||||
// and set the underglow to red, because red == bad
|
|
||||||
void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
if (state->count >= 4) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_enable();
|
|
||||||
rgblight_mode(1);
|
|
||||||
rgblight_setrgb(0xff, 0x00, 0x00);
|
|
||||||
#endif
|
#endif
|
||||||
reset_tap_dance(state);
|
|
||||||
reset_keyboard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cycle through the times for the macro, starting at 0, for disabled.
|
|
||||||
// Max of six values, so don't exceed
|
|
||||||
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
|
|
||||||
if (state->count >= 7) {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[0];
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[state->count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Would rather have one function for all of this, but no idea how to do that...
|
|
||||||
void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// if the flash state didnt happen, then turn off leds, left to right
|
|
||||||
void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
_delay_ms(200);
|
|
||||||
ergodox_right_led_3_off();
|
|
||||||
_delay_ms(200);
|
|
||||||
ergodox_right_led_2_off();
|
|
||||||
_delay_ms(200);
|
|
||||||
ergodox_right_led_1_off();
|
|
||||||
_delay_ms(500);
|
|
||||||
skip_leds = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Tap Dance Definitions
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
||||||
//Once for Blue, Twice for Green, Thrice for Red, and four to flash
|
|
||||||
[TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset),
|
|
||||||
// tap once to disable, and more to enable timed micros
|
|
||||||
[TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
|
|
||||||
[TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
|
|
||||||
[TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
|
|
||||||
[TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* Keymap 0: Basic layer
|
/* Keymap 0: Basic layer
|
||||||
@@ -430,9 +322,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
*/
|
*/
|
||||||
[_DIABLO] = LAYOUT_ergodox(
|
[_DIABLO] = LAYOUT_ergodox(
|
||||||
KC_ESCAPE, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO,
|
KC_ESCAPE, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO,
|
||||||
KC_TAB, KC_S, KC_F, KC_I, KC_M, KC_T, KC_TRNS,
|
KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, KC_TRNS,
|
||||||
KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G,
|
KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G,
|
||||||
KC_LCTL, TD(TD_DIABLO_1), TD(TD_DIABLO_2), TD(TD_DIABLO_3), TD(TD_DIABLO_4), KC_Z, KC_NO,
|
KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, KC_NO,
|
||||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||||
KC_L, KC_J,
|
KC_L, KC_J,
|
||||||
KC_F,
|
KC_F,
|
||||||
@@ -499,44 +391,6 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
|
|
||||||
// Sends the key press to system, but only if on the Diablo layer
|
|
||||||
void send_diablo_keystroke(uint8_t diablo_key) {
|
|
||||||
if (biton32(layer_state) == _DIABLO) {
|
|
||||||
switch (diablo_key) {
|
|
||||||
case 0:
|
|
||||||
SEND_STRING("1");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
SEND_STRING("2");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SEND_STRING("3");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SEND_STRING("4");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks each of the 4 timers/keys to see if enough time has elapsed
|
|
||||||
// Runs the "send string" command if enough time has passed, and resets the timer.
|
|
||||||
void run_diablo_macro_check(void) {
|
|
||||||
uint8_t dtime;
|
|
||||||
|
|
||||||
for (dtime = 0; dtime < 4; dtime++) {
|
|
||||||
if (check_dtimer(dtime) && diablo_key_time[dtime]) {
|
|
||||||
diablo_timer[dtime] = timer_read();
|
|
||||||
send_diablo_keystroke(dtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void matrix_init_keymap(void) { // Runs boot tasks for keyboard
|
void matrix_init_keymap(void) { // Runs boot tasks for keyboard
|
||||||
};
|
};
|
||||||
@@ -566,9 +420,5 @@ void matrix_scan_keymap(void) { // runs frequently to update info
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Diablo 3 macro checking code.
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
run_diablo_macro_check();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
148
keyboards/ergodox_ez/keymaps/testing/keymap.c
Normal file
148
keyboards/ergodox_ez/keymaps/testing/keymap.c
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
#include "ergodox_ez.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "keymap_german.h"
|
||||||
|
|
||||||
|
#include "keymap_nordic.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
PLACEHOLDER = SAFE_RANGE, // can always be here
|
||||||
|
EPRM,
|
||||||
|
VRSN,
|
||||||
|
RGB_SLD,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[0] = KEYMAP(KC_EQUAL,KC_1,KC_2,KC_3,KC_4,KC_5,LCTL(KC_MINUS),KC_DELETE,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_LBRACKET,KC_BSPACE,KC_A,KC_S,KC_D,KC_F,KC_G,KC_LSPO,CTL_T(KC_Z),KC_X,KC_C,KC_V,KC_B,ALL_T(KC_NO),LT(1,KC_GRAVE),KC_QUOTE,LALT(KC_LSHIFT),KC_LEFT,KC_RIGHT,ALT_T(KC_APPLICATION),KC_LGUI,KC_HOME,KC_SPACE,KC_UNDS,KC_END,LCTL(KC_EQUAL),KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINUS,KC_RBRACKET,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_BSLASH,KC_H,ALT_T(KC_J),KC_K,KC_L,LT(2,KC_SCOLON),GUI_T(KC_QUOTE),MEH_T(KC_NO),KC_N,KC_M,KC_COMMA,KC_DOT,CTL_T(KC_SLASH),KC_RSPC,KC_UP,KC_DOWN,KC_LBRACKET,KC_RBRACKET,TT(1),KC_LALT,CTL_T(KC_ESCAPE),KC_PGUP,KC_PGDOWN,LT(1,KC_TAB),KC_ENTER),
|
||||||
|
|
||||||
|
[1] = KEYMAP(KC_TRANSPARENT,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,LCTL(KC_W),KC_LBRACKET,KC_RBRACKET,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,LCTL(KC_PGUP),LCTL(KC_PGDOWN),RGB_MOD,KC_TRANSPARENT,KC_TRANSPARENT,RGB_VAD,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_F12,KC_AMPR,KC_UNDS,KC_MINUS,KC_SCOLON,KC_PLUS,KC_TRANSPARENT,KC_TRANSPARENT,KC_PIPE,KC_AT,KC_EQUAL,KC_PERC,KC_BSLASH,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,RGB_TOG,RGB_SLD,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,RGB_HUI),
|
||||||
|
|
||||||
|
[2] = KEYMAP(KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_UP,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_BTN1,KC_MS_BTN2,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MEDIA_PLAY_PAUSE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MEDIA_PREV_TRACK,KC_MEDIA_NEXT_TRACK,KC_TRANSPARENT,KC_TRANSPARENT,KC_AUDIO_VOL_UP,KC_AUDIO_VOL_DOWN,KC_AUDIO_MUTE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_WWW_BACK),
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM fn_actions[] = {
|
||||||
|
[1] = ACTION_LAYER_TAP_TOGGLE(1)
|
||||||
|
};
|
||||||
|
|
||||||
|
// leaving this in place for compatibilty with old keymaps cloned and re-compiled.
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
switch(id) {
|
||||||
|
case 0:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
};
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_0
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
// dynamically generate these.
|
||||||
|
case EPRM:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
eeconfig_init();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case VRSN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RGB_SLD:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
rgblight_mode(1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
|
|
||||||
|
uint8_t layer = biton32(layer_state);
|
||||||
|
|
||||||
|
ergodox_board_led_off();
|
||||||
|
ergodox_right_led_1_off();
|
||||||
|
ergodox_right_led_2_off();
|
||||||
|
ergodox_right_led_3_off();
|
||||||
|
switch (layer) {
|
||||||
|
case 0:
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_0
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
|
||||||
|
#else
|
||||||
|
rgblight_init();
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_1
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_2
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_3
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_4
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_5
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_6
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
#ifdef RGBLIGHT_COLOR_LAYER_7
|
||||||
|
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
};
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
#endif // TAP_DANCE_ENABLE
|
#endif // TAP_DANCE_ENABLE
|
||||||
|
|
||||||
|
|
||||||
|
#define B5_AUDIO
|
||||||
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
@@ -38,6 +39,6 @@
|
|||||||
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
||||||
#endif // RGBLIGHT_ENABLE
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#define FORCE_NKRO
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,78 +24,23 @@
|
|||||||
// Fillers to make layering more clear
|
// Fillers to make layering more clear
|
||||||
#define _______ KC_TRNS
|
#define _______ KC_TRNS
|
||||||
#define XXXXXXX KC_NO
|
#define XXXXXXX KC_NO
|
||||||
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
#define KC_D3_1 TD(TD_D3_1)
|
||||||
|
#define KC_D3_2 TD(TD_D3_2)
|
||||||
|
#define KC_D3_3 TD(TD_D3_3)
|
||||||
|
#define KC_D3_4 TD(TD_D3_4)
|
||||||
|
#else
|
||||||
|
#define KC_D3_1 KC_1
|
||||||
|
#define KC_D3_2 KC_2
|
||||||
|
#define KC_D3_3 KC_3
|
||||||
|
#define KC_D3_4 KC_4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//define layer change stuff for underglow indicator
|
//define layer change stuff for underglow indicator
|
||||||
bool skip_leds = false;
|
bool skip_leds = false;
|
||||||
|
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
//define diablo macro timer variables
|
|
||||||
static uint16_t diablo_timer[4];
|
|
||||||
static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
|
|
||||||
static uint8_t diablo_key_time[4];
|
|
||||||
|
|
||||||
|
|
||||||
bool check_dtimer(uint8_t dtimer) {
|
|
||||||
// has the correct number of seconds elapsed (as defined by diablo_times)
|
|
||||||
return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
enum {
|
|
||||||
TD_D3_1 = 0,
|
|
||||||
TD_D3_2,
|
|
||||||
TD_D3_3,
|
|
||||||
TD_D3_4
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Cycle through the times for the macro, starting at 0, for disabled.
|
|
||||||
// Max of six values, so don't exceed
|
|
||||||
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
|
|
||||||
if (state->count >= 7) {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[0];
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[state->count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Would rather have one function for all of this, but no idea how to do that...
|
|
||||||
void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Tap Dance Definitions
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
||||||
// tap once to disable, and more to enable timed micros
|
|
||||||
[TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
|
|
||||||
[TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
|
|
||||||
[TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
|
|
||||||
[TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[_NUMLOCK] = KEYMAP( /* Base */
|
[_NUMLOCK] = KEYMAP( /* Base */
|
||||||
@@ -112,29 +57,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
KC_END, KC_DOWN, KC_PGDN, _______, \
|
KC_END, KC_DOWN, KC_PGDN, _______, \
|
||||||
KC_INS, KC_DEL, _______, _______ \
|
KC_INS, KC_DEL, _______, _______ \
|
||||||
),
|
),
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
[_DIABLO] = KEYMAP( /* Base */
|
[_DIABLO] = KEYMAP( /* Base */
|
||||||
KC_ESC, _______, _______, _______,\
|
KC_ESC, _______, XXXXXXX, _______,\
|
||||||
KC_S, KC_F, KC_I, KC_M, \
|
KC_S, KC_I, KC_F, KC_M, \
|
||||||
KC_1, KC_2, KC_3, KC_4, \
|
KC_1, KC_2, KC_3, KC_4, \
|
||||||
TD(TD_D3_1), TD(TD_D3_2), TD(TD_D3_3), TD(TD_D3_4), \
|
KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, \
|
||||||
_______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
|
XXXXXXX, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
|
||||||
),
|
),
|
||||||
#else
|
|
||||||
[_DIABLO] = KEYMAP( /* Base */
|
|
||||||
KC_ESC, _______, _______, _______,\
|
|
||||||
KC_S, KC_F, KC_I, KC_M, \
|
|
||||||
KC_1, KC_2, KC_3, KC_4, \
|
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
|
||||||
_______, KC_DIABLO_CLEAR, KC_Q, SFT_T(KC_SPACE) \
|
|
||||||
),
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[_MACROS] = KEYMAP( /* Base */
|
[_MACROS] = KEYMAP( /* Base */
|
||||||
KC_OVERWATCH, _______, _______, XXXXXXX,\
|
KC_OVERWATCH, XXXXXXX, _______, XXXXXXX,\
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
KC_JUSTGAME, XXXXXXX, XXXXXXX, KC_C9, \
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_JUSTGAME, \
|
XXXXXXX, XXXXXXX, KC_AIM, KC_GGEZ, \
|
||||||
KC_SYMM, KC_TORB, XXXXXXX, KC_GOODGAME, \
|
KC_SYMM, KC_TORB, XXXXXXX, KC_GOODGAME, \
|
||||||
KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \
|
KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \
|
||||||
),
|
),
|
||||||
@@ -142,8 +76,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
KC_RESET, KC_MUTE, KC_VOLD, KC_VOLU,\
|
KC_RESET, KC_MUTE, KC_VOLD, KC_VOLU,\
|
||||||
KC_MAKE, _______, RGB_HUI, RGB_HUD, \
|
KC_MAKE, _______, RGB_HUI, RGB_HUD, \
|
||||||
KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \
|
KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \
|
||||||
RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \
|
RGB_TOG, RGB_SMOD, RGB_SAI, RGB_VAI, \
|
||||||
_______, _______, RGB_SAD, RGB_VAD \
|
_______, KC_RGB_T, RGB_SAD, RGB_VAD \
|
||||||
),
|
),
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -158,60 +92,7 @@ void numlock_led_off(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
switch (keycode) {
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
|
|
||||||
if (record->event.pressed) {
|
|
||||||
uint8_t dtime;
|
|
||||||
|
|
||||||
for (dtime = 0; dtime < 4; dtime++) {
|
|
||||||
diablo_key_time[dtime] = diablo_times[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
|
|
||||||
// Sends the key press to system, but only if on the Diablo layer
|
|
||||||
void send_diablo_keystroke(uint8_t diablo_key) {
|
|
||||||
if (biton32(layer_state) == _DIABLO) {
|
|
||||||
switch (diablo_key) {
|
|
||||||
case 0:
|
|
||||||
SEND_STRING("1");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
SEND_STRING("2");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SEND_STRING("3");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SEND_STRING("4");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks each of the 4 timers/keys to see if enough time has elapsed
|
|
||||||
// Runs the "send string" command if enough time has passed, and resets the timer.
|
|
||||||
void run_diablo_macro_check(void) {
|
|
||||||
uint8_t dtime;
|
|
||||||
|
|
||||||
for (dtime = 0; dtime < 4; dtime++) {
|
|
||||||
if (check_dtimer(dtime) && diablo_key_time[dtime]) {
|
|
||||||
diablo_timer[dtime] = timer_read();
|
|
||||||
send_diablo_keystroke(dtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
void matrix_init_keymap(void) {
|
void matrix_init_keymap(void) {
|
||||||
// set Numlock LED to output and low
|
// set Numlock LED to output and low
|
||||||
DDRF |= (1 << 7);
|
DDRF |= (1 << 7);
|
||||||
@@ -226,13 +107,10 @@ void matrix_init_keymap(void) {
|
|||||||
|
|
||||||
void matrix_scan_keymap(void) {
|
void matrix_scan_keymap(void) {
|
||||||
numlock_led_off();
|
numlock_led_off();
|
||||||
if ((is_overwatch && biton32(layer_state) == _MACROS) || (biton32(layer_state) == _NAV)) {
|
if ((is_overwatch && biton32(layer_state) == _MACROS) || (biton32(layer_state) == _NUMLOCK)) {
|
||||||
numlock_led_on();
|
numlock_led_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Diablo 3 macro checking code.
|
// Run Diablo 3 macro checking code.
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
run_diablo_macro_check();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
TAP_DANCE_ENABLE = yes
|
TAP_DANCE_ENABLE = yes
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
MIDI_ENABLE = no
|
MIDI_ENABLE = no
|
||||||
CONSOLE_ENABLE = no
|
CONSOLE_ENABLE = no
|
||||||
NKRO_ENABLE = yes
|
NKRO_ENABLE = yes
|
||||||
|
MOUSEKEY_ENABLE = no
|
||||||
|
|
||||||
EXTRAFLAGS = -flto
|
EXTRAFLAGS = -flto
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,20 @@
|
|||||||
*/
|
*/
|
||||||
#include "hhkb.h"
|
#include "hhkb.h"
|
||||||
|
|
||||||
#define BASE 0
|
enum planck_layers {
|
||||||
#define FN 1
|
_DEFAULT,
|
||||||
#define MOUSE 2
|
_ALTERNATE,
|
||||||
|
_FN,
|
||||||
|
_ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
enum planck_keycodes {
|
||||||
|
DEF = SAFE_RANGE,
|
||||||
|
ALT
|
||||||
|
};
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* BASE Level: Default Layer
|
/* BASE layer: Default Layer
|
||||||
* ,-----------------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------------------------------------.
|
||||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
@@ -18,15 +26,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | fn |
|
* | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | fn |
|
||||||
* +-----------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------+
|
||||||
* | Gui | Alt | Space | AltGr |Mouse|
|
* | Alt | Gui | Space | Gui | Alt |
|
||||||
* `----------------------------------------------------------------´
|
* `----------------------------------------------------------------´
|
||||||
*/
|
*/
|
||||||
[BASE] = KEYMAP(
|
[_DEFAULT] = KEYMAP(
|
||||||
KC_ESC, 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_BSLS, KC_GRV, \
|
KC_ESC, 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_BSLS, KC_GRV, \
|
||||||
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_BSPC, \
|
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_BSPC, \
|
||||||
KC_LCTL, 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_LCTL, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(FN), \
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FN), \
|
||||||
KC_LGUI, KC_LALT, /* */ KC_SPC, KC_RALT, MO(MOUSE)
|
KC_LALT, KC_LGUI, /* */ KC_SPC, KC_RGUI, KC_RALT
|
||||||
|
),
|
||||||
|
/* Alternamte layer: swap alt/gui
|
||||||
|
* ,-----------------------------------------------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
||||||
|
* |-----------------------------------------------------------------------------------------+
|
||||||
|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Bksp |
|
||||||
|
* |-----------------------------------------------------------------------------------------+
|
||||||
|
* | Ctrl | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
|
||||||
|
* |-----------------------------------------------------------------------------------------+
|
||||||
|
* | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | fn |
|
||||||
|
* +-----------------------------------------------------------------------------------------+
|
||||||
|
* | Gui | Alt | Space | AltGr | RGui|
|
||||||
|
* `----------------------------------------------------------------´
|
||||||
|
*/
|
||||||
|
[_ALTERNATE] = KEYMAP(
|
||||||
|
KC_ESC, 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_BSLS, KC_GRV, \
|
||||||
|
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_BSPC, \
|
||||||
|
KC_LCTL, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FN), \
|
||||||
|
KC_LGUI, KC_LALT, /* */ KC_SPC, KC_RALT, KC_RGUI
|
||||||
),
|
),
|
||||||
|
|
||||||
/* FN Layer
|
/* FN Layer
|
||||||
@@ -35,40 +63,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | Caps | | | | | | | |PrtSc| Slck| Paus| Up | | |
|
* | Caps | | | | | | | |PrtSc| Slck| Paus| Up | | |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | | Vol-| Vol+| Mute| | | * | / | Home| PgUp| Left |Right| |
|
* | | Vol-| Vol+| Mute|Eject| | * | / | Home| PgUp| Left |Right| |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | | Prev| Play| Next| | | + | - | End |PgDwn| Down| | |
|
* | | Prev| Play| Next| | | + | - | End |PgDwn| Down| | |
|
||||||
* +-----------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------+
|
||||||
* | | | | Stop | |
|
* | | | Adjust | Stop | |
|
||||||
* `----------------------------------------------------------------´
|
* `----------------------------------------------------------------´
|
||||||
*/
|
*/
|
||||||
[FN] = KEYMAP(
|
[_FN] = KEYMAP(
|
||||||
KC_PWR, 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_INS, KC_DEL, \
|
KC_PWR, 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_INS, KC_DEL, \
|
||||||
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, \
|
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, \
|
KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, \
|
||||||
KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \
|
KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_MSTP, KC_TRNS
|
KC_TRNS, KC_TRNS, TG(_ADJUST), KC_MSTP, KC_TRNS
|
||||||
),
|
),
|
||||||
|
|
||||||
/* MOUSE Layer
|
/* SWITCH LAYOUT
|
||||||
* ,-----------------------------------------------------------------------------------------.
|
* ,-----------------------------------------------------------------------------------------.
|
||||||
* | | | | | | | | | | | | | | | |
|
* | | | | | | | | | | | | | | | |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | | | WUp | | | | | | | | Btn1| Up | Btn2| |
|
* | | | | | | | | | | | | | | |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | | WLt | WDn | WRt | | | | | | | Left |Right| |
|
* | | | | | | | | | | | | | |
|
||||||
* |-----------------------------------------------------------------------------------------+
|
* |-----------------------------------------------------------------------------------------+
|
||||||
* | | | | | | | | | | Btn3| Down| | |
|
* | | | | | | | | | | | | | |
|
||||||
* +-----------------------------------------------------------------------------------------+
|
* +-----------------------------------------------------------------------------------------+
|
||||||
* | | | | | |
|
* | | | | | |
|
||||||
* `----------------------------------------------------------------´
|
* `----------------------------------------------------------------´
|
||||||
*/
|
*/
|
||||||
[MOUSE] = KEYMAP(
|
[_ADJUST] = KEYMAP(
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_TRNS, KC_WH_U, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, \
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_WH_L, KC_WH_D, KC_WH_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_R, KC_TRNS, \
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, KC_MS_D, KC_TRNS, KC_TRNS, \
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
DEF, ALT, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,3 +118,23 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|||||||
}
|
}
|
||||||
return MACRO_NONE;
|
return MACRO_NONE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case DEF:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
print("mode just switched to qwerty and this is a huge string\n");
|
||||||
|
set_single_persistent_default_layer(_DEFAULT);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case ALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_ALTERNATE);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 2 of the License, or
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef KEYMAP_COMMON_H
|
#ifndef MECHMINI_H
|
||||||
#define KEYMAP_COMMON_H
|
#define MECHMINI_H
|
||||||
|
|
||||||
#include "keycode.h"
|
#include "keycode.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
import usb
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print('Usage: %s <firmware.hex>' % sys.argv[0])
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
print('Searching for ps2avrGB... ', end='')
|
|
||||||
|
|
||||||
dev = usb.core.find(idVendor=0x20A0, idProduct=0x422D)
|
|
||||||
if dev is None:
|
|
||||||
raise ValueError('Device not found')
|
|
||||||
|
|
||||||
print('Found', end='\n\n')
|
|
||||||
|
|
||||||
print('Device Information:')
|
|
||||||
print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
|
|
||||||
print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
|
|
||||||
print('Manufacturer: %s' % (dev.iManufacturer))
|
|
||||||
print('Serial: %s' % (dev.iSerialNumber))
|
|
||||||
print('Product: %s' % (dev.iProduct), end='\n\n')
|
|
||||||
|
|
||||||
print('Transferring control to bootloader... ', end='')
|
|
||||||
|
|
||||||
dev.set_configuration()
|
|
||||||
|
|
||||||
request_type = usb.util.build_request_type(
|
|
||||||
usb.util.CTRL_OUT,
|
|
||||||
usb.util.CTRL_TYPE_CLASS,
|
|
||||||
usb.util.CTRL_RECIPIENT_DEVICE)
|
|
||||||
|
|
||||||
USBRQ_HID_SET_REPORT = 0x09
|
|
||||||
HID_REPORT_OPTION = 0x0301
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
dev.ctrl_transfer(
|
|
||||||
request_type,
|
|
||||||
USBRQ_HID_SET_REPORT,
|
|
||||||
HID_REPORT_OPTION,
|
|
||||||
0,
|
|
||||||
[0, 0, 0xFF] + [0] * 5
|
|
||||||
)
|
|
||||||
except usb.core.USBError:
|
|
||||||
# for some reason I keep getting USBError, but it works!
|
|
||||||
pass
|
|
||||||
|
|
||||||
# wait a bit until bootloader starts up
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
print('OK')
|
|
||||||
print('Programming...')
|
|
||||||
if os.system('bootloadHID -r "%s"' % sys.argv[1]) == 0:
|
|
||||||
print('\nDone!')
|
|
||||||
64
keyboards/mechmini/readme.md
Normal file
64
keyboards/mechmini/readme.md
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
mechmini
|
||||||
|
========
|
||||||
|
|
||||||
|
A compact ortholinear/staggered keyboard.
|
||||||
|
|
||||||
|
Keyboard Maintainer: QMK Community
|
||||||
|
Hardware Supported: mechmini PCB
|
||||||
|
Hardware Availability: https://mechkeys.ca/collections/keyboards/products/mechmini-2-0-pcb
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make mechmini:default
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
|
|
||||||
|
## Mechmini Notes
|
||||||
|
|
||||||
|
Note that this is a complete replacement for the firmware, so you won't be
|
||||||
|
using Bootmapper Client to change any keyboard settings, since not all the
|
||||||
|
USB report options are supported.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
First, install the requirements. These commands are for OSX, but all you
|
||||||
|
need is the AVR toolchain and `bootloadHID` for flashing:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ brew cask install crosspack-avr
|
||||||
|
$ brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb
|
||||||
|
```
|
||||||
|
|
||||||
|
In order to use the `./program` script, which can reboot the board into
|
||||||
|
the bootloader, you'll need Python 2 with PyUSB installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pip install pyusb
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, with the keyboard plugged in, simply run this command from the
|
||||||
|
`qmk_firmware` directory:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make mechmini:program
|
||||||
|
```
|
||||||
|
|
||||||
|
If you prefer, you can just build it and flash the firmware directly with
|
||||||
|
`bootloadHID` if you boot the board while holding down `L_Ctrl` to keep it
|
||||||
|
in the bootloader:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make mechmini
|
||||||
|
$ bootloadHID -r mechmini_default.hex
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
From my experience, it's really hard to brick these boards. But these
|
||||||
|
tricks have been useful when it got stuck in a weird scenario.
|
||||||
|
|
||||||
|
1. Try plugging the board in while pressing `L_Ctrl`. This will force it
|
||||||
|
to boot only the bootloader without loading the firmware. Once this is
|
||||||
|
done, just reflash the board with the original firmware.
|
||||||
|
2. Sometimes USB hubs can act weird, so try connecting the board directly
|
||||||
|
to your computer or plugging/unplugging the USB hub.
|
||||||
@@ -20,9 +20,6 @@ PROTOCOL = VUSB
|
|||||||
# unsupported features for now
|
# unsupported features for now
|
||||||
NO_UART = yes
|
NO_UART = yes
|
||||||
NO_SUSPEND_POWER_DOWN = yes
|
NO_SUSPEND_POWER_DOWN = yes
|
||||||
BACKLIGHT_ENABLE = no
|
|
||||||
RGBLIGHT_ENABLE = yes
|
|
||||||
DISABLE_WS2812 = yes
|
|
||||||
|
|
||||||
# processor frequency
|
# processor frequency
|
||||||
F_CPU = 12000000
|
F_CPU = 12000000
|
||||||
@@ -33,7 +30,7 @@ MOUSEKEY_ENABLE = yes
|
|||||||
EXTRAKEY_ENABLE = yes
|
EXTRAKEY_ENABLE = yes
|
||||||
CONSOLE_ENABLE = yes
|
CONSOLE_ENABLE = yes
|
||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
@@ -45,4 +42,4 @@ CUSTOM_MATRIX = yes
|
|||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c i2c.c
|
||||||
|
|
||||||
# programming options
|
# programming options
|
||||||
PROGRAM_CMD = ./keyboards/mechmini/program $(TARGET).hex
|
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||||
@@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
[_LOWER] = KEYMAP(\
|
[_LOWER] = KEYMAP(\
|
||||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, XXXXXXX, KC_F12, _______, XXXXXXX, KC_RCTL, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, XXXXXXX, KC_F12, _______, XXXXXXX, KC_RCTL, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||||
TD(TD_FLSH),KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \
|
_______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, XXXXXXX, KC_HOME, KC_COMM, KC_DOT, KC_END, _______ \
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = KEYMAP(\
|
[_RAISE] = KEYMAP(\
|
||||||
@@ -72,15 +72,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
[_ADJUST] = KEYMAP(\
|
[_ADJUST] = KEYMAP(\
|
||||||
KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
KC_MAKE,KC_RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, XXXXXXX, _______, _______, XXXXXXX, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \
|
RGB_SMOD,RGB_HUI, _______, AU_ON, AU_OFF, AG_NORM, _______, XXXXXXX, _______, _______, XXXXXXX, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, \
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \
|
KC_RGB_T,RGB_HUD, MU_ON, MU_OFF, MU_TOG, MU_MOD, _______, _______, _______, _______, _______, _______, MAGIC_TOGGLE_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef FAUXCLICKY_ENABLE
|
#ifdef FAUXCLICKY_ENABLE
|
||||||
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A4, 0.0625); // (_D4, 0.25);
|
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25);
|
||||||
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A4, 0.0625); // (_C4, 0.125);
|
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125);
|
||||||
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25); // (_C4, 0.25);
|
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 2); // (_C4, 0.25);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
48
keyboards/pearl/config.h
Normal file
48
keyboards/pearl/config.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PEARL_CONFIG_H
|
||||||
|
#define PEARL_CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x0348
|
||||||
|
#define MANUFACTURER Pearl Boards
|
||||||
|
#define PRODUCT Pearl
|
||||||
|
#define DESCRIPTION 40% keyboard
|
||||||
|
|
||||||
|
#define NO_UART 1
|
||||||
|
#define BOOTLOADHID_BOOTLOADER 1
|
||||||
|
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 12
|
||||||
|
|
||||||
|
#define MATRIX_ROWS 4
|
||||||
|
#define MATRIX_COLS 13
|
||||||
|
|
||||||
|
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 }
|
||||||
|
#define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6}
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||||
|
|
||||||
|
#endif
|
||||||
106
keyboards/pearl/i2c.c
Normal file
106
keyboards/pearl/i2c.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/twi.h>
|
||||||
|
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
void i2c_set_bitrate(uint16_t bitrate_khz) {
|
||||||
|
uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
|
||||||
|
if (bitrate_div >= 16) {
|
||||||
|
bitrate_div = (bitrate_div - 16) / 2;
|
||||||
|
}
|
||||||
|
TWBR = bitrate_div;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_init(void) {
|
||||||
|
// set pull-up resistors on I2C bus pins
|
||||||
|
PORTC |= 0b11;
|
||||||
|
|
||||||
|
i2c_set_bitrate(400);
|
||||||
|
|
||||||
|
// enable TWI (two-wire interface)
|
||||||
|
TWCR |= (1 << TWEN);
|
||||||
|
|
||||||
|
// enable TWI interrupt and slave address ACK
|
||||||
|
TWCR |= (1 << TWIE);
|
||||||
|
TWCR |= (1 << TWEA);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_start(uint8_t address) {
|
||||||
|
// reset TWI control register
|
||||||
|
TWCR = 0;
|
||||||
|
|
||||||
|
// begin transmission and wait for it to end
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the start condition was successfully transmitted
|
||||||
|
if ((TWSR & 0xF8) != TW_START) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// transmit address and wait
|
||||||
|
TWDR = address;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
// check if the device has acknowledged the READ / WRITE mode
|
||||||
|
uint8_t twst = TW_STATUS & 0xF8;
|
||||||
|
if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_stop(void) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_write(uint8_t data) {
|
||||||
|
TWDR = data;
|
||||||
|
|
||||||
|
// transmit data and wait
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
while (!(TWCR & (1<<TWINT)));
|
||||||
|
|
||||||
|
if ((TWSR & 0xF8) != TW_MT_DATA_ACK) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) {
|
||||||
|
if (i2c_start(address)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < length; i++) {
|
||||||
|
if (i2c_write(data[i])) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_stop();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
27
keyboards/pearl/i2c.h
Normal file
27
keyboards/pearl/i2c.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2016 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
|
#ifndef __I2C_H__
|
||||||
|
#define __I2C_H__
|
||||||
|
|
||||||
|
void i2c_init(void);
|
||||||
|
void i2c_set_bitrate(uint16_t bitrate_khz);
|
||||||
|
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
|
#endif
|
||||||
28
keyboards/pearl/keymaps/default/keymap.c
Normal file
28
keyboards/pearl/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pearl.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = KEYMAP(
|
||||||
|
KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_BSPC,
|
||||||
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
|
||||||
|
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_SPACE, KC_SPACE, KC_RCTL, KC_RALT
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
56
keyboards/pearl/keymaps/jetpacktuxedo/keymap.c
Normal file
56
keyboards/pearl/keymaps/jetpacktuxedo/keymap.c
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#include "pearl.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = KEYMAP(
|
||||||
|
KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
|
||||||
|
LT(2, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, LT(2,KC_ENT),
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
|
||||||
|
KC_LCTL, KC_LGUI, KC_LALT, KC_BSPC, KC_NO, LT(1, KC_SPC), MO(3), KC_RALT
|
||||||
|
),
|
||||||
|
[1] = KEYMAP(
|
||||||
|
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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_QUOT, KC_TRNS,
|
||||||
|
KC_TRNS, RGB_TOG, RGB_SMOD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
|
),
|
||||||
|
[2] = KEYMAP(
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS, KC_PLUS,
|
||||||
|
KC_TRNS, RGB_SAI, RGB_SAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_DQUO, KC_TRNS,
|
||||||
|
KC_TRNS, RGB_HUI, RGB_HUD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PIPE, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
|
),
|
||||||
|
[3] = KEYMAP(
|
||||||
|
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, RESET,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, BL_TOGG, KC_TRNS, BL_INC, BL_DEC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t layer_state_set_kb(uint32_t state) {
|
||||||
|
// if we are on layer 1
|
||||||
|
if (state & (1<<1)){
|
||||||
|
// light num lock led
|
||||||
|
PORTD |= (1 << PD0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
PORTD &= ~(1 << PD0);
|
||||||
|
}
|
||||||
|
// if we are on layer 2
|
||||||
|
if (state & (1<<2)){
|
||||||
|
// light caps lock led
|
||||||
|
PORTD |= (1 << PD1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
PORTD &= ~(1 << PD1);
|
||||||
|
}
|
||||||
|
// if we are on layer 3
|
||||||
|
if (state & (1<<3)){
|
||||||
|
// light scroll lock led
|
||||||
|
PORTD |= (1 << PD6);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
PORTD &= ~(1 << PD6);
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
106
keyboards/pearl/matrix.c
Normal file
106
keyboards/pearl/matrix.c
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
#include "matrix.h"
|
||||||
|
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
|
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
void matrix_init(void) {
|
||||||
|
// all outputs for rows high
|
||||||
|
DDRB = 0xFF;
|
||||||
|
PORTB = 0xFF;
|
||||||
|
// all inputs for columns
|
||||||
|
DDRA = 0x00;
|
||||||
|
DDRC &= ~(0x111111<<2);
|
||||||
|
DDRD &= ~(1<<PIND7);
|
||||||
|
// all columns are pulled-up
|
||||||
|
PORTA = 0xFF;
|
||||||
|
PORTC |= (0b111111<<2);
|
||||||
|
PORTD |= (1<<PIND7);
|
||||||
|
|
||||||
|
// initialize matrix state: all keys off
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix[row] = 0x00;
|
||||||
|
matrix_debouncing[row] = 0x00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_set_row_status(uint8_t row) {
|
||||||
|
DDRB = (1 << row);
|
||||||
|
PORTB = ~(1 << row);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t bit_reverse(uint8_t x) {
|
||||||
|
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||||
|
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||||
|
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void) {
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix_set_row_status(row);
|
||||||
|
_delay_us(5);
|
||||||
|
|
||||||
|
matrix_row_t cols = (
|
||||||
|
// cols 0..7, PORTA 0 -> 7
|
||||||
|
(~PINA) & 0xFF
|
||||||
|
) | (
|
||||||
|
// cols 8..13, PORTC 7 -> 0
|
||||||
|
bit_reverse((~PINC) & 0xFF) << 8
|
||||||
|
) | (
|
||||||
|
// col 14, PORTD 7
|
||||||
|
((~PIND) & (1 << PIND7)) << 7
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matrix_debouncing[row] != cols) {
|
||||||
|
matrix_debouncing[row] = cols;
|
||||||
|
debouncing = DEBOUNCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing) {
|
||||||
|
if (--debouncing) {
|
||||||
|
_delay_ms(1);
|
||||||
|
} else {
|
||||||
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
matrix[i] = matrix_debouncing[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_scan_user();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void) {
|
||||||
|
}
|
||||||
45
keyboards/pearl/pearl.c
Normal file
45
keyboards/pearl/pearl.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pearl.h"
|
||||||
|
#include "rgblight.h"
|
||||||
|
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "i2c.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
extern rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
|
void rgblight_set(void) {
|
||||||
|
if (!rgblight_config.enable) {
|
||||||
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
|
led[i].r = 0;
|
||||||
|
led[i].g = 0;
|
||||||
|
led[i].b = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_init();
|
||||||
|
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
rgblight_task();
|
||||||
|
}
|
||||||
36
keyboards/pearl/pearl.h
Normal file
36
keyboards/pearl/pearl.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PEARL_H
|
||||||
|
#define PEARL_H
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
#include "pearl.h"
|
||||||
|
|
||||||
|
#define KEYMAP( \
|
||||||
|
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C,\
|
||||||
|
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
|
||||||
|
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,\
|
||||||
|
K30, K31, K32, K34, K35, K37, K39, K3A\
|
||||||
|
){ \
|
||||||
|
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C}, \
|
||||||
|
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, KC_NO}, \
|
||||||
|
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO}, \
|
||||||
|
{ K30, K31, K32, KC_NO, K34, K35, KC_NO, K37, KC_NO, K39, K3A, KC_NO, KC_NO}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
45
keyboards/pearl/rules.mk
Normal file
45
keyboards/pearl/rules.mk
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright 2017 Luiz Ribeiro <luizribeiro@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/>.
|
||||||
|
|
||||||
|
# MCU name
|
||||||
|
MCU = atmega32a
|
||||||
|
PROTOCOL = VUSB
|
||||||
|
|
||||||
|
# unsupported features for now
|
||||||
|
NO_UART = yes
|
||||||
|
NO_SUSPEND_POWER_DOWN = yes
|
||||||
|
|
||||||
|
# processor frequency
|
||||||
|
F_CPU = 12000000
|
||||||
|
|
||||||
|
# build options
|
||||||
|
BOOTMAGIC_ENABLE = yes
|
||||||
|
MOUSEKEY_ENABLE = yes
|
||||||
|
EXTRAKEY_ENABLE = yes
|
||||||
|
CONSOLE_ENABLE = yes
|
||||||
|
COMMAND_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||||
|
|
||||||
|
# custom matrix setup
|
||||||
|
CUSTOM_MATRIX = yes
|
||||||
|
SRC = matrix.c i2c.c
|
||||||
|
|
||||||
|
# programming options
|
||||||
|
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
|
||||||
396
keyboards/pearl/usbconfig.h
Normal file
396
keyboards/pearl/usbconfig.h
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
/* Name: usbconfig.h
|
||||||
|
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||||
|
* Author: Christian Starkjohann
|
||||||
|
* Creation Date: 2005-04-01
|
||||||
|
* Tabsize: 4
|
||||||
|
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||||
|
* License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
|
||||||
|
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __usbconfig_h_included__
|
||||||
|
#define __usbconfig_h_included__
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
General Description:
|
||||||
|
This file is an example configuration (with inline documentation) for the USB
|
||||||
|
driver. It configures V-USB for USB D+ connected to Port D bit 2 (which is
|
||||||
|
also hardware interrupt 0 on many devices) and USB D- to Port D bit 4. You may
|
||||||
|
wire the lines to any other port, as long as D+ is also wired to INT0 (or any
|
||||||
|
other hardware interrupt, as long as it is the highest level interrupt, see
|
||||||
|
section at the end of this file).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ---------------------------- Hardware Config ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_IOPORTNAME D
|
||||||
|
/* This is the port where the USB bus is connected. When you configure it to
|
||||||
|
* "B", the registers PORTB, PINB and DDRB will be used.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DMINUS_BIT 3
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
||||||
|
* This may be any bit in the port.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DPLUS_BIT 2
|
||||||
|
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
||||||
|
* This may be any bit in the port. Please note that D+ must also be connected
|
||||||
|
* to interrupt pin INT0! [You can also use other interrupts, see section
|
||||||
|
* "Optional MCU Description" below, or you can connect D- to the interrupt, as
|
||||||
|
* it is required if you use the USB_COUNT_SOF feature. If you use D- for the
|
||||||
|
* interrupt, the USB interrupt will also be triggered at Start-Of-Frame
|
||||||
|
* markers every millisecond.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CLOCK_KHZ (F_CPU/1000)
|
||||||
|
/* Clock rate of the AVR in kHz. Legal values are 12000, 12800, 15000, 16000,
|
||||||
|
* 16500, 18000 and 20000. The 12.8 MHz and 16.5 MHz versions of the code
|
||||||
|
* require no crystal, they tolerate +/- 1% deviation from the nominal
|
||||||
|
* frequency. All other rates require a precision of 2000 ppm and thus a
|
||||||
|
* crystal!
|
||||||
|
* Since F_CPU should be defined to your actual clock rate anyway, you should
|
||||||
|
* not need to modify this setting.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_CRC 0
|
||||||
|
/* Define this to 1 if you want that the driver checks integrity of incoming
|
||||||
|
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
|
||||||
|
* currently only available for 18 MHz crystal clock. You must choose
|
||||||
|
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional Hardware Config ------------------------ */
|
||||||
|
|
||||||
|
/* #define USB_CFG_PULLUP_IOPORTNAME D */
|
||||||
|
/* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
||||||
|
* V+, you can connect and disconnect the device from firmware by calling
|
||||||
|
* the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
||||||
|
* This constant defines the port on which the pullup resistor is connected.
|
||||||
|
*/
|
||||||
|
/* #define USB_CFG_PULLUP_BIT 4 */
|
||||||
|
/* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
||||||
|
* above) where the 1.5k pullup resistor is connected. See description
|
||||||
|
* above for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* --------------------------- Functional Range ---------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
||||||
|
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||||
|
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||||
|
* number).
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
|
||||||
|
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||||
|
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||||
|
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||||
|
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_EP3_NUMBER 3
|
||||||
|
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||||
|
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||||
|
*/
|
||||||
|
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||||
|
/* The above macro defines the startup condition for data toggling on the
|
||||||
|
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||||
|
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||||
|
* sent with the oposite value of this configuration!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_HALT 0
|
||||||
|
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||||
|
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||||
|
* it is required by the standard. We have made it a config option because it
|
||||||
|
* bloats the code considerably.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||||
|
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||||
|
* want to send any data over them. If this macro is defined to 1, functions
|
||||||
|
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||||
|
* you need the interrupt-in endpoints in order to comply to an interface
|
||||||
|
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||||
|
* of bytes in flash memory and the transmit buffers in RAM.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTR_POLL_INTERVAL 1
|
||||||
|
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||||
|
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||||
|
* low speed devices.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IS_SELF_POWERED 0
|
||||||
|
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||||
|
* device is powered from the USB bus.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_MAX_BUS_POWER 500
|
||||||
|
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||||
|
* The value is in milliamperes. [It will be divided by two since USB
|
||||||
|
* communicates power requirements in units of 2 mA.]
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||||
|
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||||
|
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||||
|
* bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_READ 0
|
||||||
|
/* Set this to 1 if you need to send control replies which are generated
|
||||||
|
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||||
|
* data from a static buffer, set it to 0 and return the data from
|
||||||
|
* usbFunctionSetup(). This saves a couple of bytes.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||||
|
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||||
|
* You must implement the function usbFunctionWriteOut() which receives all
|
||||||
|
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||||
|
* can be found in 'usbRxToken'.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||||
|
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||||
|
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||||
|
* usbdrv.h.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||||
|
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||||
|
* where the driver's constants (descriptors) are located. Or in other words:
|
||||||
|
* Define this to 1 for boot loaders on the ATMega128.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_LONG_TRANSFERS 0
|
||||||
|
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||||
|
* in a single control-in or control-out transfer. Note that the capability
|
||||||
|
* for long transfers increases the driver size.
|
||||||
|
*/
|
||||||
|
/* #define USB_RX_USER_HOOK(data, len) if(usbRxToken == (uchar)USBPID_SETUP) blinkLED(); */
|
||||||
|
/* This macro is a hook if you want to do unconventional things. If it is
|
||||||
|
* defined, it's inserted at the beginning of received message processing.
|
||||||
|
* If you eat the received message and don't want default processing to
|
||||||
|
* proceed, do a return after doing your things. One possible application
|
||||||
|
* (besides debugging) is to flash a status LED on each packet.
|
||||||
|
*/
|
||||||
|
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||||
|
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||||
|
* one parameter which distinguishes between the start of RESET state and its
|
||||||
|
* end.
|
||||||
|
*/
|
||||||
|
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||||
|
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||||
|
* received.
|
||||||
|
*/
|
||||||
|
#define USB_COUNT_SOF 1
|
||||||
|
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||||
|
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||||
|
* connected to D- instead of D+.
|
||||||
|
*/
|
||||||
|
/* #ifdef __ASSEMBLER__
|
||||||
|
* macro myAssemblerMacro
|
||||||
|
* in YL, TCNT0
|
||||||
|
* sts timer0Snapshot, YL
|
||||||
|
* endm
|
||||||
|
* #endif
|
||||||
|
* #define USB_SOF_HOOK myAssemblerMacro
|
||||||
|
* This macro (if defined) is executed in the assembler module when a
|
||||||
|
* Start Of Frame condition is detected. It is recommended to define it to
|
||||||
|
* the name of an assembler macro which is defined here as well so that more
|
||||||
|
* than one assembler instruction can be used. The macro may use the register
|
||||||
|
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||||
|
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||||
|
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||||
|
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||||
|
* designs running on the internal RC oscillator.
|
||||||
|
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||||
|
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||||
|
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||||
|
* sent by the host. Duplicates occur only as a consequence of communication
|
||||||
|
* errors, when the host does not receive an ACK. Please note that you need to
|
||||||
|
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||||
|
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||||
|
* for each control- and out-endpoint to check for duplicate packets.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
|
||||||
|
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||||
|
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||||
|
*/
|
||||||
|
#define USB_USE_FAST_CRC 0
|
||||||
|
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||||
|
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||||
|
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||||
|
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||||
|
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||||
|
* run the AVR close to its limit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -------------------------- Device Description --------------------------- */
|
||||||
|
|
||||||
|
#define USB_CFG_VENDOR_ID (VENDOR_ID & 0xFF), ((VENDOR_ID >> 8) & 0xFF)
|
||||||
|
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||||
|
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||||
|
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_ID (PRODUCT_ID & 0xFF), ((PRODUCT_ID >> 8) & 0xFF)
|
||||||
|
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||||
|
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||||
|
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||||
|
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||||
|
* USB-IDs-for-free.txt for details!
|
||||||
|
* *** IMPORTANT NOTE ***
|
||||||
|
* This template uses obdev's shared VID/PID pair for Vendor Class devices
|
||||||
|
* with libusb: 0x16c0/0x5dc. Use this VID/PID pair ONLY if you understand
|
||||||
|
* the implications!
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_VERSION 0x00, 0x02
|
||||||
|
/* Version number of the device: Minor number first, then major number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_VENDOR_NAME 'w', 'i', 'n', 'k', 'e', 'y', 'l', 'e', 's', 's', '.', 'k', 'r'
|
||||||
|
#define USB_CFG_VENDOR_NAME_LEN 13
|
||||||
|
/* These two values define the vendor name returned by the USB device. The name
|
||||||
|
* must be given as a list of characters under single quotes. The characters
|
||||||
|
* are interpreted as Unicode (UTF-16) entities.
|
||||||
|
* If you don't want a vendor name string, undefine these macros.
|
||||||
|
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||||
|
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||||
|
* details.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_NAME 'p', 's', '2', 'a', 'v', 'r', 'G', 'B'
|
||||||
|
#define USB_CFG_DEVICE_NAME_LEN 8
|
||||||
|
/* Same as above for the device name. If you don't want a device name, undefine
|
||||||
|
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||||
|
* you use a shared VID/PID.
|
||||||
|
*/
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||||
|
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||||
|
/* Same as above for the serial number. If you don't want a serial number,
|
||||||
|
* undefine the macros.
|
||||||
|
* It may be useful to provide the serial number through other means than at
|
||||||
|
* compile time. See the section about descriptor properties below for how
|
||||||
|
* to fine tune control over USB descriptors such as the string descriptor
|
||||||
|
* for the serial number.
|
||||||
|
*/
|
||||||
|
#define USB_CFG_DEVICE_CLASS 0
|
||||||
|
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||||
|
/* See USB specification if you want to conform to an existing device class.
|
||||||
|
* Class 0xff is "vendor specific".
|
||||||
|
*/
|
||||||
|
#define USB_CFG_INTERFACE_CLASS 3 /* HID */
|
||||||
|
#define USB_CFG_INTERFACE_SUBCLASS 1 /* Boot */
|
||||||
|
#define USB_CFG_INTERFACE_PROTOCOL 1 /* Keyboard */
|
||||||
|
/* See USB specification if you want to conform to an existing device class or
|
||||||
|
* protocol. The following classes must be set at interface level:
|
||||||
|
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||||
|
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||||
|
*/
|
||||||
|
#define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0
|
||||||
|
/* Define this to the length of the HID report descriptor, if you implement
|
||||||
|
* an HID device. Otherwise don't define it or define it to 0.
|
||||||
|
* If you use this define, you must add a PROGMEM character array named
|
||||||
|
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||||
|
* Don't forget to keep the array and this define in sync!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #define USB_PUBLIC static */
|
||||||
|
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||||
|
* This technique saves a couple of bytes in flash memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||||
|
/* If you don't want to use the driver's default USB descriptors, you can
|
||||||
|
* provide our own. These can be provided as (1) fixed length static data in
|
||||||
|
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||||
|
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||||
|
* information about this function.
|
||||||
|
* Descriptor handling is configured through the descriptor's properties. If
|
||||||
|
* no properties are defined or if they are 0, the default descriptor is used.
|
||||||
|
* Possible properties are:
|
||||||
|
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||||
|
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||||
|
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||||
|
* you want RAM pointers.
|
||||||
|
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||||
|
* in static memory is in RAM, not in flash memory.
|
||||||
|
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||||
|
* the driver must know the descriptor's length. The descriptor itself is
|
||||||
|
* found at the address of a well known identifier (see below).
|
||||||
|
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||||
|
* char usbDescriptorDevice[];
|
||||||
|
* char usbDescriptorConfiguration[];
|
||||||
|
* char usbDescriptorHidReport[];
|
||||||
|
* char usbDescriptorString0[];
|
||||||
|
* int usbDescriptorStringVendor[];
|
||||||
|
* int usbDescriptorStringDevice[];
|
||||||
|
* int usbDescriptorStringSerialNumber[];
|
||||||
|
* Other descriptors can't be provided statically, they must be provided
|
||||||
|
* dynamically at runtime.
|
||||||
|
*
|
||||||
|
* Descriptor properties are or-ed or added together, e.g.:
|
||||||
|
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||||
|
*
|
||||||
|
* The following descriptors are defined:
|
||||||
|
* USB_CFG_DESCR_PROPS_DEVICE
|
||||||
|
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||||
|
* USB_CFG_DESCR_PROPS_STRINGS
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_0
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||||
|
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||||
|
* USB_CFG_DESCR_PROPS_HID
|
||||||
|
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||||
|
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||||
|
*
|
||||||
|
* Note about string descriptors: String descriptors are not just strings, they
|
||||||
|
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||||
|
* int serialNumberDescriptor[] = {
|
||||||
|
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||||
|
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_CONFIGURATION USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC
|
||||||
|
//#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||||
|
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||||
|
|
||||||
|
#define usbMsgPtr_t unsigned short
|
||||||
|
/* If usbMsgPtr_t is not defined, it defaults to 'uchar *'. We define it to
|
||||||
|
* a scalar type here because gcc generates slightly shorter code for scalar
|
||||||
|
* arithmetics than for pointer arithmetics. Remove this define for backward
|
||||||
|
* type compatibility or define it to an 8 bit type if you use data in RAM only
|
||||||
|
* and all RAM is below 256 bytes (tiny memory model in IAR CC).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ----------------------- Optional MCU Description ------------------------ */
|
||||||
|
|
||||||
|
/* The following configurations have working defaults in usbdrv.h. You
|
||||||
|
* usually don't need to set them explicitly. Only if you want to run
|
||||||
|
* the driver on a device which is not yet supported or with a compiler
|
||||||
|
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||||
|
* interrupt than INT0, you may have to define some of these.
|
||||||
|
*/
|
||||||
|
/* #define USB_INTR_CFG MCUCR */
|
||||||
|
/* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE GIMSK */
|
||||||
|
/* #define USB_INTR_ENABLE_BIT INT0 */
|
||||||
|
/* #define USB_INTR_PENDING GIFR */
|
||||||
|
/* #define USB_INTR_PENDING_BIT INTF0 */
|
||||||
|
/* #define USB_INTR_VECTOR INT0_vect */
|
||||||
|
|
||||||
|
/* Set INT1 for D- falling edge to count SOF */
|
||||||
|
/* #define USB_INTR_CFG EICRA */
|
||||||
|
#define USB_INTR_CFG_SET ((1 << ISC11) | (0 << ISC10))
|
||||||
|
/* #define USB_INTR_CFG_CLR 0 */
|
||||||
|
/* #define USB_INTR_ENABLE EIMSK */
|
||||||
|
#define USB_INTR_ENABLE_BIT INT1
|
||||||
|
/* #define USB_INTR_PENDING EIFR */
|
||||||
|
#define USB_INTR_PENDING_BIT INTF1
|
||||||
|
#define USB_INTR_VECTOR INT1_vect
|
||||||
|
|
||||||
|
#endif /* __usbconfig_h_included__ */
|
||||||
@@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define PRODUCT_ID 0x422D
|
#define PRODUCT_ID 0x422D
|
||||||
#define PRODUCT ps2avrGB
|
#define PRODUCT ps2avrGB
|
||||||
|
|
||||||
#define RGBLED_NUM 16
|
|
||||||
#define RGBLIGHT_ANIMATIONS
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
|
||||||
#define NO_UART 1
|
#define NO_UART 1
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <util/twi.h>
|
#include <util/twi.h>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Please do not modify this file
|
||||||
|
|
||||||
#ifndef __I2C_H__
|
#ifndef __I2C_H__
|
||||||
#define __I2C_H__
|
#define __I2C_H__
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#define C6_AUDIO
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -21,74 +21,10 @@ extern keymap_config_t keymap_config;
|
|||||||
#define MEDIA TG(_MEDIA)
|
#define MEDIA TG(_MEDIA)
|
||||||
#define COVECUBE TG(_COVECUBE)
|
#define COVECUBE TG(_COVECUBE)
|
||||||
|
|
||||||
|
enum more_custom_keycodes {
|
||||||
|
KC_KP_00 = NEW_SAFE_RANGE
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
//define diablo macro timer variables
|
|
||||||
static uint16_t diablo_timer[4];
|
|
||||||
static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
|
|
||||||
static uint8_t diablo_key_time[4];
|
|
||||||
|
|
||||||
|
|
||||||
bool check_dtimer(uint8_t dtimer) {
|
|
||||||
// has the correct number of seconds elapsed (as defined by diablo_times)
|
|
||||||
return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
|
||||||
TD_D3_1 = 0,
|
|
||||||
TD_D3_2,
|
|
||||||
TD_D3_3,
|
|
||||||
TD_D3_4
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Cycle through the times for the macro, starting at 0, for disabled.
|
|
||||||
// Max of six values, so don't exceed
|
|
||||||
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
|
|
||||||
if (state->count >= 7) {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[0];
|
|
||||||
reset_tap_dance(state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
diablo_key_time[diablo_key] = diablo_times[state->count - 1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Would rather have one function for all of this, but no idea how to do that...
|
|
||||||
void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
|
|
||||||
diablo_tapdance_master(state, user_data, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Tap Dance Definitions
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
||||||
// tap once to disable, and more to enable timed micros
|
|
||||||
[TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
|
|
||||||
[TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
|
|
||||||
[TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
|
|
||||||
[TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
[_NUMLOCK] = KEYMAP(
|
[_NUMLOCK] = KEYMAP(
|
||||||
@@ -96,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
MEDIA, KC_CALC, COVECUBE, KC_P7, KC_P8, KC_P9, KC_PAST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
MEDIA, KC_CALC, COVECUBE, KC_P7, KC_P8, KC_P9, KC_PAST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||||
KC_HOME, KC_DEL, KC_PGUP, KC_P4, KC_P5, KC_P6, KC_PMNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
KC_HOME, KC_DEL, KC_PGUP, KC_P4, KC_P5, KC_P6, KC_PMNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||||
KC_END, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_PPLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
KC_END, KC_UP, KC_PGDN, KC_P1, KC_P2, KC_P3, KC_PPLS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
||||||
KC_LEFT, KC_DOWN, K C_RGHT, KC_P0, KC_KP_00,KC_PDOT, KC_PENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
|
KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_KP_00,KC_PDOT, KC_PENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
|
||||||
),
|
),
|
||||||
|
|
||||||
[_DIABLO] = KEYMAP(
|
[_DIABLO] = KEYMAP(
|
||||||
@@ -143,68 +79,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
#ifdef TAP_DANCE_ENABLE
|
case KC_KP_00:
|
||||||
case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
|
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
uint8_t dtime;
|
register_code(KC_KP_0);
|
||||||
|
unregister_code(KC_KP_0);
|
||||||
for (dtime = 0; dtime < 4; dtime++) {
|
register_code(KC_KP_0);
|
||||||
diablo_key_time[dtime] = diablo_times[0];
|
unregister_code(KC_KP_0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
|
|
||||||
// Sends the key press to system, but only if on the Diablo layer
|
|
||||||
void send_diablo_keystroke(uint8_t diablo_key) {
|
|
||||||
if (biton32(layer_state) == _DIABLO) {
|
|
||||||
switch (diablo_key) {
|
|
||||||
case 0:
|
|
||||||
SEND_STRING("1");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
SEND_STRING("2");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SEND_STRING("3");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SEND_STRING("4");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks each of the 4 timers/keys to see if enough time has elapsed
|
|
||||||
// Runs the "send string" command if enough time has passed, and resets the timer.
|
|
||||||
void run_diablo_macro_check(void) {
|
|
||||||
uint8_t dtime;
|
|
||||||
|
|
||||||
for (dtime = 0; dtime < 4; dtime++) {
|
|
||||||
if (check_dtimer(dtime) && diablo_key_time[dtime]) {
|
|
||||||
diablo_timer[dtime] = timer_read();
|
|
||||||
send_diablo_keystroke(dtime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void matrix_scan_keymap(void) { // runs frequently to update info
|
|
||||||
#ifdef TAP_DANCE_ENABLE
|
|
||||||
// Run Diablo 3 macro checking code.
|
|
||||||
run_diablo_macro_check();
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
CONSOLE_ENABLE = no
|
CONSOLE_ENABLE = no
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
TAP_DANCE_ENABLE = yes
|
TAP_DANCE_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
MOUSEKEY_ENABLE = no
|
MOUSEKEY_ENABLE = no
|
||||||
|
|||||||
Submodule lib/chibios-contrib updated: e1311c4db6...cc401cf017
@@ -275,7 +275,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
|
|||||||
|
|
||||||
.ManufacturerStrIndex = 0x01,
|
.ManufacturerStrIndex = 0x01,
|
||||||
.ProductStrIndex = 0x02,
|
.ProductStrIndex = 0x02,
|
||||||
.SerialNumStrIndex = NO_DESCRIPTOR,
|
.SerialNumStrIndex = 0x03,
|
||||||
|
|
||||||
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
|
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
|
||||||
};
|
};
|
||||||
@@ -860,6 +860,18 @@ const USB_Descriptor_String_t PROGMEM ProductString =
|
|||||||
.UnicodeString = LSTR(PRODUCT)
|
.UnicodeString = LSTR(PRODUCT)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef SERIAL_NUMBER
|
||||||
|
#define SERIAL_NUMBER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const USB_Descriptor_String_t PROGMEM SerialNumberString =
|
||||||
|
{
|
||||||
|
/* subtract 1 for null terminator */
|
||||||
|
.Header = {.Size = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER))-1), .Type = DTYPE_String},
|
||||||
|
|
||||||
|
.UnicodeString = LSTR(SERIAL_NUMBER)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||||
@@ -902,6 +914,10 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
|||||||
Address = &ProductString;
|
Address = &ProductString;
|
||||||
Size = pgm_read_byte(&ProductString.Header.Size);
|
Size = pgm_read_byte(&ProductString.Header.Size);
|
||||||
break;
|
break;
|
||||||
|
case 0x03:
|
||||||
|
Address = &SerialNumberString;
|
||||||
|
Size = pgm_read_byte(&SerialNumberString.Header.Size);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HID_DTYPE_HID:
|
case HID_DTYPE_HID:
|
||||||
|
|||||||
@@ -1,8 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
|
||||||
|
|
||||||
|
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 "drashna.h"
|
#include "drashna.h"
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
//define diablo macro timer variables
|
||||||
|
static uint16_t diablo_timer[4];
|
||||||
|
static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
|
||||||
|
static uint8_t diablo_key_time[4];
|
||||||
|
|
||||||
|
|
||||||
|
bool check_dtimer(uint8_t dtimer) {
|
||||||
|
// has the correct number of seconds elapsed (as defined by diablo_times)
|
||||||
|
return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Cycle through the times for the macro, starting at 0, for disabled.
|
||||||
|
// Max of six values, so don't exceed
|
||||||
|
void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
|
||||||
|
if (state->count >= 7) {
|
||||||
|
diablo_key_time[diablo_key] = diablo_times[0];
|
||||||
|
reset_tap_dance(state);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
diablo_key_time[diablo_key] = diablo_times[state->count - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Would rather have one function for all of this, but no idea how to do that...
|
||||||
|
void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
diablo_tapdance_master(state, user_data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
diablo_tapdance_master(state, user_data, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
diablo_tapdance_master(state, user_data, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
diablo_tapdance_master(state, user_data, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Tap Dance Definitions
|
||||||
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
|
// tap once to disable, and more to enable timed micros
|
||||||
|
[TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
|
||||||
|
[TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
|
||||||
|
[TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
|
||||||
|
[TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Add reconfigurable functions here, for keymap customization
|
// Add reconfigurable functions here, for keymap customization
|
||||||
// This allows for a global, userspace functions, and continued
|
// This allows for a global, userspace functions, and continued
|
||||||
// customization of the keymap. Use _keymap instead of _user
|
// customization of the keymap. Use _keymap instead of _user
|
||||||
@@ -17,12 +93,22 @@ __attribute__ ((weak))
|
|||||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
uint32_t layer_state_set_keymap (uint32_t state) {
|
uint32_t layer_state_set_keymap (uint32_t state) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void led_set_keymap(uint8_t usb_led) {}
|
||||||
|
|
||||||
bool is_overwatch = false;
|
bool is_overwatch = false;
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
bool rgb_layer_change = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Call user matrix init, set default RGB colors and then
|
// Call user matrix init, set default RGB colors and then
|
||||||
// call the keymap's init function
|
// call the keymap's init function
|
||||||
@@ -54,13 +140,56 @@ void matrix_init_user(void) {
|
|||||||
#endif
|
#endif
|
||||||
matrix_init_keymap();
|
matrix_init_keymap();
|
||||||
}
|
}
|
||||||
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
|
||||||
|
// Sends the key press to system, but only if on the Diablo layer
|
||||||
|
void send_diablo_keystroke(uint8_t diablo_key) {
|
||||||
|
if (biton32(layer_state) == _DIABLO) {
|
||||||
|
switch (diablo_key) {
|
||||||
|
case 0:
|
||||||
|
SEND_STRING("1");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
SEND_STRING("2");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
SEND_STRING("3");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
SEND_STRING("4");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks each of the 4 timers/keys to see if enough time has elapsed
|
||||||
|
// Runs the "send string" command if enough time has passed, and resets the timer.
|
||||||
|
void run_diablo_macro_check(void) {
|
||||||
|
uint8_t dtime;
|
||||||
|
|
||||||
|
for (dtime = 0; dtime < 4; dtime++) {
|
||||||
|
if (check_dtimer(dtime) && diablo_key_time[dtime]) {
|
||||||
|
diablo_timer[dtime] = timer_read();
|
||||||
|
send_diablo_keystroke(dtime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// No global matrix scan code, so just run keymap's matix
|
// No global matrix scan code, so just run keymap's matix
|
||||||
// scan function
|
// scan function
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
|
||||||
|
run_diablo_macro_check();
|
||||||
|
#endif
|
||||||
matrix_scan_keymap();
|
matrix_scan_keymap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void led_set_user(uint8_t usb_led) {
|
||||||
|
led_set_keymap(usb_led);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
||||||
@@ -254,11 +383,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
_delay_ms(50);
|
_delay_ms(50);
|
||||||
SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
|
SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
|
||||||
_delay_ms(50);
|
_delay_ms(3000);
|
||||||
|
register_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
|
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER));
|
SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
case KC_C9:
|
||||||
|
if (!record->event.pressed) {
|
||||||
|
register_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
|
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
|
_delay_ms(50);
|
||||||
|
SEND_STRING("OMG!!! C9!!!");
|
||||||
|
register_code(KC_ENTER);
|
||||||
|
unregister_code(KC_ENTER);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_GGEZ:
|
||||||
|
if (!record->event.pressed) {
|
||||||
|
register_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
|
unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
|
||||||
|
_delay_ms(50);
|
||||||
|
SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!");
|
||||||
|
register_code(KC_ENTER);
|
||||||
|
unregister_code(KC_ENTER);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
|
||||||
|
if (record->event.pressed) {
|
||||||
|
uint8_t dtime;
|
||||||
|
|
||||||
|
for (dtime = 0; dtime < 4; dtime++) {
|
||||||
|
diablo_key_time[dtime] = diablo_times[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case KC_MAKE:
|
case KC_MAKE:
|
||||||
if (!record->event.pressed) {
|
if (!record->event.pressed) {
|
||||||
@@ -310,6 +475,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication
|
||||||
|
if (record->event.pressed) {
|
||||||
|
rgb_layer_change = !rgb_layer_change;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RGB_MOD:
|
||||||
|
case RGB_SMOD:
|
||||||
|
case RGB_HUI:
|
||||||
|
case RGB_HUD:
|
||||||
|
case RGB_SAI:
|
||||||
|
case RGB_SAD:
|
||||||
|
case RGB_VAI:
|
||||||
|
case RGB_VAD:
|
||||||
|
case RGB_MODE_PLAIN:
|
||||||
|
case RGB_MODE_BREATHE:
|
||||||
|
case RGB_MODE_RAINBOW:
|
||||||
|
case RGB_MODE_SWIRL:
|
||||||
|
case RGB_MODE_SNAKE:
|
||||||
|
case RGB_MODE_KNIGHT:
|
||||||
|
case RGB_MODE_XMAS:
|
||||||
|
case RGB_MODE_GRADIENT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
rgb_layer_change = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return process_record_keymap(keycode, record);
|
return process_record_keymap(keycode, record);
|
||||||
}
|
}
|
||||||
@@ -317,10 +509,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||||||
// Runs state check and changes underglow color and animation
|
// Runs state check and changes underglow color and animation
|
||||||
// on layer change, no matter where the change was initiated
|
// on layer change, no matter where the change was initiated
|
||||||
// Then runs keymap's layer change check
|
// Then runs keymap's layer change check
|
||||||
uint32_t layer_state_set_user (uint32_t state) {
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
uint8_t default_layer = eeconfig_read_default_layer();
|
uint8_t default_layer = eeconfig_read_default_layer();
|
||||||
|
if (rgb_layer_change) {
|
||||||
switch (biton32(state)) {
|
switch (biton32(state)) {
|
||||||
case _NAV:
|
case _NAV:
|
||||||
rgblight_set_blue;
|
rgblight_set_blue;
|
||||||
@@ -381,6 +573,9 @@ uint32_t layer_state_set_user (uint32_t state) {
|
|||||||
rgblight_mode(1);
|
rgblight_mode(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return layer_state_set_keymap (state);
|
return layer_state_set_keymap (state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef USERSPACE
|
#ifndef USERSPACE
|
||||||
#define USERSPACE
|
#define USERSPACE
|
||||||
|
|
||||||
@@ -26,6 +43,7 @@
|
|||||||
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
|
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
|
||||||
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
|
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
|
||||||
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
|
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
|
||||||
|
#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF);
|
#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF);
|
||||||
@@ -39,8 +57,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool is_overwatch;
|
extern bool is_overwatch;
|
||||||
|
extern bool rgb_layer_change;
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum userrpace_custom_keycodes {
|
||||||
PLACEHOLDER = SAFE_RANGE, // can always be here
|
PLACEHOLDER = SAFE_RANGE, // can always be here
|
||||||
EPRM,
|
EPRM,
|
||||||
VRSN,
|
VRSN,
|
||||||
@@ -62,9 +81,24 @@ enum custom_keycodes {
|
|||||||
KC_GLHF,
|
KC_GLHF,
|
||||||
KC_TORB,
|
KC_TORB,
|
||||||
KC_AIM,
|
KC_AIM,
|
||||||
|
KC_C9,
|
||||||
|
KC_GGEZ,
|
||||||
KC_MAKE,
|
KC_MAKE,
|
||||||
KC_RESET,
|
KC_RESET,
|
||||||
NEWPLACEHOLDER //use "NEWPLACEHOLDER for keymap specific codes
|
KC_RGB_T,
|
||||||
|
NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef TAP_DANCE_ENABLE
|
||||||
|
enum {
|
||||||
|
TD_D3_1 = 0,
|
||||||
|
TD_D3_2,
|
||||||
|
TD_D3_3,
|
||||||
|
TD_D3_4
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
105
util/atmega32a_program.py
Normal file
105
util/atmega32a_program.py
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>, Sebastian Kaim <sebb@sebb767.de>
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import usb
|
||||||
|
|
||||||
|
|
||||||
|
def checkForKeyboardInNormalMode():
|
||||||
|
"""Returns a device if a ps2avrGB device in normal made (that is in keyboard mode) or None if it is not found."""
|
||||||
|
return usb.core.find(idVendor=0x20A0, idProduct=0x422D)
|
||||||
|
|
||||||
|
def checkForKeyboardInBootloaderMode():
|
||||||
|
"""Returns True if a ps2avrGB device in bootloader (flashable) mode is found and False otherwise."""
|
||||||
|
return (usb.core.find(idVendor=0x16c0, idProduct=0x05df) is not None)
|
||||||
|
|
||||||
|
def flashKeyboard(firmware_file):
|
||||||
|
"""Calls bootloadHID to flash the given file to the device."""
|
||||||
|
print('Flashing firmware to device ...')
|
||||||
|
if os.system('bootloadHID -r "%s"' % firmware_file) == 0:
|
||||||
|
print('\nDone!')
|
||||||
|
else:
|
||||||
|
print('\nbootloadHID returned an error.')
|
||||||
|
|
||||||
|
def printDeviceInfo(dev):
|
||||||
|
"""Prints all infos for a given USB device"""
|
||||||
|
print('Device Information:')
|
||||||
|
print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor))
|
||||||
|
print(' idProduct: %d (0x%04x)' % (dev.idProduct, dev.idProduct))
|
||||||
|
print('Manufacturer: %s' % (dev.iManufacturer))
|
||||||
|
print('Serial: %s' % (dev.iSerialNumber))
|
||||||
|
print('Product: %s' % (dev.iProduct), end='\n\n')
|
||||||
|
|
||||||
|
def sendDeviceToBootloaderMode(dev):
|
||||||
|
"""Tries to send a given ps2avrGB keyboard to bootloader mode to allow flashing."""
|
||||||
|
try:
|
||||||
|
dev.set_configuration()
|
||||||
|
|
||||||
|
request_type = usb.util.build_request_type(
|
||||||
|
usb.util.CTRL_OUT,
|
||||||
|
usb.util.CTRL_TYPE_CLASS,
|
||||||
|
usb.util.CTRL_RECIPIENT_DEVICE)
|
||||||
|
|
||||||
|
USBRQ_HID_SET_REPORT = 0x09
|
||||||
|
HID_REPORT_OPTION = 0x0301
|
||||||
|
|
||||||
|
dev.ctrl_transfer(request_type, USBRQ_HID_SET_REPORT, HID_REPORT_OPTION, 0, [0, 0, 0xFF] + [0] * 5)
|
||||||
|
except usb.core.USBError:
|
||||||
|
# for some reason I keep getting USBError, but it works!
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print('Usage: %s <firmware.hex>' % sys.argv[0])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
kb = checkForKeyboardInNormalMode()
|
||||||
|
|
||||||
|
if kb is not None:
|
||||||
|
print('Found a keyboad in normal mode. Attempting to send it to bootloader mode ...', end='')
|
||||||
|
sendDeviceToBootloaderMode(kb)
|
||||||
|
print(' done.')
|
||||||
|
print("Hint: If your keyboard can't be set to bootloader mode automatically, plug it in while pressing the bootloader key to do so manually.")
|
||||||
|
print(" You can find more infos about this here: https://github.com/qmk/qmk_firmware/tree/master/keyboards/ps2avrGB#setting-the-board-to-bootloader-mode")
|
||||||
|
|
||||||
|
attempts = 12 # 60 seconds
|
||||||
|
found = False
|
||||||
|
for attempt in range(1, attempts + 1):
|
||||||
|
print("Searching for keyboard in bootloader mode (%i/%i) ... " % (attempt, attempts), end='')
|
||||||
|
|
||||||
|
if checkForKeyboardInBootloaderMode():
|
||||||
|
print('Found', end='\n\n')
|
||||||
|
flashKeyboard(sys.argv[1])
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('Nothing.', end='')
|
||||||
|
|
||||||
|
if attempt != attempts: # no need to wait on the last attempt
|
||||||
|
print(' Sleeping 5 seconds.', end='')
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
# print a newline
|
||||||
|
print()
|
||||||
|
|
||||||
|
if not found:
|
||||||
|
print("Couldn't find a flashable keyboard. Aborting.")
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
@@ -64,13 +64,15 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
|
|||||||
eval `ssh-agent -s`
|
eval `ssh-agent -s`
|
||||||
ssh-add id_rsa_qmk.fm
|
ssh-add id_rsa_qmk.fm
|
||||||
|
|
||||||
# not sure this is needed now
|
# don't delete files in case not all keyboards are built
|
||||||
rm -f compiled/*.hex
|
# rm -f compiled/*.hex
|
||||||
|
|
||||||
# ignore errors here
|
# ignore errors here
|
||||||
for file in ../qmk_firmware/keyboards/*/keymaps/*/*.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
for file in ../qmk_firmware/keyboards/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||||
for file in ../qmk_firmware/keyboards/*/*/keymaps/*/*.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
for file in ../qmk_firmware/keyboards/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||||
_util/generate_keyboard_page.sh
|
for file in ../qmk_firmware/keyboards/*/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||||
|
for file in ../qmk_firmware/keyboards/*/*/*/*/keymaps/*/*_default.hex; do mv -v "$file" "compiled/${file##*/}" || true; done
|
||||||
|
bash _util/generate_keyboard_page.sh
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "generated from qmk/qmk_firmware@${rev}"
|
git commit -m "generated from qmk/qmk_firmware@${rev}"
|
||||||
git push git@github.com:qmk/qmk.fm.git
|
git push git@github.com:qmk/qmk.fm.git
|
||||||
|
|||||||
Reference in New Issue
Block a user