Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d382eeeb9d | ||
|
|
efa28d0f5c | ||
|
|
0a9a69394e | ||
|
|
31fe2e0859 | ||
|
|
29630e6e49 | ||
|
|
a836c85e54 | ||
|
|
511fa5f815 | ||
|
|
a510e5212b | ||
|
|
2b83b908dd | ||
|
|
25d4c0c810 | ||
|
|
3a215195ed | ||
|
|
a4d138645f |
No files matched your search
@@ -16,6 +16,7 @@ install:
|
|||||||
- npm install -g moxygen
|
- npm install -g moxygen
|
||||||
script:
|
script:
|
||||||
- git rev-parse --short HEAD
|
- git rev-parse --short HEAD
|
||||||
|
- git diff --name-only HEAD $TRAVIS_BRANCH
|
||||||
- bash util/travis_test.sh
|
- bash util/travis_test.sh
|
||||||
- bash util/travis_build.sh
|
- bash util/travis_build.sh
|
||||||
- bash util/travis_docs.sh
|
- bash util/travis_docs.sh
|
||||||
|
|||||||
@@ -348,7 +348,8 @@ Use these to enable or disable building certain features. The more you have enab
|
|||||||
* `NO_USB_STARTUP_CHECK`
|
* `NO_USB_STARTUP_CHECK`
|
||||||
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
|
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
|
||||||
* `LINK_TIME_OPTIMIZATION_ENABLE`
|
* `LINK_TIME_OPTIMIZATION_ENABLE`
|
||||||
= Enables Link Time Optimization (`LTO`) when compiling the keyboard. This makes the process take longer, but can significantly reduce the compiled size (and since the firmware is small, the added time is not noticable). However, this will automatically disable the old Macros and Functions features automatically, as these break when `LTO` is enabled. It does this by automatically defining `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION`
|
* Enables Link Time Optimization (`LTO`) when compiling the keyboard. This makes the process take longer, but can significantly reduce the compiled size (and since the firmware is small, the added time is not noticeable). However, this will automatically disable the old Macros and Functions features automatically, as these break when `LTO` is enabled. It does this by automatically defining `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION`
|
||||||
|
* Alternatively, you can use `LTO_ENABLE` instead of `LINK_TIME_OPTIMIZATION_ENABLE`.
|
||||||
|
|
||||||
## USB Endpoint Limitations
|
## USB Endpoint Limitations
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Получение помощи
|
||||||
|
|
||||||
|
Существует много ресурсов для получения помощи по работе с QMK.
|
||||||
|
|
||||||
|
## Чат в реальном времени
|
||||||
|
|
||||||
|
Вы можете найти разработчиков и пользователей QMK на нашем главном [сервере Discord](https://discord.gg/Uq7gcHh). На сервере есть специальные каналы для разговоров о прошивке, Toolbox, оборудовании и конфигураторе.
|
||||||
|
|
||||||
|
## OLKB Сабреддит
|
||||||
|
|
||||||
|
Официальный форум QMK [/r/olkb](https://reddit.com/r/olkb) на [reddit.com](https://reddit.com).
|
||||||
|
|
||||||
|
## GitHub ишью
|
||||||
|
|
||||||
|
Вы можете открыть [ишью на GitHub](https://github.com/qmk/qmk_firmware/issues). Это особенно удобно, когда ваша проблема потребует длительного обсуждения или отладки.
|
||||||
+4
-68
@@ -17,50 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "ares.h"
|
#include "ares.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
i2c_init();
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
void rgblight_set(void) {
|
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
memset(led, 0, 3 * RGBLED_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
setPinOutput(D0);
|
setPinOutput(D0);
|
||||||
setPinOutput(D1);
|
setPinOutput(D1);
|
||||||
setPinOutput(D4);
|
setPinOutput(D4);
|
||||||
setPinOutput(D6);
|
setPinOutput(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
@@ -79,29 +41,3 @@ void backlight_set(uint8_t level) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Optional override functions below.
|
|
||||||
// You can leave any or all of these undefined.
|
|
||||||
// These are only required if you want to perform custom actions.
|
|
||||||
|
|
||||||
/*
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// put your keyboard start-up code here
|
|
||||||
// runs once when the firmware starts up
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// put your looping keyboard code here
|
|
||||||
// runs every cycle (a lot)
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
// put your per-action keyboard code here
|
|
||||||
// runs for every action, just before processing by the firmware
|
|
||||||
return process_record_user(keycode, record);
|
|
||||||
}
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
|
||||||
led_set_user(usb_led);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
+1
-18
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
+18
-35
@@ -16,51 +16,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bfake.h"
|
#include "bfake.h"
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {}
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D0);
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D1);
|
||||||
|
setPinOutput(D4);
|
||||||
|
setPinOutput(D6);
|
||||||
|
|
||||||
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// Turn out the lights
|
// Turn out the lights
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// Turn on the lights
|
// Turn on the lights
|
||||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinHigh(D0);
|
||||||
|
writePinHigh(D1);
|
||||||
|
writePinHigh(D4);
|
||||||
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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,27 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,10 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
@@ -13,62 +13,9 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "budget96.h"
|
#include "budget96.h"
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
setPinOutput(D0);
|
setPinOutput(D0);
|
||||||
@@ -76,25 +23,25 @@ void backlight_init_ports(void) {
|
|||||||
setPinOutput(D4);
|
setPinOutput(D4);
|
||||||
setPinOutput(D6);
|
setPinOutput(D6);
|
||||||
|
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn RGB LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,9 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
|
||||||
SRC = i2c_master.c
|
|
||||||
@@ -14,49 +14,7 @@
|
|||||||
* 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 "i2c_master.h"
|
#include "meteor.h"
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -73,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGBLIGHT_CUSTOM_DRIVER = no
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
QUANTUM_LIB_SRC = i2c_master.c
|
|
||||||
@@ -13,49 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#include "le_bmc.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
@@ -34,4 +34,3 @@ FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
|||||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
SRC += i2c_master.c
|
|
||||||
@@ -13,57 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "oe_bmc.h"
|
#include "oe_bmc.h"
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// put your keyboard start-up code here
|
|
||||||
// runs once when the firmware starts up
|
|
||||||
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// put your looping keyboard code here
|
|
||||||
// runs every cycle (a lot)
|
|
||||||
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
// put your per-action keyboard code here
|
|
||||||
// runs for every action, just before processing by the firmware
|
|
||||||
|
|
||||||
return process_record_user(keycode, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
|
||||||
|
|
||||||
led_set_user(usb_led);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,7 +23,7 @@ void backlight_init_ports(void) {
|
|||||||
setPinOutput(D4);
|
setPinOutput(D4);
|
||||||
setPinOutput(D6);
|
setPinOutput(D6);
|
||||||
|
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
@@ -80,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn RGB LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
@@ -34,4 +34,3 @@ FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
|||||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
SRC += i2c_master.c
|
|
||||||
@@ -15,76 +15,3 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "exent.h"
|
#include "exent.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
|
|
||||||
# include <string.h>
|
|
||||||
# include "i2c_master.h"
|
|
||||||
# include "rgblight.h"
|
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
i2c_init();
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
void rgblight_set(void) {
|
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
memset(led, 0, 3 * RGBLED_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Optional override functions below.
|
|
||||||
// You can leave any or all of these undefined.
|
|
||||||
// These are only required if you want to perform custom actions.
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// put your keyboard start-up code here
|
|
||||||
// runs once when the firmware starts up
|
|
||||||
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// put your looping keyboard code here
|
|
||||||
// runs every cycle (a lot)
|
|
||||||
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
// put your per-action keyboard code here
|
|
||||||
// runs for every action, just before processing by the firmware
|
|
||||||
|
|
||||||
return process_record_user(keycode, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
|
||||||
|
|
||||||
led_set_user(usb_led);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
@@ -19,10 +19,8 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = 65_ansi 65_iso
|
LAYOUTS = 65_ansi 65_iso
|
||||||
+17
-37
@@ -16,51 +16,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "facew.h"
|
#include "facew.h"
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D0);
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D1);
|
||||||
|
setPinOutput(D4);
|
||||||
|
setPinOutput(D6);
|
||||||
|
|
||||||
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// Turn out the lights
|
// Turn out the lights
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// Turn on the lights
|
// Turn on the lights
|
||||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinHigh(D0);
|
||||||
|
writePinHigh(D1);
|
||||||
|
writePinHigh(D4);
|
||||||
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,11 +19,8 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
|
||||||
SRC = i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = 60_ansi
|
LAYOUTS = 60_ansi
|
||||||
@@ -16,50 +16,6 @@
|
|||||||
|
|
||||||
#include "mars80.h"
|
#include "mars80.h"
|
||||||
|
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
setPinOutput(D0);
|
setPinOutput(D0);
|
||||||
@@ -75,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2019 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,8 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = tkl_ansi tkl_iso
|
LAYOUTS = tkl_ansi tkl_iso
|
||||||
@@ -16,33 +16,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 <string.h>
|
#include "hb85.h"
|
||||||
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -51,7 +25,7 @@ void backlight_init_ports(void) {
|
|||||||
setPinOutput(D4);
|
setPinOutput(D4);
|
||||||
setPinOutput(D6);
|
setPinOutput(D6);
|
||||||
|
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
@@ -59,17 +33,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn RGB LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn RGB LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2019 fcoury <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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,27 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,10 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
+18
-38
@@ -16,56 +16,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "v32a.h"
|
#include "v32a.h"
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {}
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D0);
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D1);
|
||||||
|
setPinOutput(D4);
|
||||||
|
setPinOutput(D6);
|
||||||
|
|
||||||
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// Turn out the lights
|
// Turn out the lights
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// Turn on the lights
|
// Turn on the lights
|
||||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinHigh(D0);
|
||||||
|
writePinHigh(D1);
|
||||||
|
writePinHigh(D4);
|
||||||
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -17,40 +17,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "jj4x4.h"
|
#include "jj4x4.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
i2c_init();
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
// custom RGB driver
|
|
||||||
void rgblight_set(void) {
|
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
memset(led, 0, 3 * RGBLED_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -40,7 +25,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
|
||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
@@ -48,6 +33,4 @@ AUDIO_ENABLE = no # Audio output on port C6
|
|||||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = ortho_4x4
|
LAYOUTS = ortho_4x4
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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/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,25 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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 __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
|
|
||||||
+9
-58
@@ -17,24 +17,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "jj50.h"
|
#include "jj50.h"
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "backlight_custom.h"
|
#include "backlight_custom.h"
|
||||||
|
|
||||||
// for keyboard subdirectory level init functions
|
void matrix_init_kb(void) { matrix_init_user(); }
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
__attribute__ ((weak))
|
||||||
// call user level keymaps, if any
|
void matrix_init_user(void) {}
|
||||||
matrix_init_user();
|
|
||||||
}
|
void matrix_scan_kb(void) { matrix_scan_user(); }
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {}
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
/// Overrides functions in `quantum.c`
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
b_led_init_ports();
|
b_led_init_ports();
|
||||||
}
|
}
|
||||||
@@ -47,48 +43,3 @@ void backlight_set(uint8_t level) {
|
|||||||
b_led_set(level);
|
b_led_set(level);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
#else
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
+2
-22
@@ -1,19 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
# Modified 2018 Wayne Jones (WarmCatUK) <[email protected]>
|
|
||||||
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -35,22 +19,18 @@ CONSOLE_ENABLE = no
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
NKRO_ENABLE = no
|
NKRO_ENABLE = no
|
||||||
# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
# Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
|
||||||
|
|
||||||
DISABLE_WS2812 = no
|
|
||||||
|
|
||||||
KEY_LOCK_ENABLE = yes
|
KEY_LOCK_ENABLE = yes
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
|
||||||
#OPT_DEFS = -DDEBUG_LEVEL=0
|
#OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c backlight.c
|
SRC = matrix.c backlight.c
|
||||||
|
|
||||||
LAYOUTS = ortho_5x12
|
LAYOUTS = ortho_5x12
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* 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 "quantum.h"
|
#include "mk1.h"
|
||||||
|
|
||||||
#define NUMLOCK_PIN D0
|
#define NUMLOCK_PIN D0
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com>
|
Copyright 2017 Danny Nguyen <danny@keeb.io>
|
||||||
|
|
||||||
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,11 +15,21 @@ 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
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void i2c_init(void);
|
// #define USE_I2C
|
||||||
void i2c_set_bitrate(uint16_t bitrate_khz);
|
#define EE_HANDS
|
||||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
|
||||||
|
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 12
|
||||||
|
#define RGBLIGHT_HUE_STEP 2
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
|
||||||
|
#ifndef NO_DEBUG
|
||||||
|
# define NO_DEBUG
|
||||||
|
#endif // !NO_DEBUG
|
||||||
|
#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE)
|
||||||
|
# define NO_PRINT
|
||||||
|
#endif // !NO_PRINT
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
#define _QWERTY 0
|
||||||
|
#define _LOWER 1
|
||||||
|
#define _RAISE 2
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {[0] = LAYOUT(KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_ENT, LCTL_T(KC_LGUI), KC_Z, KC_X, KC_C, KC_D, KC_V, LGUI(KC_L), MEH_T(KC_MINS), KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_LGUI, LT(1, KC_QUOT), KC_SFTENT, KC_SPC, LT(2, KC_BSLS), LALT_T(KC_APP)),
|
||||||
|
[1] = LAYOUT(KC_MPLY, KC_NO, KC_DQUO, KC_NO, LALT(KC_F4), KC_NO, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_NO, RESET, KC_MPRV, KC_END, KC_UP, KC_HOME, KC_PGUP, KC_NO, KC_P4, KC_P5, KC_P6, KC_PPLS, RGB_SAI, RGB_SAD, KC_MNXT, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_NO, KC_P1, KC_P2, KC_P3, KC_PAST, RGB_HUI, RGB_HUD, KC_NO, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_NO, LCA(KC_DEL), KC_NLCK, KC_P0, KC_P0, KC_PDOT, KC_PENT, RGB_SPI, RGB_SPD, KC_PSCR, KC_NO, KC_LGUI, RGB_TOG, RGB_VAI, RGB_VAD),
|
||||||
|
[2] = LAYOUT(KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_NO, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_K, KC_NO, KC_WH_D, KC_MS_U, KC_WH_U, KC_NO, KC_F12, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO)};
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
if (index == 0) {
|
||||||
|
switch (biton32(layer_state)) {
|
||||||
|
case _LOWER:
|
||||||
|
clockwise ? tap_code(KC_MS_WH_UP) : tap_code(KC_MS_WH_DOWN);
|
||||||
|
break;
|
||||||
|
case _RAISE:
|
||||||
|
clockwise ? rgblight_increase_hue() : rgblight_decrease_hue();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (index == 1) {
|
||||||
|
switch (biton32(layer_state)) {
|
||||||
|
case _LOWER:
|
||||||
|
clockwise ? tap_code(KC_UP) : tap_code(KC_DOWN);
|
||||||
|
break;
|
||||||
|
case _RAISE:
|
||||||
|
clockwise ? tap_code(KC_MEDIA_NEXT_TRACK) : tap_code(KC_MEDIA_PREV_TRACK);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
clockwise ? tap_code(KC_RIGHT) : tap_code(KC_LEFT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[Jerry's Iris R4 Layout](https://imgur.com/a/JLytcqS)
|
||||||
|
|
||||||
|
This is a fairly modified version of the default keymap that I tinkered with to allow the rotary encoder to carry out a different function on each layer.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = yes
|
||||||
|
MOUSEKEY_ENABLE = yes
|
||||||
@@ -1,25 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com>
|
Copyright 2019 Thomas Baart <thomas@splitkb.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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Please do not modify this file
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void i2c_init(void);
|
#include "config_common.h"
|
||||||
void i2c_set_bitrate(uint16_t bitrate_khz);
|
|
||||||
uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
|
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "Kyria",
|
||||||
|
"url": "https://splitkb.com",
|
||||||
|
"maintainer": "splitkb.com",
|
||||||
|
"width": 16.5,
|
||||||
|
"height": 5.5,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT": {
|
||||||
|
"layout": [
|
||||||
|
{"x":3, "y":0.25}, {"x":12.5, "y":0.25}, {"x":2, "y":0.5}, {"x":4, "y":0.5}, {"x":11.5, "y":0.5},
|
||||||
|
{"x":13.5, "y":0.5}, {"x":5, "y":0.75}, {"x":10.5, "y":0.75}, {"x":0, "y":1}, {"x":1, "y":1},
|
||||||
|
{"x":14.5, "y":1}, {"x":15.5, "y":1}, {"x":3, "y":1.25}, {"x":12.5, "y":1.25}, {"x":2, "y":1.5},
|
||||||
|
{"x":4, "y":1.5}, {"x":11.5, "y":1.5}, {"x":13.5, "y":1.5}, {"x":5, "y":1.75}, {"x":10.5, "y":1.75},
|
||||||
|
{"x":0, "y":2}, {"x":1, "y":2}, {"x":14.5, "y":2}, {"x":15.5, "y":2}, {"x":3, "y":2.25},
|
||||||
|
{"x":12.5, "y":2.25}, {"x":2, "y":2.5}, {"x":4, "y":2.5}, {"x":11.5, "y":2.5}, {"x":13.5, "y":2.5},
|
||||||
|
{"x":5, "y":2.75}, {"x":10.5, "y":2.75}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":14.5, "y":3},
|
||||||
|
{"x":15.5, "y":3}, {"x":6, "y":3.25}, {"x":9.5, "y":3.25}, {"x":2.5, "y":3.5}, {"x":3.5, "y":3.5},
|
||||||
|
{"x":7, "y":3.5}, {"x":8.5, "y":3.5}, {"x":12, "y":3.5}, {"x":13, "y":3.5}, {"x":4.5, "y":3.75},
|
||||||
|
{"x":11, "y":3.75}, {"x":5.5, "y":4.25}, {"x":10, "y":4.25}, {"x":6.5, "y":4.5}, {"x":9, "y":4.5}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
#define OLED_DISPLAY_128X64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLIGHT_HUE_STEP 8
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// If you are using an Elite C rev3 on the slave side, uncomment the lines below:
|
||||||
|
// #define SPLIT_USB_DETECT
|
||||||
|
// #define NO_USB_STARTUP_CHECK
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
enum layers {
|
||||||
|
_QWERTY = 0,
|
||||||
|
_LOWER,
|
||||||
|
_RAISE,
|
||||||
|
_ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/*
|
||||||
|
* Base Layer: QWERTY
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* |RAIS/ESC| Q | W | E | R | T | | Y | U | I | O | P | | \ |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* |Ctrl/BS | A | S | D | F | G | | H | J | K | L | ; : | ' " |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | LShift | Z | X | C | V | B |LShift|LShift| |LShift|LShift| N | M | , < | . > | / ? | - _ |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | GUI | Del | Enter| Space| Esc | | Enter| Space| Tab | Bksp | AltGr|
|
||||||
|
* | | | Alt | Lower| Raise| | Lower| Raise| | | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = LAYOUT(
|
||||||
|
LT(_RAISE, KC_ESC), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PIPE,
|
||||||
|
MT(MOD_LCTL, KC_BSPC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LSFT, KC_LSFT, KC_LSFT, KC_LSFT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
|
||||||
|
KC_LGUI, KC_DEL, MT(MOD_LALT, KC_ENT), LT(_LOWER, KC_SPC), LT(_RAISE, KC_ESC), LT(_LOWER, KC_ENT), LT(_RAISE, KC_SPC), KC_TAB, KC_BSPC, KC_RALT
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Lower Layer: Symbols
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | ! | @ | { | } | | | | | | | | | | \ |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | # | $ | ( | ) | ` | | + | - | / | * | % | ' " |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | % | ^ | [ | ] | ~ | | | | | | & | = | , | . | / ? | - _ |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | ; | = | | = | ; | | | |
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[_LOWER] = LAYOUT(
|
||||||
|
_______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, _______, _______, _______, _______, _______, KC_BSLS,
|
||||||
|
_______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_PERC, KC_QUOT,
|
||||||
|
_______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, _______, _______, _______, _______, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
|
||||||
|
_______, _______, _______, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, _______, _______, _______
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Raise Layer: Number keys, media, navigation
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | | Prev | Play | Next | VolUp| | Left | Down | Up | Right| | |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | | | | Mute | VolDn| | | | | | MLeft| Mdown| MUp |MRight| | |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[_RAISE] = LAYOUT(
|
||||||
|
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
|
||||||
|
_______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLU, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______,
|
||||||
|
_______, _______, _______, _______, KC_MUTE, KC_VOLD, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Adjust Layer: Function keys, RGB
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | TOG | SAI | HUI | VAI | MOD | | | | | F11 | F12 | |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | | SAD | HUD | VAD | RMOD | | | | | | | | | | | |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[_ADJUST] = LAYOUT(
|
||||||
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______,
|
||||||
|
_______, RGB_TOG, RGB_SAI, RGB_HUI, RGB_VAI, RGB_MOD, _______, _______, _______, KC_F11, KC_F12, _______,
|
||||||
|
_______, _______, RGB_SAD, RGB_HUD, RGB_VAD, RGB_RMOD,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
// /*
|
||||||
|
// * Layer template
|
||||||
|
// *
|
||||||
|
// * ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
// * | | | | | | | | | | | | | |
|
||||||
|
// * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
// * | | | | | | | | | | | | | |
|
||||||
|
// * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
// * | | | | | | | | | | | | | | | | | |
|
||||||
|
// * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
// * | | | | | | | | | | | |
|
||||||
|
// * | | | | | | | | | | | |
|
||||||
|
// * `----------------------------------' `----------------------------------'
|
||||||
|
// */
|
||||||
|
// [_LAYERINDEX] = LAYOUT(
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
// ),
|
||||||
|
};
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
|
return OLED_ROTATION_180;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_kyria_logo(void) {
|
||||||
|
static const char PROGMEM kyria_logo[] = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,240,252,255, 31, 7, 1, 0, 0,192,240,252,254,255,247,243,177,176, 48, 48, 48, 48, 48, 48, 48,120,254,135, 1, 0, 0,255,255, 0, 0, 1,135,254,120, 48, 48, 48, 48, 48, 48, 48,176,177,243,247,255,254,252,240,192, 0, 0, 1, 7, 31,255,252,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0,255,255,255, 0, 0, 0, 0, 0,254,255,255, 1, 1, 7, 30,120,225,129,131,131,134,134,140,140,152,152,177,183,254,248,224,255,255,224,248,254,183,177,152,152,140,140,134,134,131,131,129,225,120, 30, 7, 1, 1,255,255,254, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0,255,255, 0, 0,192,192, 48, 48, 0, 0,240,240, 0, 0, 0, 0, 0, 0,240,240, 0, 0,240,240,192,192, 48, 48, 48, 48,192,192, 0, 0, 48, 48,243,243, 0, 0, 0, 0, 0, 0, 48, 48, 48, 48, 48, 48,192,192, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0,255,255,255, 0, 0, 0, 0, 0,127,255,255,128,128,224,120, 30,135,129,193,193, 97, 97, 49, 49, 25, 25,141,237,127, 31, 7,255,255, 7, 31,127,237,141, 25, 25, 49, 49, 97, 97,193,193,129,135, 30,120,224,128,128,255,255,127, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0, 63, 63, 3, 3, 12, 12, 48, 48, 0, 0, 0, 0, 51, 51, 51, 51, 51, 51, 15, 15, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 63, 63, 48, 48, 0, 0, 12, 12, 51, 51, 51, 51, 51, 51, 63, 63, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 15, 63,255,248,224,128, 0, 0, 3, 15, 63,127,255,239,207,141, 13, 12, 12, 12, 12, 12, 12, 12, 30,127,225,128, 0, 0,255,255, 0, 0,128,225,127, 30, 12, 12, 12, 12, 12, 12, 12, 13,141,207,239,255,127, 63, 15, 3, 0, 0,128,224,248,255, 63, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 3, 7, 15, 62,124,248,240,224,192,128, 1, 3, 7, 15, 30, 28, 60, 56,120,112,112,224,224,225,231,254,248,255,255,248,254,231,225,224,224,112,112,120, 56, 60, 28, 30, 15, 7, 3, 1,128,192,224,240,248,124, 62, 15, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_qmk_logo(void) {
|
||||||
|
static const char PROGMEM qmk_logo[] = {
|
||||||
|
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
||||||
|
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
||||||
|
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
|
||||||
|
|
||||||
|
oled_write_P(qmk_logo, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_status(void) {
|
||||||
|
// QMK Logo and version information
|
||||||
|
render_qmk_logo();
|
||||||
|
oled_write_P(PSTR("Kyria rev1.0\n\n"), false);
|
||||||
|
|
||||||
|
// Host Keyboard Layer Status
|
||||||
|
oled_write_P(PSTR("Layer: "), false);
|
||||||
|
switch (get_highest_layer(layer_state)) {
|
||||||
|
case _QWERTY:
|
||||||
|
oled_write_P(PSTR("Default\n"), false);
|
||||||
|
break;
|
||||||
|
case _LOWER:
|
||||||
|
oled_write_P(PSTR("Lower\n"), false);
|
||||||
|
break;
|
||||||
|
case _RAISE:
|
||||||
|
oled_write_P(PSTR("Raise\n"), false);
|
||||||
|
break;
|
||||||
|
case _ADJUST:
|
||||||
|
oled_write_P(PSTR("Adjust\n"), false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
oled_write_P(PSTR("Undefined\n"), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host Keyboard LED Status
|
||||||
|
uint8_t led_usb_state = host_keyboard_leds();
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void oled_task_user(void) {
|
||||||
|
if (is_keyboard_master()) {
|
||||||
|
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
|
||||||
|
} else {
|
||||||
|
render_kyria_logo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
if (index == 0) {
|
||||||
|
// Volume control
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code(KC_VOLU);
|
||||||
|
} else {
|
||||||
|
tap_code(KC_VOLD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (index == 1) {
|
||||||
|
// Page up/Page down
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code(KC_PGDN);
|
||||||
|
} else {
|
||||||
|
tap_code(KC_PGUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays
|
||||||
|
ENCODER_ENABLE = yes # ENables the use of one or more encoders
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
#define OLED_DISPLAY_128X64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLIGHT_HUE_STEP 8
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
#define RGBLIGHT_SLEEP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// EC11K encoders have a different resolution than other EC11 encoders.
|
||||||
|
// When using the default resolution of 4, if you notice your encoder skipping
|
||||||
|
// every other tick, lower the resolution to 2.
|
||||||
|
#define ENCODER_RESOLUTION 2
|
||||||
|
|
||||||
|
// The Leader key allows to flexibly assign macros to key sequences.
|
||||||
|
#define LEADER_PER_KEY_TIMING
|
||||||
|
#define LEADER_TIMEOUT 350
|
||||||
|
|
||||||
|
#define TAPPING_TERM 200
|
||||||
|
|
||||||
|
// Allows to use either side as the master. Look at the documentation for info:
|
||||||
|
// https://docs.qmk.fm/#/config_options?id=setting-handedness
|
||||||
|
#define EE_HANDS
|
||||||
|
|
||||||
|
// Allows media codes to properly register in macros and rotary encoder code
|
||||||
|
#define TAP_CODE_DELAY 10
|
||||||
@@ -0,0 +1,333 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* 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 QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
uint16_t copy_paste_timer;
|
||||||
|
|
||||||
|
enum layers {
|
||||||
|
QWERTY = 0,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
NAV,
|
||||||
|
ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
KC_CCCV = SAFE_RANGE
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/*
|
||||||
|
* Base Layer: QWERTY
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | ESC | Q | W | E | R | T | | Y | U | I | O | P | | \ |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | LSFT | A | S | D | F | G | | H | J | K | L | ; : | ' " |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | LCTL | Z | X | C | V | B | CCCV | | | Del |Leader| N | M | , < | . > | / ? | - _ |
|
||||||
|
* `----------------------+------+------+------+------+ | |------+------+------+------+------+----------------------'
|
||||||
|
* | GUI | Alt | | Space| Enter| | Bspc | Space| | Tab | AltGr|
|
||||||
|
* | | | Lower| Shift| Alt | | | Nav | Raise| | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[QWERTY] = LAYOUT(
|
||||||
|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PIPE,
|
||||||
|
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
||||||
|
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_CCCV, XXXXXXX, KC_DEL, KC_LEAD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
|
||||||
|
KC_LGUI, KC_LALT, MO(LOWER), MT(MOD_LSFT, KC_SPC), MT(MOD_LALT, KC_ENT), KC_BSPC, LT(NAV, KC_SPC), MO(RAISE), KC_TAB, KC_RALT
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Lower Layer: Numpad, Media
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | | | VolUp| | | | / ? | 7 & | 8 * | 9 ( | - _ | |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | | Prev | Play | Next | | | * | 4 $ | 5 % | 6 ^ | , < | + |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | | | VolDn| Mute | | | | | | | 0 ) | 1 ! | 2 @ | 3 # | = + | |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | Lower| | | | | Nav | Raise| | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[LOWER] = LAYOUT(
|
||||||
|
_______, _______, _______, KC_VOLU, _______, _______, KC_SLSH, KC_7, KC_8, KC_9, KC_MINS, _______,
|
||||||
|
_______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, KC_ASTR, KC_4, KC_5, KC_6, KC_COMM, KC_PLUS,
|
||||||
|
_______, _______, _______, KC_VOLD, KC_MUTE, _______, _______, _______, _______, _______, KC_0, KC_1, KC_2, KC_3, KC_EQL, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Raise Layer: Symbols
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | ! | @ | { | } | | | | | _ | € | | | \ |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | # | $ | ( | ) | ` | | + | - | / | * | % | ' " |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | % | ^ | [ | ] | ~ | | | | | | & | = | , | . | / ? | - _ |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | Lower| | | | | Nav | Raise| | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[RAISE] = LAYOUT(
|
||||||
|
_______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, _______, KC_UNDS, ALGR(KC_5),_______,_______,KC_BSLS,
|
||||||
|
_______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_PERC, KC_QUOT,
|
||||||
|
_______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, _______, _______, _______, _______, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_SLSH, KC_MINS,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Navigation Layer
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | | | | | | | PgUp | Home | Up | End | | ScrlLk |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | | | | | | | PgDn | Left | Down | Right| | CapsLk |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | | | | | | | | | | | | | | | | |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | Lower| | | | | Nav | Raise| | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[NAV] = LAYOUT(
|
||||||
|
_______, _______, _______, _______, _______, _______, KC_PGUP, KC_HOME, KC_UP, KC_END, _______, KC_SLCK,
|
||||||
|
_______, _______, _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_CAPS,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
* Adjust Layer
|
||||||
|
*
|
||||||
|
* ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
* | | | | | | | | | F7 | F8 | F9 | F10 | |
|
||||||
|
* |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
* | | | SAI | HUI | VAI | | | | F4 | F5 | F6 | F11 | |
|
||||||
|
* |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
* | | | SAD | HUD | VAD | | | | | | | | F1 | F2 | F3 | F12 | |
|
||||||
|
* `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* | | | | | | | | | | | |
|
||||||
|
* `----------------------------------' `----------------------------------'
|
||||||
|
*/
|
||||||
|
[ADJUST] = LAYOUT(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, _______,
|
||||||
|
_______, _______, RGB_SAI, RGB_HUI, RGB_VAI, _______, _______, KC_F4, KC_F5, KC_F6, KC_F11, _______,
|
||||||
|
_______, _______, RGB_SAD, RGB_HUD, RGB_VAD, _______, _______, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F12, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
// /*
|
||||||
|
// * Layer template
|
||||||
|
// *
|
||||||
|
// * ,-------------------------------------------. ,-------------------------------------------.
|
||||||
|
// * | | | | | | | | | | | | | |
|
||||||
|
// * |--------+------+------+------+------+------| |------+------+------+------+------+--------|
|
||||||
|
// * | | | | | | | | | | | | | |
|
||||||
|
// * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------|
|
||||||
|
// * | | | | | | | | | | | | | | | | | |
|
||||||
|
// * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------'
|
||||||
|
// * | | | | | | | | | | | |
|
||||||
|
// * | | | | | | | | | | | |
|
||||||
|
// * `----------------------------------' `----------------------------------'
|
||||||
|
// */
|
||||||
|
// [_LAYERINDEX] = LAYOUT(
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
// _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
// ),
|
||||||
|
};
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
return update_tri_layer_state(state, LOWER, RAISE, ADJUST);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case KC_CCCV: // One key copy/paste
|
||||||
|
if (record->event.pressed) {
|
||||||
|
copy_paste_timer = timer_read();
|
||||||
|
} else {
|
||||||
|
if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
|
||||||
|
tap_code16(LCTL(KC_C));
|
||||||
|
} else { // Tap, paste
|
||||||
|
tap_code16(LCTL(KC_V));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LEADER_EXTERNS();
|
||||||
|
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
LEADER_DICTIONARY() {
|
||||||
|
leading = false;
|
||||||
|
leader_end();
|
||||||
|
|
||||||
|
SEQ_ONE_KEY(KC_C) { // Inline Code
|
||||||
|
SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT));
|
||||||
|
}
|
||||||
|
SEQ_ONE_KEY(KC_P) { // Invoke Password Manager
|
||||||
|
SEND_STRING(SS_LCTRL(SS_LALT("\\")));
|
||||||
|
}
|
||||||
|
SEQ_ONE_KEY(KC_S) { // Windows screenshot
|
||||||
|
SEND_STRING(SS_LGUI("\nS"));
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_F, KC_P) { // Fusion Projection prefix
|
||||||
|
SEND_STRING("[Projection] ");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_E, KC_S) { // Email splitkb
|
||||||
|
SEND_STRING("[email protected]");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_E, KC_P) { // Email personal
|
||||||
|
SEND_STRING("[email protected]");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_S, KC_D) { // Splitkb documentation
|
||||||
|
SEND_STRING("https://docs.splitkb.com/");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_S, KC_V) { // Splitkb VAT number
|
||||||
|
SEND_STRING("NL210593349B01");
|
||||||
|
}
|
||||||
|
SEQ_THREE_KEYS(KC_S, KC_D, KC_K) { // Splitkb Kyria build log
|
||||||
|
SEND_STRING("https://docs.splitkb.com/docs/kyria-build-log/");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_B, KC_C) { // Discord bongocat
|
||||||
|
SEND_STRING(":bongocat:\n");
|
||||||
|
}
|
||||||
|
SEQ_TWO_KEYS(KC_C, KC_B) { // Discord code block
|
||||||
|
SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef OLED_DRIVER_ENABLE
|
||||||
|
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||||
|
return OLED_ROTATION_180;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_kyria_logo(void) {
|
||||||
|
static const char PROGMEM kyria_logo[] = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0,240,252,255, 31, 7, 1, 0, 0,192,240,252,254,255,247,243,177,176, 48, 48, 48, 48, 48, 48, 48,120,254,135, 1, 0, 0,255,255, 0, 0, 1,135,254,120, 48, 48, 48, 48, 48, 48, 48,176,177,243,247,255,254,252,240,192, 0, 0, 1, 7, 31,255,252,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0,255,255,255, 0, 0, 0, 0, 0,254,255,255, 1, 1, 7, 30,120,225,129,131,131,134,134,140,140,152,152,177,183,254,248,224,255,255,224,248,254,183,177,152,152,140,140,134,134,131,131,129,225,120, 30, 7, 1, 1,255,255,254, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0,255,255, 0, 0,192,192, 48, 48, 0, 0,240,240, 0, 0, 0, 0, 0, 0,240,240, 0, 0,240,240,192,192, 48, 48, 48, 48,192,192, 0, 0, 48, 48,243,243, 0, 0, 0, 0, 0, 0, 48, 48, 48, 48, 48, 48,192,192, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0,255,255,255, 0, 0, 0, 0, 0,127,255,255,128,128,224,120, 30,135,129,193,193, 97, 97, 49, 49, 25, 25,141,237,127, 31, 7,255,255, 7, 31,127,237,141, 25, 25, 49, 49, 97, 97,193,193,129,135, 30,120,224,128,128,255,255,127, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0, 63, 63, 3, 3, 12, 12, 48, 48, 0, 0, 0, 0, 51, 51, 51, 51, 51, 51, 15, 15, 0, 0, 63, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 63, 63, 48, 48, 0, 0, 12, 12, 51, 51, 51, 51, 51, 51, 63, 63, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 15, 63,255,248,224,128, 0, 0, 3, 15, 63,127,255,239,207,141, 13, 12, 12, 12, 12, 12, 12, 12, 30,127,225,128, 0, 0,255,255, 0, 0,128,225,127, 30, 12, 12, 12, 12, 12, 12, 12, 13,141,207,239,255,127, 63, 15, 3, 0, 0,128,224,248,255, 63, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 3, 7, 15, 62,124,248,240,224,192,128, 1, 3, 7, 15, 30, 28, 60, 56,120,112,112,224,224,225,231,254,248,255,255,248,254,231,225,224,224,112,112,120, 56, 60, 28, 30, 15, 7, 3, 1,128,192,224,240,248,124, 62, 15, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_qmk_logo(void) {
|
||||||
|
static const char PROGMEM qmk_logo[] = {
|
||||||
|
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
||||||
|
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
||||||
|
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
|
||||||
|
|
||||||
|
oled_write_P(qmk_logo, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void render_status(void) {
|
||||||
|
// QMK Logo and version information
|
||||||
|
render_qmk_logo();
|
||||||
|
oled_write_P(PSTR(" Kyria rev1.0\n\n"), false);
|
||||||
|
|
||||||
|
// Host Keyboard Layer Status
|
||||||
|
oled_write_P(PSTR("Layer: "), false);
|
||||||
|
switch (get_highest_layer(layer_state)) {
|
||||||
|
case QWERTY:
|
||||||
|
oled_write_P(PSTR("Default\n"), false);
|
||||||
|
break;
|
||||||
|
case LOWER:
|
||||||
|
oled_write_P(PSTR("Lower\n"), false);
|
||||||
|
break;
|
||||||
|
case RAISE:
|
||||||
|
oled_write_P(PSTR("Raise\n"), false);
|
||||||
|
break;
|
||||||
|
case NAV:
|
||||||
|
oled_write_P(PSTR("Navigation\n"), false);
|
||||||
|
break;
|
||||||
|
case ADJUST:
|
||||||
|
oled_write_P(PSTR("Adjust\n"), false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
oled_write_P(PSTR("Undefined\n"), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host Keyboard LED Status
|
||||||
|
uint8_t led_usb_state = host_keyboard_leds();
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
|
||||||
|
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void oled_task_user(void) {
|
||||||
|
if (is_keyboard_master()) {
|
||||||
|
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
|
||||||
|
} else {
|
||||||
|
render_kyria_logo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
if (index == 0) {
|
||||||
|
switch (biton32(layer_state)) {
|
||||||
|
case QWERTY:
|
||||||
|
// Move whole words. Hold shift to select while moving.
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code16(C(KC_RGHT));
|
||||||
|
} else {
|
||||||
|
tap_code16(C(KC_LEFT));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// History scrubbing. For Adobe products, hold shift while moving
|
||||||
|
// backward to go forward instead.
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code16(C(KC_Z));
|
||||||
|
} else {
|
||||||
|
tap_code16(C(KC_Y));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (index == 1) {
|
||||||
|
switch (biton32(layer_state)) {
|
||||||
|
case QWERTY:
|
||||||
|
// Scrolling with PageUp and PgDn.
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code(KC_PGDN);
|
||||||
|
} else {
|
||||||
|
tap_code(KC_PGUP);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Volume control.
|
||||||
|
if (clockwise) {
|
||||||
|
tap_code(KC_VOLU);
|
||||||
|
} else {
|
||||||
|
tap_code(KC_VOLD);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays
|
||||||
|
ENCODER_ENABLE = yes # Enables the use of one or more encoders
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
|
LEADER_ENABLE = yes # Enable the Leader Key feature
|
||||||
|
MOUSEKEY_ENABLE = no
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* 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 "kyria.h"
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
/* This a shortcut to help you visually see your layout.
|
||||||
|
*
|
||||||
|
* The first section contains all of the arguments representing the physical
|
||||||
|
* layout of the board and position of the keys.
|
||||||
|
*
|
||||||
|
* The second converts the arguments into a two-dimensional array which
|
||||||
|
* represents the switch matrix.
|
||||||
|
*/
|
||||||
|
#define LAYOUT( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R06, R07, R08, R09, R10, R11, \
|
||||||
|
L12, L13, L14, L15, L16, L17, R18, R19, R20, R21, R22, R23, \
|
||||||
|
L24, L25, L26, L27, L28, L29, L30, L31, R32, R33, R34, R35, R36, R37, R38, R39, \
|
||||||
|
L40, L41, L42, L43, L44, R45, R46, R47, R48, R49 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ KC_NO, KC_NO, L05, L04, L03, L02, L01, L00 }, \
|
||||||
|
{ KC_NO, KC_NO, L17, L16, L15, L14, L13, L12 }, \
|
||||||
|
{ L31, L30, L29, L28, L27, L26, L25, L24 }, \
|
||||||
|
{ L44, L43, L42, L41, L40, KC_NO, KC_NO, KC_NO }, \
|
||||||
|
{ KC_NO, KC_NO, R06, R07, R08, R09, R10, R11 }, \
|
||||||
|
{ KC_NO, KC_NO, R18, R19, R20, R21, R22, R23 }, \
|
||||||
|
{ R32, R33, R34, R35, R36, R37, R38, R39 }, \
|
||||||
|
{ R45, R46, R47, R48, R49, KC_NO, KC_NO, KC_NO }, \
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Kyria
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
An ergonomical 40% split keyboard
|
||||||
|
|
||||||
|
Keyboard Maintainer: [splitkb.com](https://github.com/splitkb)
|
||||||
|
Hardware Supported: Pro Micro 5V/16MHz and compatible.
|
||||||
|
Hardware Availability: [splitkb.com](https://splitkb.com) and partners.
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make kyria:default
|
||||||
|
|
||||||
|
Example of flashing this keyboard:
|
||||||
|
|
||||||
|
make kyria/rev1:default:flash
|
||||||
|
|
||||||
|
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||||
|
|
||||||
|
A build guide for the Kyria can be found at [docs.splitkb.com](https://docs.splitkb.com/docs/kyria-build-log/).
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x0000
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
#define MANUFACTURER splitkb
|
||||||
|
#define PRODUCT Kyria Keyboard
|
||||||
|
#define DESCRIPTION Split 40 percent ergonomic keyboard
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
/* Rows are doubled up */
|
||||||
|
#define MATRIX_ROWS 8
|
||||||
|
#define MATRIX_COLS 8
|
||||||
|
|
||||||
|
// wiring
|
||||||
|
#define MATRIX_ROW_PINS { B4, E6, D7, D4 }
|
||||||
|
#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
#define ENCODERS_PAD_A { C6 }
|
||||||
|
#define ENCODERS_PAD_B { B5 }
|
||||||
|
#define ENCODERS_PAD_A_RIGHT { B5 }
|
||||||
|
#define ENCODERS_PAD_B_RIGHT { C6 }
|
||||||
|
|
||||||
|
/* COL2ROW, ROW2COL*/
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||||
|
*/
|
||||||
|
#define SOFT_SERIAL_PIN D2
|
||||||
|
|
||||||
|
#define RGB_DI_PIN D3
|
||||||
|
#define RGBLED_SPLIT { 10, 10 }
|
||||||
|
#define RGBLED_NUM 20
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "rev1.h"
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* Copyright 2019 Thomas Baart <[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "kyria.h"
|
||||||
|
|
||||||
|
/* This a shortcut to help you visually see your layout.
|
||||||
|
*
|
||||||
|
* The first section contains all of the arguments representing the physical
|
||||||
|
* layout of the board and position of the keys.
|
||||||
|
*
|
||||||
|
* The second converts the arguments into a two-dimensional array which
|
||||||
|
* represents the switch matrix.
|
||||||
|
*/
|
||||||
|
#define LAYOUT( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R06, R07, R08, R09, R10, R11, \
|
||||||
|
L12, L13, L14, L15, L16, L17, R18, R19, R20, R21, R22, R23, \
|
||||||
|
L24, L25, L26, L27, L28, L29, L30, L31, R32, R33, R34, R35, R36, R37, R38, R39, \
|
||||||
|
L40, L41, L42, L43, L44, R45, R46, R47, R48, R49 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ KC_NO, KC_NO, L05, L04, L03, L02, L01, L00 }, \
|
||||||
|
{ KC_NO, KC_NO, L17, L16, L15, L14, L13, L12 }, \
|
||||||
|
{ L31, L30, L29, L28, L27, L26, L25, L24 }, \
|
||||||
|
{ L44, L43, L42, L41, L40, KC_NO, KC_NO, KC_NO }, \
|
||||||
|
{ KC_NO, KC_NO, R06, R07, R08, R09, R10, R11 }, \
|
||||||
|
{ KC_NO, KC_NO, R18, R19, R20, R21, R22, R23 }, \
|
||||||
|
{ R32, R33, R34, R35, R36, R37, R38, R39 }, \
|
||||||
|
{ R45, R46, R47, R48, R49, KC_NO, KC_NO, KC_NO }, \
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays
|
||||||
|
ENCODER_ENABLE = yes # ENables the use of one or more encoders
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# MCU name
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Bootloader selection
|
||||||
|
# Teensy halfkay
|
||||||
|
# Pro Micro caterina
|
||||||
|
# Atmel DFU atmel-dfu
|
||||||
|
# LUFA DFU lufa-dfu
|
||||||
|
# QMK DFU qmk-dfu
|
||||||
|
# ATmega32A bootloadHID
|
||||||
|
# ATmega328P USBasp
|
||||||
|
BOOTLOADER = atmel-dfu
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change yes to no to disable
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
|
MIDI_ENABLE = no # MIDI support
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
|
||||||
|
SPLIT_KEYBOARD = yes # Split common
|
||||||
|
LINK_TIME_OPTIMIZATION_ENABLE =yes
|
||||||
|
|
||||||
|
DEFAULT_FOLDER = kyria/rev1
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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/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,22 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
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 __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
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,10 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
@@ -16,61 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "v1.h"
|
#include "v1.h"
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
// for keyboard subdirectory level init functions
|
void matrix_init_kb(void) { matrix_init_user(); }
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
__attribute__ ((weak))
|
||||||
extern rgblight_config_t rgblight_config;
|
void matrix_init_user(void) {}
|
||||||
|
|
||||||
// custom RGB driver
|
void matrix_scan_kb(void) { matrix_scan_user(); }
|
||||||
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();
|
__attribute__ ((weak))
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
void matrix_scan_user(void) {}
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
#else
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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,27 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -16,66 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mehkee96.h"
|
#include "mehkee96.h"
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
void matrix_init_kb(void) { matrix_init_user(); }
|
||||||
|
|
||||||
#include "action_layer.h"
|
__attribute__ ((weak))
|
||||||
#include "i2c.h"
|
void matrix_init_user(void) {}
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
// for keyboard subdirectory level init functions
|
void matrix_scan_kb(void) { matrix_scan_user(); }
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
__attribute__ ((weak))
|
||||||
extern rgblight_config_t rgblight_config;
|
void matrix_scan_user(void) {}
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ANIMATION
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -21,10 +21,10 @@ CONSOLE_ENABLE = yes # Console for debug(+400)
|
|||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
@@ -17,8 +17,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
[FUN] = LAYOUT(
|
[FUN] = LAYOUT(
|
||||||
EEP_RST, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 ,
|
EEP_RST, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 ,
|
||||||
KC_TAB , _______, KC_MS_U, _______, KC_BTN3, _______, RGB_MOD, DM_STRT, _______, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_F12 ,
|
KC_TAB , _______, KC_MS_U, _______, KC_BTN3, _______, RGB_MOD, DM_STRT, _______, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_F12 ,
|
||||||
KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, _______, _______,
|
KC_HOME, KC_MS_L, KC_MS_D, KC_MS_R, KC_BTN1, _______, RGB_HUI, _______, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, _______, _______,
|
||||||
KC_END , KC_PSCR, KC_INS , _______, KC_BTN2, _______, _______, DM_STOP, _______, _______, _______, _______, KC_BSLS, KC_PIPE,
|
KC_END , KC_PSCR, KC_INS , _______, KC_BTN2, _______, RGB_HUD, DM_STOP, _______, _______, _______, _______, KC_BSLS, KC_PIPE,
|
||||||
_______, _______,
|
_______, _______,
|
||||||
KC_DEL , KC_ENT ,
|
KC_DEL , KC_ENT ,
|
||||||
_______, _______,
|
_______, _______,
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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/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,25 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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 __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
|
|
||||||
+1
-28
@@ -13,32 +13,5 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mt40.h"
|
#include "mt40.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_kb(void) {
|
|
||||||
rgblight_task();
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
@@ -24,14 +24,14 @@ AUDIO_ENABLE ?= no # Audio output on port C6
|
|||||||
UNICODE_ENABLE ?= no # Unicode
|
UNICODE_ENABLE ?= no # Unicode
|
||||||
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE ?= yes # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE ?= yes # Enable WS2812 RGB underlight.
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
TAP_DANCE_ENABLE = no
|
TAP_DANCE_ENABLE = no
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
|
|
||||||
LAYOUTS = planck_mit
|
LAYOUTS = planck_mit
|
||||||
LAYOUTS_HAS_RGB = no
|
LAYOUTS_HAS_RGB = no
|
||||||
+18
-37
@@ -13,52 +13,33 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "panc60.h"
|
#include "panc60.h"
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D0);
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D1);
|
||||||
|
setPinOutput(D4);
|
||||||
|
setPinOutput(D6);
|
||||||
|
|
||||||
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// Turn out the lights
|
// Turn out the lights
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// Turn on the lights
|
// Turn on the lights
|
||||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinHigh(D0);
|
||||||
|
writePinHigh(D1);
|
||||||
|
writePinHigh(D4);
|
||||||
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -31,14 +16,11 @@ BOOTMAGIC_ENABLE = no
|
|||||||
MOUSEKEY_ENABLE = yes
|
MOUSEKEY_ENABLE = yes
|
||||||
EXTRAKEY_ENABLE = yes
|
EXTRAKEY_ENABLE = yes
|
||||||
CONSOLE_ENABLE = yes
|
CONSOLE_ENABLE = yes
|
||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = no
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
|
||||||
SRC = i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = 60_ansi 60_hhkb
|
LAYOUTS = 60_ansi 60_hhkb
|
||||||
+5
-47
@@ -15,49 +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 "rgblight.h"
|
#include "pearl.h"
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -74,17 +32,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,9 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
|
||||||
SRC = i2c_master.c
|
|
||||||
@@ -16,81 +16,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "canoe.h"
|
#include "canoe.h"
|
||||||
#ifdef BACKLIGHT_ENABLE
|
|
||||||
#include "backlight.h"
|
void matrix_init_kb(void) { matrix_init_user(); }
|
||||||
#endif
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
__attribute__ ((weak))
|
||||||
#include "i2c.h"
|
void matrix_init_user(void) {}
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
void matrix_scan_kb(void) { matrix_scan_user(); }
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {}
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// Turn out the lights
|
// Turn out the lights
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// Turn on the lights
|
// Turn on the lights
|
||||||
PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
writePinHigh(D0);
|
||||||
|
writePinHigh(D1);
|
||||||
|
writePinHigh(D4);
|
||||||
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D0);
|
||||||
PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
|
setPinOutput(D1);
|
||||||
}
|
setPinOutput(D4);
|
||||||
|
setPinOutput(D6);
|
||||||
|
|
||||||
|
writePinLow(D0);
|
||||||
|
writePinLow(D1);
|
||||||
|
writePinLow(D4);
|
||||||
|
writePinLow(D6);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for keyboard subdirectory level init functions
|
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
#else
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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,27 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,12 +19,12 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c
|
SRC = matrix.c
|
||||||
|
|
||||||
LAYOUTS = 65_ansi_blocker
|
LAYOUTS = 65_ansi_blocker
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2016 Luiz Ribeiro <[email protected]>
|
|
||||||
|
|
||||||
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,18 +1,3 @@
|
|||||||
# Copyright 2018 Jumail Mundekkat / MxBlue
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,9 +19,9 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
BACKLIGHT_CUSTOM_DRIVER = yes
|
BACKLIGHT_CUSTOM_DRIVER = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
@@ -45,4 +30,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||||||
|
|
||||||
# custom matrix setup
|
# custom matrix setup
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
SRC = matrix.c i2c.c backlight.c
|
SRC = matrix.c backlight.c
|
||||||
@@ -19,23 +19,18 @@ ps2avrGB support code by Kenneth A. (bminiex/.[ch])
|
|||||||
|
|
||||||
#include "skog.h"
|
#include "skog.h"
|
||||||
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "backlight_custom.h"
|
#include "backlight_custom.h"
|
||||||
|
|
||||||
// for keyboard subdirectory level init functions
|
void matrix_init_kb(void) { matrix_init_user(); }
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
__attribute__ ((weak))
|
||||||
// call user level keymaps, if any
|
void matrix_init_user(void) {}
|
||||||
matrix_init_user();
|
|
||||||
}
|
void matrix_scan_kb(void) { matrix_scan_user(); }
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {}
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
/// Overrides functions in `quantum.c`
|
/// Overrides functions in `quantum.c`
|
||||||
@@ -51,48 +46,3 @@ void backlight_set(uint8_t level) {
|
|||||||
b_led_set(level);
|
b_led_set(level);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
#else
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) // overridable
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,8 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC = i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = tkl_ansi
|
LAYOUTS = tkl_ansi
|
||||||
@@ -13,49 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#include "skog_lite.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
[FUN] = LAYOUT_planck_grid(
|
[FUN] = LAYOUT_planck_grid(
|
||||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, RESET, EEP_RST, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 ,
|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, RESET, EEP_RST, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 ,
|
||||||
KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R,
|
KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R,
|
||||||
LGT_TOG, LGT_MOD, LGT_BRT, _______, _______, DM_STRT, DM_STOP, _______, _______, KC_BTN1, KC_BTN2, KC_BTN3,
|
LGT_TOG, LGT_MOD, LGT_BRT, LGT_INC, LGT_DEC, DM_STRT, DM_STOP, _______, _______, KC_BTN1, KC_BTN2, KC_BTN3,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC = i2c_master.c
|
|
||||||
+4
-45
@@ -13,49 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#include "singa.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,41 +15,4 @@ 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 <string.h>
|
#include "alice.h"
|
||||||
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
i2c_init();
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
// custom RGB driver
|
|
||||||
void rgblight_set(void) {
|
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
memset(led, 0, 3 * RGBLED_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool rgb_init = false;
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// if LEDs were previously on before poweroff, turn them back on
|
|
||||||
if (rgb_init == false && rgblight_config.enable) {
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
rgb_init = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
rgblight_task();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC += i2c_master.c
|
|
||||||
@@ -13,49 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#include "jane.h"
|
||||||
#include "rgblight.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,10 +19,8 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGBLIGHT_CUSTOM_DRIVER = no
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
QUANTUM_LIB_SRC = i2c_master.c
|
|
||||||
|
|
||||||
LAYOUTS = tkl_ansi tkl_iso
|
LAYOUTS = tkl_ansi tkl_iso
|
||||||
@@ -18,7 +18,6 @@ To enable RGB lighting support, install the necessary components and set RGBLIGH
|
|||||||
|
|
||||||
```
|
```
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes
|
|||||||
COMMAND_ENABLE = yes
|
COMMAND_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
RGBLIGHT_CUSTOM_DRIVER = no
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
SRC = i2c_master.c
|
|
||||||
@@ -14,49 +14,7 @@
|
|||||||
* 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 "i2c_master.h"
|
#include "unikorn.h"
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
#include "rgblight.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -73,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,14 +53,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_LEVELS 3
|
#define BACKLIGHT_LEVELS 3
|
||||||
#define BACKLIGHT_ON_STATE 0
|
#define BACKLIGHT_ON_STATE 0
|
||||||
|
|
||||||
#define RGBLIGHT_CUSTOM_DRIVER
|
//#define RGB_DI_PIN 0
|
||||||
#define RGBLIGHT_ANIMATIONS
|
|
||||||
#define RGBLED_NUM 1
|
#define RGBLED_NUM 1
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGB_STEP 16
|
||||||
|
|
||||||
#define RGB_RED_PIN PF6
|
#define RGB_RED_PIN PF6
|
||||||
#define RGB_GREEN_PIN PF5
|
#define RGB_GREEN_PIN PF5
|
||||||
#define RGB_BLUE_PIN PF4
|
#define RGB_BLUE_PIN PF4
|
||||||
#define RGB_DI_PIN 0
|
|
||||||
#define RGB_STEP 16
|
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -17,18 +17,21 @@ BOOTLOADER = atmel-dfu
|
|||||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
|
||||||
RGBLIGHT_ENABLE = yes # Enable the RGB Underglow
|
RGBLIGHT_ENABLE = yes # Enable the RGB Underglow
|
||||||
|
RGBLIGHT_CUSTOM_DRIVER = yes
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
|
|
||||||
|
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||||
|
|
||||||
LAYOUTS = 60_ansi 60_iso
|
LAYOUTS = 60_ansi 60_iso
|
||||||
@@ -18,13 +18,7 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
// if we've got an RGB underglow!
|
// if we've got an RGB underglow!
|
||||||
#ifdef V60_POLESTAR
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
|
|
||||||
#define SOFTPWM_LED_TIMER_TOP F_CPU/(256*64)
|
#define SOFTPWM_LED_TIMER_TOP F_CPU/(256*64)
|
||||||
|
|
||||||
@@ -191,4 +185,4 @@ ISR(TIMER3_COMPA_vect)
|
|||||||
softpwm_buff[2] = led[0].b;
|
softpwm_buff[2] = led[0].b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // V60_POLESTAR
|
#endif // RGBLIGHT_ENABLE
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef V60_POLESTAR
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
#include "rgblight.h"
|
#include "rgblight.h"
|
||||||
|
|
||||||
|
|||||||
@@ -13,49 +13,8 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
#include "rgblight.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#include "bface.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_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (rgblight_config.enable) {
|
|
||||||
i2c_init();
|
|
||||||
i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
// initialize pins D0, D1, D4 and D6 as output
|
||||||
@@ -72,17 +31,17 @@ void backlight_init_ports(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
void backlight_set(uint8_t level) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// turn backlight LEDs off
|
// turn backlight LEDs off
|
||||||
writePinLow(D0);
|
writePinLow(D0);
|
||||||
writePinLow(D1);
|
writePinLow(D1);
|
||||||
writePinLow(D4);
|
writePinLow(D4);
|
||||||
writePinLow(D6);
|
writePinLow(D6);
|
||||||
} else {
|
} else {
|
||||||
// turn backlight LEDs on
|
// turn backlight LEDs on
|
||||||
writePinHigh(D0);
|
writePinHigh(D0);
|
||||||
writePinHigh(D1);
|
writePinHigh(D1);
|
||||||
writePinHigh(D4);
|
writePinHigh(D4);
|
||||||
writePinHigh(D6);
|
writePinHigh(D6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,9 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "quantum_keycodes.h"
|
#include "quantum.h"
|
||||||
#include "keycode.h"
|
|
||||||
#include "action.h"
|
|
||||||
|
|
||||||
#define LAYOUT_60_ansi( \
|
#define LAYOUT_60_ansi( \
|
||||||
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, \
|
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, \
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
# Copyright 2017 Luiz Ribeiro <[email protected]>
|
|
||||||
#
|
|
||||||
# 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 name
|
||||||
MCU = atmega32a
|
MCU = atmega32a
|
||||||
|
|
||||||
@@ -36,9 +21,6 @@ BACKLIGHT_ENABLE = yes
|
|||||||
BACKLIGHT_CUSTOM_DRIVER = yes
|
BACKLIGHT_CUSTOM_DRIVER = yes
|
||||||
BACKLIGHT_BREATHING = no
|
BACKLIGHT_BREATHING = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
# custom matrix setup
|
|
||||||
SRC = i2c_master.c
|
|
||||||
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user