Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29630e6e49 | ||
|
|
a836c85e54 | ||
|
|
511fa5f815 | ||
|
|
a510e5212b | ||
|
|
2b83b908dd | ||
|
|
25d4c0c810 | ||
|
|
3a215195ed | ||
|
|
a4d138645f | ||
|
|
363cdb5fc0 | ||
|
|
be6562a223 | ||
|
|
732d1dd4f6 |
No files matched your search
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,12 @@ void oled_write_P(const char *data, bool invert);
|
|||||||
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
||||||
void oled_write_ln_P(const char *data, bool invert);
|
void oled_write_ln_P(const char *data, bool invert);
|
||||||
|
|
||||||
|
// Writes a string to the buffer at current cursor position
|
||||||
|
void oled_write_raw(const char *data, uint16_t size);
|
||||||
|
|
||||||
|
// Writes a PROGMEM string to the buffer at current cursor position
|
||||||
|
void oled_write_raw_P(const char *data, uint16_t size);
|
||||||
|
|
||||||
// Can be used to manually turn on the screen if it is off
|
// Can be used to manually turn on the screen if it is off
|
||||||
// Returns true if the screen was on or turns on
|
// Returns true if the screen was on or turns on
|
||||||
bool oled_on(void);
|
bool oled_on(void);
|
||||||
|
|||||||
@@ -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). Это особенно удобно, когда ваша проблема потребует длительного обсуждения или отладки.
|
||||||
@@ -431,6 +431,15 @@ void oled_write_ln(const char *data, bool invert) {
|
|||||||
oled_advance_page(true);
|
oled_advance_page(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void oled_write_raw(const char *data, uint16_t size) {
|
||||||
|
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||||
|
for (uint16_t i = 0; i < size; i++) {
|
||||||
|
if (oled_buffer[i] == data[i]) continue;
|
||||||
|
oled_buffer[i] = data[i];
|
||||||
|
oled_dirty |= (1 << (i / OLED_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
void oled_write_P(const char *data, bool invert) {
|
void oled_write_P(const char *data, bool invert) {
|
||||||
uint8_t c = pgm_read_byte(data);
|
uint8_t c = pgm_read_byte(data);
|
||||||
@@ -444,6 +453,16 @@ void oled_write_ln_P(const char *data, bool invert) {
|
|||||||
oled_write_P(data, invert);
|
oled_write_P(data, invert);
|
||||||
oled_advance_page(true);
|
oled_advance_page(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void oled_write_raw_P(const char *data, uint16_t size) {
|
||||||
|
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||||
|
for (uint16_t i = 0; i < size; i++) {
|
||||||
|
uint8_t c = pgm_read_byte(++data);
|
||||||
|
if (oled_buffer[i] == c) continue;
|
||||||
|
oled_buffer[i] = c;
|
||||||
|
oled_dirty |= (1 << (i / OLED_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif // defined(__AVR__)
|
#endif // defined(__AVR__)
|
||||||
|
|
||||||
bool oled_on(void) {
|
bool oled_on(void) {
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ void oled_write(const char *data, bool invert);
|
|||||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||||
void oled_write_ln(const char *data, bool invert);
|
void oled_write_ln(const char *data, bool invert);
|
||||||
|
|
||||||
|
void oled_write_raw(const char *data, uint16_t size);
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
// Writes a PROGMEM string to the buffer at current cursor position
|
// Writes a PROGMEM string to the buffer at current cursor position
|
||||||
// Advances the cursor while writing, inverts the pixels if true
|
// Advances the cursor while writing, inverts the pixels if true
|
||||||
@@ -211,6 +213,8 @@ void oled_write_P(const char *data, bool invert);
|
|||||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||||
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
||||||
void oled_write_ln_P(const char *data, bool invert);
|
void oled_write_ln_P(const char *data, bool invert);
|
||||||
|
|
||||||
|
void oled_write_raw_P(const char *data, uint16_t size);
|
||||||
#else
|
#else
|
||||||
// Writes a string to the buffer at current cursor position
|
// Writes a string to the buffer at current cursor position
|
||||||
// Advances the cursor while writing, inverts the pixels if true
|
// Advances the cursor while writing, inverts the pixels if true
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
+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
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -174,18 +174,12 @@ uint8_t matrix_scan(void) {
|
|||||||
}else{
|
}else{
|
||||||
matrix_slave_scan();
|
matrix_slave_scan();
|
||||||
|
|
||||||
// if(serial_slave_DATA_CORRUPT()){
|
|
||||||
// TXLED0;
|
|
||||||
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
||||||
|
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
matrix[offset+i] = serial_master_buffer[i];
|
matrix[offset+i] = serial_master_buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// }else{
|
|
||||||
// TXLED1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
matrix_scan_quantum();
|
matrix_scan_quantum();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#include "pro_micro.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -202,18 +202,12 @@ uint8_t matrix_scan(void)
|
|||||||
}else{
|
}else{
|
||||||
matrix_slave_scan();
|
matrix_slave_scan();
|
||||||
|
|
||||||
// if(serial_slave_DATA_CORRUPT()){
|
|
||||||
// TXLED0;
|
|
||||||
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
||||||
|
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
matrix[offset+i] = serial_master_buffer[i];
|
matrix[offset+i] = serial_master_buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// }else{
|
|
||||||
// TXLED1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
matrix_scan_quantum();
|
matrix_scan_quantum();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -27,12 +27,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MATRIX_ROWS 6
|
#define MATRIX_ROWS 6
|
||||||
#define MATRIX_COLS 4
|
#define MATRIX_COLS 4
|
||||||
|
|
||||||
// 0 1 2 3 4 5
|
|
||||||
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5 }
|
#define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5 }
|
||||||
#define MATRIX_COL_PINS { A0, A1, A2, A3 }
|
#define MATRIX_COL_PINS { A0, A1, A2, A3 }
|
||||||
#define UNUSED_PINS
|
|
||||||
|
|
||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
#define DEBOUNCE 5
|
|
||||||
|
|
||||||
#define BACKLIGHT_LEVELS 1
|
#define BACKLIGHT_PIN D4
|
||||||
|
#define BACKLIGHT_BREATHING
|
||||||
|
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 6
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"keyboard_name": "KBDFans KBDPad MKI",
|
"keyboard_name": "KBDfans KBDPad MKI",
|
||||||
"url": "",
|
"url": "https://kbdfans.com/products/kbdfans-pad-custom-mechanical-keyboard-diy-kit",
|
||||||
"maintainer": "qmk",
|
"maintainer": "qmk",
|
||||||
"width": 4,
|
"width": 4,
|
||||||
"height": 6.25,
|
"height": 6.25,
|
||||||
|
|||||||
@@ -13,76 +13,17 @@
|
|||||||
* 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"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#define NUMLOCK_PIN D0
|
||||||
#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) {
|
void matrix_init_kb(void) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
setPinOutput(NUMLOCK_PIN);
|
||||||
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();
|
matrix_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
void led_set_kb(uint8_t usb_led) {
|
||||||
#ifdef RGBLIGHT_ENABLE
|
writePin(NUMLOCK_PIN, IS_LED_ON(usb_led, USB_LED_NUM_LOCK));
|
||||||
rgblight_task();
|
led_set_user(usb_led);
|
||||||
#endif
|
|
||||||
matrix_scan_user();
|
|
||||||
/* Nothing else for now. */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_init_ports(void) {
|
|
||||||
// initialize pins D0, D1, D4 and D6 as output
|
|
||||||
setPinOutput(D0);
|
|
||||||
setPinOutput(D1);
|
|
||||||
setPinOutput(D4);
|
|
||||||
setPinOutput(D6);
|
|
||||||
|
|
||||||
// turn backlight LEDs on
|
|
||||||
writePinHigh(D0);
|
|
||||||
writePinHigh(D1);
|
|
||||||
writePinHigh(D4);
|
|
||||||
writePinHigh(D6);
|
|
||||||
}
|
|
||||||
|
|
||||||
void backlight_set(uint8_t level) {
|
|
||||||
if (level == 0) {
|
|
||||||
// turn backlight LEDs off
|
|
||||||
writePinLow(D0);
|
|
||||||
writePinLow(D1);
|
|
||||||
writePinLow(D4);
|
|
||||||
writePinLow(D6);
|
|
||||||
} else {
|
|
||||||
// turn backlight LEDs on
|
|
||||||
writePinHigh(D0);
|
|
||||||
writePinHigh(D1);
|
|
||||||
writePinHigh(D4);
|
|
||||||
writePinHigh(D6);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ Custom numpad.
|
|||||||
|
|
||||||
Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
|
Keyboard Maintainer: [MechMerlin](https://github.com/mechmerlin)
|
||||||
Hardware Supported: KBDPad MKI
|
Hardware Supported: KBDPad MKI
|
||||||
Hardware Availability: No longer available.
|
Hardware Availability: [KBDfans](https://kbdfans.com/products/kbdfans-pad-custom-mechanical-keyboard-diy-kit)
|
||||||
|
|
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment):
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|||||||
@@ -31,11 +31,9 @@ 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 = no
|
RGBLIGHT_ENABLE = no # PCB has underglow LEDs, but case doesn't let them show.
|
||||||
RGBLIGHT_CUSTOM_DRIVER = no
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
OPT_DEFS = -DDEBUG_LEVEL=0
|
OPT_DEFS = -DDEBUG_LEVEL=0
|
||||||
|
|
||||||
QUANTUM_LIB_SRC = i2c_master.c
|
|
||||||
@@ -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
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -116,8 +116,6 @@ void matrix_init(void)
|
|||||||
init_rows();
|
init_rows();
|
||||||
// init_lcols();
|
// init_lcols();
|
||||||
|
|
||||||
// TX_RX_LED_INIT;
|
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
// initialize matrix state: all keys off
|
||||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||||
matrix[i] = 0;
|
matrix[i] = 0;
|
||||||
|
|||||||
@@ -5,6 +5,4 @@
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#include "pro_micro.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,362 +0,0 @@
|
|||||||
/*
|
|
||||||
pins_arduino.h - Pin definition functions for Arduino
|
|
||||||
Part of Arduino - http://www.arduino.cc/
|
|
||||||
|
|
||||||
Copyright (c) 2007 David A. Mellis
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General
|
|
||||||
Public License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
||||||
Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Pins_Arduino_h
|
|
||||||
#define Pins_Arduino_h
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
// Workaround for wrong definitions in "iom32u4.h".
|
|
||||||
// This should be fixed in the AVR toolchain.
|
|
||||||
#undef UHCON
|
|
||||||
#undef UHINT
|
|
||||||
#undef UHIEN
|
|
||||||
#undef UHADDR
|
|
||||||
#undef UHFNUM
|
|
||||||
#undef UHFNUML
|
|
||||||
#undef UHFNUMH
|
|
||||||
#undef UHFLEN
|
|
||||||
#undef UPINRQX
|
|
||||||
#undef UPINTX
|
|
||||||
#undef UPNUM
|
|
||||||
#undef UPRST
|
|
||||||
#undef UPCONX
|
|
||||||
#undef UPCFG0X
|
|
||||||
#undef UPCFG1X
|
|
||||||
#undef UPSTAX
|
|
||||||
#undef UPCFG2X
|
|
||||||
#undef UPIENX
|
|
||||||
#undef UPDATX
|
|
||||||
#undef TCCR2A
|
|
||||||
#undef WGM20
|
|
||||||
#undef WGM21
|
|
||||||
#undef COM2B0
|
|
||||||
#undef COM2B1
|
|
||||||
#undef COM2A0
|
|
||||||
#undef COM2A1
|
|
||||||
#undef TCCR2B
|
|
||||||
#undef CS20
|
|
||||||
#undef CS21
|
|
||||||
#undef CS22
|
|
||||||
#undef WGM22
|
|
||||||
#undef FOC2B
|
|
||||||
#undef FOC2A
|
|
||||||
#undef TCNT2
|
|
||||||
#undef TCNT2_0
|
|
||||||
#undef TCNT2_1
|
|
||||||
#undef TCNT2_2
|
|
||||||
#undef TCNT2_3
|
|
||||||
#undef TCNT2_4
|
|
||||||
#undef TCNT2_5
|
|
||||||
#undef TCNT2_6
|
|
||||||
#undef TCNT2_7
|
|
||||||
#undef OCR2A
|
|
||||||
#undef OCR2_0
|
|
||||||
#undef OCR2_1
|
|
||||||
#undef OCR2_2
|
|
||||||
#undef OCR2_3
|
|
||||||
#undef OCR2_4
|
|
||||||
#undef OCR2_5
|
|
||||||
#undef OCR2_6
|
|
||||||
#undef OCR2_7
|
|
||||||
#undef OCR2B
|
|
||||||
#undef OCR2_0
|
|
||||||
#undef OCR2_1
|
|
||||||
#undef OCR2_2
|
|
||||||
#undef OCR2_3
|
|
||||||
#undef OCR2_4
|
|
||||||
#undef OCR2_5
|
|
||||||
#undef OCR2_6
|
|
||||||
#undef OCR2_7
|
|
||||||
|
|
||||||
#define NUM_DIGITAL_PINS 30
|
|
||||||
#define NUM_ANALOG_INPUTS 12
|
|
||||||
|
|
||||||
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
|
|
||||||
#define TXLED0 PORTD |= (1<<5)
|
|
||||||
#define TXLED1 PORTD &= ~(1<<5)
|
|
||||||
#define RXLED0 PORTB |= (1<<0)
|
|
||||||
#define RXLED1 PORTB &= ~(1<<0)
|
|
||||||
|
|
||||||
static const uint8_t SDA = 2;
|
|
||||||
static const uint8_t SCL = 3;
|
|
||||||
#define LED_BUILTIN 13
|
|
||||||
|
|
||||||
// Map SPI port to 'new' pins D14..D17
|
|
||||||
static const uint8_t SS = 17;
|
|
||||||
static const uint8_t MOSI = 16;
|
|
||||||
static const uint8_t MISO = 14;
|
|
||||||
static const uint8_t SCK = 15;
|
|
||||||
|
|
||||||
// Mapping of analog pins as digital I/O
|
|
||||||
// A6-A11 share with digital pins
|
|
||||||
static const uint8_t ADC0 = 18;
|
|
||||||
static const uint8_t ADC1 = 19;
|
|
||||||
static const uint8_t ADC2 = 20;
|
|
||||||
static const uint8_t ADC3 = 21;
|
|
||||||
static const uint8_t ADC4 = 22;
|
|
||||||
static const uint8_t ADC5 = 23;
|
|
||||||
static const uint8_t ADC6 = 24; // D4
|
|
||||||
static const uint8_t ADC7 = 25; // D6
|
|
||||||
static const uint8_t ADC8 = 26; // D8
|
|
||||||
static const uint8_t ADC9 = 27; // D9
|
|
||||||
static const uint8_t ADC10 = 28; // D10
|
|
||||||
static const uint8_t ADC11 = 29; // D12
|
|
||||||
|
|
||||||
#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
|
|
||||||
#define digitalPinToPCICRbit(p) 0
|
|
||||||
#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
|
|
||||||
#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
|
|
||||||
|
|
||||||
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
|
|
||||||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
|
||||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
|
||||||
|
|
||||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
|
||||||
|
|
||||||
#ifdef ARDUINO_MAIN
|
|
||||||
|
|
||||||
// On the Arduino board, digital pins are also used
|
|
||||||
// for the analog output (software PWM). Analog input
|
|
||||||
// pins are a separate set.
|
|
||||||
|
|
||||||
// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
|
|
||||||
//
|
|
||||||
// D0 PD2 RXD1/INT2
|
|
||||||
// D1 PD3 TXD1/INT3
|
|
||||||
// D2 PD1 SDA SDA/INT1
|
|
||||||
// D3# PD0 PWM8/SCL OC0B/SCL/INT0
|
|
||||||
// D4 A6 PD4 ADC8
|
|
||||||
// D5# PC6 ??? OC3A/#OC4A
|
|
||||||
// D6# A7 PD7 FastPWM #OC4D/ADC10
|
|
||||||
// D7 PE6 INT6/AIN0
|
|
||||||
//
|
|
||||||
// D8 A8 PB4 ADC11/PCINT4
|
|
||||||
// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
|
|
||||||
// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
|
|
||||||
// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
|
|
||||||
// D12 A11 PD6 T1/#OC4D/ADC9
|
|
||||||
// D13# PC7 PWM10 CLK0/OC4A
|
|
||||||
//
|
|
||||||
// A0 D18 PF7 ADC7
|
|
||||||
// A1 D19 PF6 ADC6
|
|
||||||
// A2 D20 PF5 ADC5
|
|
||||||
// A3 D21 PF4 ADC4
|
|
||||||
// A4 D22 PF1 ADC1
|
|
||||||
// A5 D23 PF0 ADC0
|
|
||||||
//
|
|
||||||
// New pins D14..D17 to map SPI port to digital pins
|
|
||||||
//
|
|
||||||
// MISO D14 PB3 MISO,PCINT3
|
|
||||||
// SCK D15 PB1 SCK,PCINT1
|
|
||||||
// MOSI D16 PB2 MOSI,PCINT2
|
|
||||||
// SS D17 PB0 RXLED,SS/PCINT0
|
|
||||||
//
|
|
||||||
// Connected LEDs on board for TX and RX
|
|
||||||
// TXLED D24 PD5 XCK1
|
|
||||||
// RXLED D17 PB0
|
|
||||||
// HWB PE2 HWB
|
|
||||||
|
|
||||||
// these arrays map port names (e.g. port B) to the
|
|
||||||
// appropriate addresses for various functions (e.g. reading
|
|
||||||
// and writing)
|
|
||||||
const uint16_t PROGMEM port_to_mode_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &DDRB,
|
|
||||||
(uint16_t) &DDRC,
|
|
||||||
(uint16_t) &DDRD,
|
|
||||||
(uint16_t) &DDRE,
|
|
||||||
(uint16_t) &DDRF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM port_to_output_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &PORTB,
|
|
||||||
(uint16_t) &PORTC,
|
|
||||||
(uint16_t) &PORTD,
|
|
||||||
(uint16_t) &PORTE,
|
|
||||||
(uint16_t) &PORTF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM port_to_input_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &PINB,
|
|
||||||
(uint16_t) &PINC,
|
|
||||||
(uint16_t) &PIND,
|
|
||||||
(uint16_t) &PINE,
|
|
||||||
(uint16_t) &PINF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
|
||||||
PD, // D0 - PD2
|
|
||||||
PD, // D1 - PD3
|
|
||||||
PD, // D2 - PD1
|
|
||||||
PD, // D3 - PD0
|
|
||||||
PD, // D4 - PD4
|
|
||||||
PC, // D5 - PC6
|
|
||||||
PD, // D6 - PD7
|
|
||||||
PE, // D7 - PE6
|
|
||||||
|
|
||||||
PB, // D8 - PB4
|
|
||||||
PB, // D9 - PB5
|
|
||||||
PB, // D10 - PB6
|
|
||||||
PB, // D11 - PB7
|
|
||||||
PD, // D12 - PD6
|
|
||||||
PC, // D13 - PC7
|
|
||||||
|
|
||||||
PB, // D14 - MISO - PB3
|
|
||||||
PB, // D15 - SCK - PB1
|
|
||||||
PB, // D16 - MOSI - PB2
|
|
||||||
PB, // D17 - SS - PB0
|
|
||||||
|
|
||||||
PF, // D18 - A0 - PF7
|
|
||||||
PF, // D19 - A1 - PF6
|
|
||||||
PF, // D20 - A2 - PF5
|
|
||||||
PF, // D21 - A3 - PF4
|
|
||||||
PF, // D22 - A4 - PF1
|
|
||||||
PF, // D23 - A5 - PF0
|
|
||||||
|
|
||||||
PD, // D24 - PD5
|
|
||||||
PD, // D25 / D6 - A7 - PD7
|
|
||||||
PB, // D26 / D8 - A8 - PB4
|
|
||||||
PB, // D27 / D9 - A9 - PB5
|
|
||||||
PB, // D28 / D10 - A10 - PB6
|
|
||||||
PD, // D29 / D12 - A11 - PD6
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
|
||||||
_BV(2), // D0 - PD2
|
|
||||||
_BV(3), // D1 - PD3
|
|
||||||
_BV(1), // D2 - PD1
|
|
||||||
_BV(0), // D3 - PD0
|
|
||||||
_BV(4), // D4 - PD4
|
|
||||||
_BV(6), // D5 - PC6
|
|
||||||
_BV(7), // D6 - PD7
|
|
||||||
_BV(6), // D7 - PE6
|
|
||||||
|
|
||||||
_BV(4), // D8 - PB4
|
|
||||||
_BV(5), // D9 - PB5
|
|
||||||
_BV(6), // D10 - PB6
|
|
||||||
_BV(7), // D11 - PB7
|
|
||||||
_BV(6), // D12 - PD6
|
|
||||||
_BV(7), // D13 - PC7
|
|
||||||
|
|
||||||
_BV(3), // D14 - MISO - PB3
|
|
||||||
_BV(1), // D15 - SCK - PB1
|
|
||||||
_BV(2), // D16 - MOSI - PB2
|
|
||||||
_BV(0), // D17 - SS - PB0
|
|
||||||
|
|
||||||
_BV(7), // D18 - A0 - PF7
|
|
||||||
_BV(6), // D19 - A1 - PF6
|
|
||||||
_BV(5), // D20 - A2 - PF5
|
|
||||||
_BV(4), // D21 - A3 - PF4
|
|
||||||
_BV(1), // D22 - A4 - PF1
|
|
||||||
_BV(0), // D23 - A5 - PF0
|
|
||||||
|
|
||||||
_BV(5), // D24 - PD5
|
|
||||||
_BV(7), // D25 / D6 - A7 - PD7
|
|
||||||
_BV(4), // D26 / D8 - A8 - PB4
|
|
||||||
_BV(5), // D27 / D9 - A9 - PB5
|
|
||||||
_BV(6), // D28 / D10 - A10 - PB6
|
|
||||||
_BV(6), // D29 / D12 - A11 - PD6
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER0B, /* 3 */
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER3A, /* 5 */
|
|
||||||
TIMER4D, /* 6 */
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER1A, /* 9 */
|
|
||||||
TIMER1B, /* 10 */
|
|
||||||
TIMER0A, /* 11 */
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER4A, /* 13 */
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
|
||||||
7, // A0 PF7 ADC7
|
|
||||||
6, // A1 PF6 ADC6
|
|
||||||
5, // A2 PF5 ADC5
|
|
||||||
4, // A3 PF4 ADC4
|
|
||||||
1, // A4 PF1 ADC1
|
|
||||||
0, // A5 PF0 ADC0
|
|
||||||
8, // A6 D4 PD4 ADC8
|
|
||||||
10, // A7 D6 PD7 ADC10
|
|
||||||
11, // A8 D8 PB4 ADC11
|
|
||||||
12, // A9 D9 PB5 ADC12
|
|
||||||
13, // A10 D10 PB6 ADC13
|
|
||||||
9 // A11 D12 PD6 ADC9
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ARDUINO_MAIN */
|
|
||||||
|
|
||||||
// These serial port names are intended to allow libraries and architecture-neutral
|
|
||||||
// sketches to automatically default to the correct port name for a particular type
|
|
||||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
|
||||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
|
||||||
// pins are NOT connected to anything by default.
|
|
||||||
#define SERIAL_PORT_MONITOR Serial
|
|
||||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
|
||||||
#define SERIAL_PORT_HARDWARE Serial1
|
|
||||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
|
||||||
|
|
||||||
#endif /* Pins_Arduino_h */
|
|
||||||
@@ -200,18 +200,12 @@ uint8_t matrix_scan(void)
|
|||||||
}else{
|
}else{
|
||||||
matrix_slave_scan();
|
matrix_slave_scan();
|
||||||
|
|
||||||
// if(serial_slave_DATA_CORRUPT()){
|
|
||||||
// TXLED0;
|
|
||||||
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
|
||||||
|
|
||||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
matrix[offset+i] = serial_master_buffer[i];
|
matrix[offset+i] = serial_master_buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// }else{
|
|
||||||
// TXLED1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
matrix_scan_quantum();
|
matrix_scan_quantum();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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,362 +0,0 @@
|
|||||||
/*
|
|
||||||
pins_arduino.h - Pin definition functions for Arduino
|
|
||||||
Part of Arduino - http://www.arduino.cc/
|
|
||||||
|
|
||||||
Copyright (c) 2007 David A. Mellis
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General
|
|
||||||
Public License along with this library; if not, write to the
|
|
||||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
||||||
Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Pins_Arduino_h
|
|
||||||
#define Pins_Arduino_h
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
// Workaround for wrong definitions in "iom32u4.h".
|
|
||||||
// This should be fixed in the AVR toolchain.
|
|
||||||
#undef UHCON
|
|
||||||
#undef UHINT
|
|
||||||
#undef UHIEN
|
|
||||||
#undef UHADDR
|
|
||||||
#undef UHFNUM
|
|
||||||
#undef UHFNUML
|
|
||||||
#undef UHFNUMH
|
|
||||||
#undef UHFLEN
|
|
||||||
#undef UPINRQX
|
|
||||||
#undef UPINTX
|
|
||||||
#undef UPNUM
|
|
||||||
#undef UPRST
|
|
||||||
#undef UPCONX
|
|
||||||
#undef UPCFG0X
|
|
||||||
#undef UPCFG1X
|
|
||||||
#undef UPSTAX
|
|
||||||
#undef UPCFG2X
|
|
||||||
#undef UPIENX
|
|
||||||
#undef UPDATX
|
|
||||||
#undef TCCR2A
|
|
||||||
#undef WGM20
|
|
||||||
#undef WGM21
|
|
||||||
#undef COM2B0
|
|
||||||
#undef COM2B1
|
|
||||||
#undef COM2A0
|
|
||||||
#undef COM2A1
|
|
||||||
#undef TCCR2B
|
|
||||||
#undef CS20
|
|
||||||
#undef CS21
|
|
||||||
#undef CS22
|
|
||||||
#undef WGM22
|
|
||||||
#undef FOC2B
|
|
||||||
#undef FOC2A
|
|
||||||
#undef TCNT2
|
|
||||||
#undef TCNT2_0
|
|
||||||
#undef TCNT2_1
|
|
||||||
#undef TCNT2_2
|
|
||||||
#undef TCNT2_3
|
|
||||||
#undef TCNT2_4
|
|
||||||
#undef TCNT2_5
|
|
||||||
#undef TCNT2_6
|
|
||||||
#undef TCNT2_7
|
|
||||||
#undef OCR2A
|
|
||||||
#undef OCR2_0
|
|
||||||
#undef OCR2_1
|
|
||||||
#undef OCR2_2
|
|
||||||
#undef OCR2_3
|
|
||||||
#undef OCR2_4
|
|
||||||
#undef OCR2_5
|
|
||||||
#undef OCR2_6
|
|
||||||
#undef OCR2_7
|
|
||||||
#undef OCR2B
|
|
||||||
#undef OCR2_0
|
|
||||||
#undef OCR2_1
|
|
||||||
#undef OCR2_2
|
|
||||||
#undef OCR2_3
|
|
||||||
#undef OCR2_4
|
|
||||||
#undef OCR2_5
|
|
||||||
#undef OCR2_6
|
|
||||||
#undef OCR2_7
|
|
||||||
|
|
||||||
#define NUM_DIGITAL_PINS 30
|
|
||||||
#define NUM_ANALOG_INPUTS 12
|
|
||||||
|
|
||||||
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
|
|
||||||
#define TXLED0 PORTD |= (1<<5)
|
|
||||||
#define TXLED1 PORTD &= ~(1<<5)
|
|
||||||
#define RXLED0 PORTB |= (1<<0)
|
|
||||||
#define RXLED1 PORTB &= ~(1<<0)
|
|
||||||
|
|
||||||
static const uint8_t SDA = 2;
|
|
||||||
static const uint8_t SCL = 3;
|
|
||||||
#define LED_BUILTIN 13
|
|
||||||
|
|
||||||
// Map SPI port to 'new' pins D14..D17
|
|
||||||
static const uint8_t SS = 17;
|
|
||||||
static const uint8_t MOSI = 16;
|
|
||||||
static const uint8_t MISO = 14;
|
|
||||||
static const uint8_t SCK = 15;
|
|
||||||
|
|
||||||
// Mapping of analog pins as digital I/O
|
|
||||||
// A6-A11 share with digital pins
|
|
||||||
static const uint8_t ADC0 = 18;
|
|
||||||
static const uint8_t ADC1 = 19;
|
|
||||||
static const uint8_t ADC2 = 20;
|
|
||||||
static const uint8_t ADC3 = 21;
|
|
||||||
static const uint8_t ADC4 = 22;
|
|
||||||
static const uint8_t ADC5 = 23;
|
|
||||||
static const uint8_t ADC6 = 24; // D4
|
|
||||||
static const uint8_t ADC7 = 25; // D6
|
|
||||||
static const uint8_t ADC8 = 26; // D8
|
|
||||||
static const uint8_t ADC9 = 27; // D9
|
|
||||||
static const uint8_t ADC10 = 28; // D10
|
|
||||||
static const uint8_t ADC11 = 29; // D12
|
|
||||||
|
|
||||||
#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
|
|
||||||
#define digitalPinToPCICRbit(p) 0
|
|
||||||
#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
|
|
||||||
#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
|
|
||||||
|
|
||||||
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
|
|
||||||
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
|
|
||||||
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
|
|
||||||
|
|
||||||
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
|
|
||||||
|
|
||||||
#ifdef ARDUINO_MAIN
|
|
||||||
|
|
||||||
// On the Arduino board, digital pins are also used
|
|
||||||
// for the analog output (software PWM). Analog input
|
|
||||||
// pins are a separate set.
|
|
||||||
|
|
||||||
// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
|
|
||||||
//
|
|
||||||
// D0 PD2 RXD1/INT2
|
|
||||||
// D1 PD3 TXD1/INT3
|
|
||||||
// D2 PD1 SDA SDA/INT1
|
|
||||||
// D3# PD0 PWM8/SCL OC0B/SCL/INT0
|
|
||||||
// D4 A6 PD4 ADC8
|
|
||||||
// D5# PC6 ??? OC3A/#OC4A
|
|
||||||
// D6# A7 PD7 FastPWM #OC4D/ADC10
|
|
||||||
// D7 PE6 INT6/AIN0
|
|
||||||
//
|
|
||||||
// D8 A8 PB4 ADC11/PCINT4
|
|
||||||
// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
|
|
||||||
// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
|
|
||||||
// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
|
|
||||||
// D12 A11 PD6 T1/#OC4D/ADC9
|
|
||||||
// D13# PC7 PWM10 CLK0/OC4A
|
|
||||||
//
|
|
||||||
// A0 D18 PF7 ADC7
|
|
||||||
// A1 D19 PF6 ADC6
|
|
||||||
// A2 D20 PF5 ADC5
|
|
||||||
// A3 D21 PF4 ADC4
|
|
||||||
// A4 D22 PF1 ADC1
|
|
||||||
// A5 D23 PF0 ADC0
|
|
||||||
//
|
|
||||||
// New pins D14..D17 to map SPI port to digital pins
|
|
||||||
//
|
|
||||||
// MISO D14 PB3 MISO,PCINT3
|
|
||||||
// SCK D15 PB1 SCK,PCINT1
|
|
||||||
// MOSI D16 PB2 MOSI,PCINT2
|
|
||||||
// SS D17 PB0 RXLED,SS/PCINT0
|
|
||||||
//
|
|
||||||
// Connected LEDs on board for TX and RX
|
|
||||||
// TXLED D24 PD5 XCK1
|
|
||||||
// RXLED D17 PB0
|
|
||||||
// HWB PE2 HWB
|
|
||||||
|
|
||||||
// these arrays map port names (e.g. port B) to the
|
|
||||||
// appropriate addresses for various functions (e.g. reading
|
|
||||||
// and writing)
|
|
||||||
const uint16_t PROGMEM port_to_mode_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &DDRB,
|
|
||||||
(uint16_t) &DDRC,
|
|
||||||
(uint16_t) &DDRD,
|
|
||||||
(uint16_t) &DDRE,
|
|
||||||
(uint16_t) &DDRF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM port_to_output_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &PORTB,
|
|
||||||
(uint16_t) &PORTC,
|
|
||||||
(uint16_t) &PORTD,
|
|
||||||
(uint16_t) &PORTE,
|
|
||||||
(uint16_t) &PORTF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM port_to_input_PGM[] = {
|
|
||||||
NOT_A_PORT,
|
|
||||||
NOT_A_PORT,
|
|
||||||
(uint16_t) &PINB,
|
|
||||||
(uint16_t) &PINC,
|
|
||||||
(uint16_t) &PIND,
|
|
||||||
(uint16_t) &PINE,
|
|
||||||
(uint16_t) &PINF,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
|
||||||
PD, // D0 - PD2
|
|
||||||
PD, // D1 - PD3
|
|
||||||
PD, // D2 - PD1
|
|
||||||
PD, // D3 - PD0
|
|
||||||
PD, // D4 - PD4
|
|
||||||
PC, // D5 - PC6
|
|
||||||
PD, // D6 - PD7
|
|
||||||
PE, // D7 - PE6
|
|
||||||
|
|
||||||
PB, // D8 - PB4
|
|
||||||
PB, // D9 - PB5
|
|
||||||
PB, // D10 - PB6
|
|
||||||
PB, // D11 - PB7
|
|
||||||
PD, // D12 - PD6
|
|
||||||
PC, // D13 - PC7
|
|
||||||
|
|
||||||
PB, // D14 - MISO - PB3
|
|
||||||
PB, // D15 - SCK - PB1
|
|
||||||
PB, // D16 - MOSI - PB2
|
|
||||||
PB, // D17 - SS - PB0
|
|
||||||
|
|
||||||
PF, // D18 - A0 - PF7
|
|
||||||
PF, // D19 - A1 - PF6
|
|
||||||
PF, // D20 - A2 - PF5
|
|
||||||
PF, // D21 - A3 - PF4
|
|
||||||
PF, // D22 - A4 - PF1
|
|
||||||
PF, // D23 - A5 - PF0
|
|
||||||
|
|
||||||
PD, // D24 - PD5
|
|
||||||
PD, // D25 / D6 - A7 - PD7
|
|
||||||
PB, // D26 / D8 - A8 - PB4
|
|
||||||
PB, // D27 / D9 - A9 - PB5
|
|
||||||
PB, // D28 / D10 - A10 - PB6
|
|
||||||
PD, // D29 / D12 - A11 - PD6
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
|
||||||
_BV(2), // D0 - PD2
|
|
||||||
_BV(3), // D1 - PD3
|
|
||||||
_BV(1), // D2 - PD1
|
|
||||||
_BV(0), // D3 - PD0
|
|
||||||
_BV(4), // D4 - PD4
|
|
||||||
_BV(6), // D5 - PC6
|
|
||||||
_BV(7), // D6 - PD7
|
|
||||||
_BV(6), // D7 - PE6
|
|
||||||
|
|
||||||
_BV(4), // D8 - PB4
|
|
||||||
_BV(5), // D9 - PB5
|
|
||||||
_BV(6), // D10 - PB6
|
|
||||||
_BV(7), // D11 - PB7
|
|
||||||
_BV(6), // D12 - PD6
|
|
||||||
_BV(7), // D13 - PC7
|
|
||||||
|
|
||||||
_BV(3), // D14 - MISO - PB3
|
|
||||||
_BV(1), // D15 - SCK - PB1
|
|
||||||
_BV(2), // D16 - MOSI - PB2
|
|
||||||
_BV(0), // D17 - SS - PB0
|
|
||||||
|
|
||||||
_BV(7), // D18 - A0 - PF7
|
|
||||||
_BV(6), // D19 - A1 - PF6
|
|
||||||
_BV(5), // D20 - A2 - PF5
|
|
||||||
_BV(4), // D21 - A3 - PF4
|
|
||||||
_BV(1), // D22 - A4 - PF1
|
|
||||||
_BV(0), // D23 - A5 - PF0
|
|
||||||
|
|
||||||
_BV(5), // D24 - PD5
|
|
||||||
_BV(7), // D25 / D6 - A7 - PD7
|
|
||||||
_BV(4), // D26 / D8 - A8 - PB4
|
|
||||||
_BV(5), // D27 / D9 - A9 - PB5
|
|
||||||
_BV(6), // D28 / D10 - A10 - PB6
|
|
||||||
_BV(6), // D29 / D12 - A11 - PD6
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER0B, /* 3 */
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER3A, /* 5 */
|
|
||||||
TIMER4D, /* 6 */
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER1A, /* 9 */
|
|
||||||
TIMER1B, /* 10 */
|
|
||||||
TIMER0A, /* 11 */
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
TIMER4A, /* 13 */
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
NOT_ON_TIMER,
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
|
|
||||||
7, // A0 PF7 ADC7
|
|
||||||
6, // A1 PF6 ADC6
|
|
||||||
5, // A2 PF5 ADC5
|
|
||||||
4, // A3 PF4 ADC4
|
|
||||||
1, // A4 PF1 ADC1
|
|
||||||
0, // A5 PF0 ADC0
|
|
||||||
8, // A6 D4 PD4 ADC8
|
|
||||||
10, // A7 D6 PD7 ADC10
|
|
||||||
11, // A8 D8 PB4 ADC11
|
|
||||||
12, // A9 D9 PB5 ADC12
|
|
||||||
13, // A10 D10 PB6 ADC13
|
|
||||||
9 // A11 D12 PD6 ADC9
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ARDUINO_MAIN */
|
|
||||||
|
|
||||||
// These serial port names are intended to allow libraries and architecture-neutral
|
|
||||||
// sketches to automatically default to the correct port name for a particular type
|
|
||||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
|
||||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
|
||||||
//
|
|
||||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
|
||||||
// pins are NOT connected to anything by default.
|
|
||||||
#define SERIAL_PORT_MONITOR Serial
|
|
||||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
|
||||||
#define SERIAL_PORT_HARDWARE Serial1
|
|
||||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
|
||||||
|
|
||||||
#endif /* Pins_Arduino_h */
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
//#include <pro_micro.h>
|
|
||||||
|
|
||||||
#ifdef SOFT_SERIAL_PIN
|
#ifdef SOFT_SERIAL_PIN
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
@@ -16,30 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bmini.h"
|
#include "bmini.h"
|
||||||
#include "rgblight.h"
|
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
|
|
||||||
void rgblight_set(void) {
|
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
||||||
led[i].r = 0;
|
|
||||||
led[i].g = 0;
|
|
||||||
led[i].b = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i2c_init();
|
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {}
|
||||||
rgblight_task();
|
|
||||||
}
|
|
||||||
@@ -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 = 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,24 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bminiex.h"
|
#include "bminiex.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
|
|
||||||
// @Override
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// call user level keymaps, if any
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
/// Overrides functions in `quantum.c`
|
/// Overrides functions in `quantum.c`
|
||||||
void backlight_init_ports(void) {
|
void backlight_init_ports(void) {
|
||||||
@@ -48,50 +34,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,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 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,7 +21,7 @@ COMMAND_ENABLE = no
|
|||||||
BACKLIGHT_ENABLE = yes
|
BACKLIGHT_ENABLE = yes
|
||||||
BACKLIGHT_CUSTOM_DRIVER = yes
|
BACKLIGHT_CUSTOM_DRIVER = yes
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
TAP_DANCE_ENABLE = no
|
TAP_DANCE_ENABLE = no
|
||||||
|
|
||||||
# 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
|
||||||
@@ -46,4 +31,4 @@ 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
|
||||||
@@ -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,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,7 +19,7 @@ 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
|
||||||
|
|
||||||
@@ -51,4 +35,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
|
||||||
+9
-58
@@ -16,23 +16,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ymd75.h"
|
#include "ymd75.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`
|
||||||
@@ -48,48 +44,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,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,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
|
||||||
|
|
||||||
@@ -37,7 +22,7 @@ BACKLIGHT_ENABLE = yes
|
|||||||
BACKLIGHT_CUSTOM_DRIVER = yes
|
BACKLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
|
|
||||||
KEY_LOCK_ENABLE = yes
|
KEY_LOCK_ENABLE = yes
|
||||||
|
|
||||||
@@ -48,4 +33,4 @@ 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
|
||||||
+9
-59
@@ -18,22 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "ymd96.h"
|
#include "ymd96.h"
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
|
|
||||||
#include "action_layer.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#include "i2c.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`
|
||||||
@@ -49,49 +45,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,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,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
|
||||||
|
|
||||||
@@ -37,8 +22,7 @@ BACKLIGHT_ENABLE = yes
|
|||||||
BACKLIGHT_CUSTOM_DRIVER = yes
|
BACKLIGHT_CUSTOM_DRIVER = yes
|
||||||
|
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
WS2812_DRIVER = i2c
|
||||||
# DISABLE_WS2812 = no
|
|
||||||
|
|
||||||
KEY_LOCK_ENABLE = yes
|
KEY_LOCK_ENABLE = yes
|
||||||
|
|
||||||
@@ -49,4 +33,4 @@ 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
|
||||||
Loaded 100 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user