Merge branch 'master' into led_matrix
This commit is contained in:
commit
9a6b1cc49d
@ -30,6 +30,7 @@ void bootmagic(void)
|
|||||||
|
|
||||||
/* eeconfig clear */
|
/* eeconfig clear */
|
||||||
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
|
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
|
||||||
|
eeconfig_disable();
|
||||||
eeconfig_init();
|
eeconfig_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
|
#include "keymap_ex.h"
|
||||||
|
|
||||||
void eeconfig_init(void)
|
void eeconfig_init(void)
|
||||||
{
|
{
|
||||||
@ -13,6 +14,9 @@ void eeconfig_init(void)
|
|||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
|
eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
|
keymap_ex_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_enable(void)
|
void eeconfig_enable(void)
|
||||||
@ -22,6 +26,9 @@ void eeconfig_enable(void)
|
|||||||
|
|
||||||
void eeconfig_disable(void)
|
void eeconfig_disable(void)
|
||||||
{
|
{
|
||||||
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
|
keymap_ex_disable();
|
||||||
|
#endif
|
||||||
eeprom_write_word(EECONFIG_MAGIC, 0xFFFF);
|
eeprom_write_word(EECONFIG_MAGIC, 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,9 @@ void keyboard_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
ps2_mouse_init();
|
if (ps2_enabled()) {
|
||||||
|
ps2_mouse_init();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOTMAGIC_ENABLE
|
#ifdef BOOTMAGIC_ENABLE
|
||||||
@ -80,7 +82,7 @@ void keyboard_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYMAP_EX_ENABLE
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
keymap_init();
|
keymap_ex_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +135,9 @@ MATRIX_LOOP_END:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
ps2_mouse_task();
|
if (ps2_enabled()) {
|
||||||
|
ps2_mouse_task();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// update LED
|
// update LED
|
||||||
|
@ -23,12 +23,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifdef KEYMAP_EX_ENABLE
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
|
|
||||||
void keymap_init(void) {
|
void keymap_ex_init(void) {
|
||||||
if (!check_keymap_in_eeprom()) {
|
if (!check_keymap_in_eeprom()) {
|
||||||
write_keymap_to_eeprom();
|
write_keymap_to_eeprom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void keymap_ex_disable(void) {
|
||||||
|
eeprom_write_word((void*)EECONFIG_KEYMAP_CHECKSUM, eeprom_read_word((void*)EECONFIG_KEYMAP_CHECKSUM) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
bool check_keymap_in_eeprom(void) {
|
bool check_keymap_in_eeprom(void) {
|
||||||
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
|
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
|
||||||
uint16_t checksum = EECONFIG_MAGIC_NUMBER;
|
uint16_t checksum = EECONFIG_MAGIC_NUMBER;
|
||||||
|
@ -47,7 +47,8 @@ typedef struct {
|
|||||||
#define FN_ACTION_OFFSET(index) (sizeof(uint16_t) * index)
|
#define FN_ACTION_OFFSET(index) (sizeof(uint16_t) * index)
|
||||||
#define KEY_OFFSET(layer, row, col) (sizeof(uint8_t) * (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col))
|
#define KEY_OFFSET(layer, row, col) (sizeof(uint8_t) * (layer * MATRIX_ROWS * MATRIX_COLS + row * MATRIX_COLS + col))
|
||||||
|
|
||||||
void keymap_init(void);
|
void keymap_ex_init(void);
|
||||||
|
void keymap_ex_disable(void);
|
||||||
bool check_keymap_in_eeprom(void);
|
bool check_keymap_in_eeprom(void);
|
||||||
void write_keymap_to_eeprom(void);
|
void write_keymap_to_eeprom(void);
|
||||||
uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col);
|
uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col);
|
||||||
|
@ -134,12 +134,12 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
|
|||||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||||
|
#PS2_USE_BUSYWAIT = yes
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
||||||
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
LED_MATRIX_ENABLE = yes
|
LED_MATRIX_ENABLE = yes
|
||||||
|
|
||||||
|
|
||||||
# Optimize size but this may cause error "relocation truncated to fit"
|
# Optimize size but this may cause error "relocation truncated to fit"
|
||||||
#EXTRALDFLAGS = -Wl,--relax
|
#EXTRALDFLAGS = -Wl,--relax
|
||||||
|
|
||||||
@ -148,5 +148,6 @@ VPATH += $(TARGET_DIR)
|
|||||||
VPATH += $(TOP_DIR)
|
VPATH += $(TOP_DIR)
|
||||||
|
|
||||||
include $(TOP_DIR)/protocol/lufa.mk
|
include $(TOP_DIR)/protocol/lufa.mk
|
||||||
|
include $(TOP_DIR)/protocol.mk
|
||||||
include $(TOP_DIR)/common.mk
|
include $(TOP_DIR)/common.mk
|
||||||
include $(TOP_DIR)/rules.mk
|
include $(TOP_DIR)/rules.mk
|
||||||
|
@ -72,14 +72,43 @@ void backlight_set(uint8_t level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
static const uint8_t backlight_table[] PROGMEM = {
|
||||||
|
0, 16, 128, 255
|
||||||
|
};
|
||||||
|
|
||||||
void backlight_set(uint8_t level)
|
void backlight_set(uint8_t level)
|
||||||
{
|
{
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
||||||
PORTF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
PORTF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
||||||
|
cli();
|
||||||
|
TCCR1A |= (1<<WGM10);
|
||||||
|
TCCR1B |= ((1<<CS11) | (1<<CS10));
|
||||||
|
TIMSK1 |= ((1<<OCIE1A) | (1<<TOIE1));
|
||||||
|
TIFR1 |= (1<<TOV1);
|
||||||
|
sei();
|
||||||
|
OCR1A = pgm_read_byte(&backlight_table[level]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DDRF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
DDRF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
||||||
|
cli();
|
||||||
|
TCCR1A &= ~(1<<WGM10);
|
||||||
|
TCCR1B &= ~((1<<CS11) | (1<<CS10));
|
||||||
|
TIMSK1 |= ((1<<OCIE1A) | (1<<TOIE1));
|
||||||
|
TIFR1 |= (1<<TOV1);
|
||||||
|
sei();
|
||||||
|
OCR1A = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISR(TIMER1_COMPA_vect)
|
||||||
|
{
|
||||||
|
// LED off
|
||||||
|
PORTF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
||||||
|
}
|
||||||
|
ISR(TIMER1_OVF_vect)
|
||||||
|
{
|
||||||
|
// LED on
|
||||||
|
PORTF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,13 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
/* number of backlight levels */
|
/* number of backlight levels */
|
||||||
#if defined(GH60_REV_CHN)
|
#define BACKLIGHT_LEVELS 3
|
||||||
# define BACKLIGHT_LEVELS 3
|
|
||||||
#elif defined(GH60_REV_CNY)
|
|
||||||
# define BACKLIGHT_LEVELS 3
|
|
||||||
#else
|
|
||||||
# define BACKLIGHT_LEVELS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GH60_REV_CNY
|
#ifdef GH60_REV_CNY
|
||||||
# define LED_MATRIX_ROWS 6
|
# define LED_MATRIX_ROWS 6
|
||||||
@ -66,7 +60,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* PS2 mouse support */
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
#define PS2_CLOCK_PORT PORTF
|
||||||
|
#define PS2_CLOCK_PIN PINF
|
||||||
|
#define PS2_CLOCK_DDR DDRF
|
||||||
|
#define PS2_CLOCK_BIT PF7
|
||||||
|
|
||||||
|
#define PS2_DATA_PORT PORTF
|
||||||
|
#define PS2_DATA_PIN PINF
|
||||||
|
#define PS2_DATA_DDR DDRF
|
||||||
|
#define PS2_DATA_BIT PF6
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature disable options
|
* Feature disable options
|
||||||
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include "led_matrix.h"
|
#include "led_matrix.h"
|
||||||
|
|
||||||
|
#ifdef LED_MATRIX_ENABLE
|
||||||
#if defined(GH60_REV_CNY)
|
#if defined(GH60_REV_CNY)
|
||||||
|
|
||||||
/* LED Column pin configuration
|
/* LED Column pin configuration
|
||||||
@ -94,3 +95,4 @@ void led_matrix_select_row(uint8_t row)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -26,6 +26,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
#include "ps2.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
@ -42,6 +45,14 @@ static void init_cols(void);
|
|||||||
static void unselect_rows(void);
|
static void unselect_rows(void);
|
||||||
static void select_row(uint8_t row);
|
static void select_row(uint8_t row);
|
||||||
|
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
static uint8_t ps2_mouse_detected;
|
||||||
|
|
||||||
|
uint8_t ps2_enabled(void)
|
||||||
|
{
|
||||||
|
return ps2_mouse_detected;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline
|
inline
|
||||||
uint8_t matrix_rows(void)
|
uint8_t matrix_rows(void)
|
||||||
@ -61,6 +72,19 @@ void matrix_init(void)
|
|||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
MCUCR = (1<<JTD);
|
MCUCR = (1<<JTD);
|
||||||
|
|
||||||
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
// ps2 mouse detect
|
||||||
|
DDRF &= ~(1<<PF5 | 1<<PF4);
|
||||||
|
PORTF |= (1<<PF5 | 1<<PF4);
|
||||||
|
if (PINF & (1<<PF5 | 1 <<PF4)) {
|
||||||
|
ps2_mouse_detected = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ps2_mouse_detected = 1;
|
||||||
|
}
|
||||||
|
DDRF |= (1<<PF5 | 1<<PF4);
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
unselect_rows();
|
unselect_rows();
|
||||||
init_cols();
|
init_cols();
|
||||||
|
@ -50,7 +50,8 @@ TARGET_DIR = .
|
|||||||
# project specific files
|
# project specific files
|
||||||
SRC = keymap_common.c \
|
SRC = keymap_common.c \
|
||||||
matrix.c \
|
matrix.c \
|
||||||
led.c
|
led.c \
|
||||||
|
backlight.c
|
||||||
|
|
||||||
ifdef KEYMAP
|
ifdef KEYMAP
|
||||||
SRC := keymap_$(KEYMAP).c $(SRC)
|
SRC := keymap_$(KEYMAP).c $(SRC)
|
||||||
@ -111,6 +112,11 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|||||||
# USBaspLoader 2048
|
# USBaspLoader 2048
|
||||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||||
|
|
||||||
|
# Additional definitions from command line
|
||||||
|
ifdef DEFS
|
||||||
|
OPT_DEFS += $(foreach DEF,$(DEFS),-D$(DEF))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
# Build Options
|
||||||
# comment out to disable the options.
|
# comment out to disable the options.
|
||||||
@ -121,9 +127,9 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
|||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||||
#BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
KEYMAP_EX_ENABLE = yes # External keymap in eeprom
|
||||||
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2013 Kai Ryu <kai1103@gmail.com>
|
Copyright 2013,2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -17,30 +17,66 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
|
|
||||||
|
static const uint8_t backlight_table[] PROGMEM = {
|
||||||
|
0, 16, 128, 255
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t softpwm_ocr = 0;
|
||||||
|
|
||||||
/* Backlight pin configuration
|
/* Backlight pin configuration
|
||||||
* PF7 PF6 PF5
|
* PWM: PB5 (RevRS)
|
||||||
|
* GPIO: PF7 PF6 PF5
|
||||||
*/
|
*/
|
||||||
void backlight_set(uint8_t level)
|
void backlight_set(uint8_t level)
|
||||||
{
|
{
|
||||||
switch (level) {
|
if (level > 0) {
|
||||||
case 0:
|
// Turn on PWM
|
||||||
DDRF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5);
|
cli();
|
||||||
break;
|
// Hard PWM
|
||||||
case 1:
|
DDRB |= (1<<PB5);
|
||||||
DDRF &= ~(1<<PF6 | 1<<PF5);
|
PORTB |= (1<<PB5);
|
||||||
DDRF |= (1<<PF7);
|
TCCR1A |= ((1<<WGM10) | (1<<COM1A1));
|
||||||
PORTF &= ~(1<<PF7);
|
TCCR1B |= ((1<<CS11) | (1<<CS10));
|
||||||
break;
|
// Soft PWM
|
||||||
case 2:
|
DDRF |= ((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
DDRF &= ~(1<<PF5);
|
PORTF |= ((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
DDRF |= (1<<PF7 | 1<<PF6);
|
TIMSK1 |= ((1<<OCIE1A) | (1<<TOIE1));
|
||||||
PORTF &= ~(1<<PF7 | 1<<PF6);
|
TIFR1 |= (1<<TOV1);
|
||||||
break;
|
sei();
|
||||||
case 3:
|
// Set PWM
|
||||||
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5);
|
OCR1A = pgm_read_byte(&backlight_table[level]);
|
||||||
PORTF &= ~(1<<PF7 | 1<<PF6 | 1<<PF5);
|
softpwm_ocr = pgm_read_byte(&backlight_table[level]);
|
||||||
break;
|
}
|
||||||
|
else {
|
||||||
|
// Turn off PWM
|
||||||
|
cli();
|
||||||
|
// Hard PWM
|
||||||
|
DDRB |= (1<<PB5);
|
||||||
|
PORTB &= ~(1<<PB5);
|
||||||
|
TCCR1A &= ~((1<<WGM10) | (1<<COM1A1));
|
||||||
|
TCCR1B &= ~((1<<CS11) | (1<<CS10));
|
||||||
|
// Soft PWM
|
||||||
|
DDRF |= ((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
|
PORTF |= ((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
|
TIMSK1 |= ((1<<OCIE1A) | (1<<TOIE1));
|
||||||
|
TIFR1 |= (1<<TOV1);
|
||||||
|
sei();
|
||||||
|
// Set PWM
|
||||||
|
OCR1A = 0;
|
||||||
|
softpwm_ocr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISR(TIMER1_COMPA_vect)
|
||||||
|
{
|
||||||
|
// LED off
|
||||||
|
PORTF |= ((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
|
}
|
||||||
|
ISR(TIMER1_OVF_vect)
|
||||||
|
{
|
||||||
|
// LED on
|
||||||
|
PORTF &= ~((1<<PF7) | (1<<PF6) | (1<<PF5));
|
||||||
|
}
|
||||||
|
@ -54,11 +54,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define LOCKING_RESYNC_ENABLE
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
/* key combination for command */
|
/* key combination for command */
|
||||||
|
#ifndef __ASSEMBLER__
|
||||||
|
#include "matrix.h"
|
||||||
#define IS_COMMAND() ( \
|
#define IS_COMMAND() ( \
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
matrix_is_on(0, 0) && matrix_is_on(0, MATRIX_COLS - 1) \
|
||||||
)
|
)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* boot magic key */
|
||||||
|
#define BOOTMAGIC_KEY_SALT KC_FN0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Feature disable options
|
* Feature disable options
|
||||||
|
54
keyboard/ghpad/keymap_4x6_backlight.c
Normal file
54
keyboard/ghpad/keymap_4x6_backlight.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include "keymap_common.h"
|
||||||
|
|
||||||
|
// 4x6 Keypad
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
||||||
|
#else
|
||||||
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
/* Keymap 0: Default Layer
|
||||||
|
* ,---------------.
|
||||||
|
* |Esc|Fn0|Fn1|Fn2|
|
||||||
|
* |---+---+---+---|
|
||||||
|
* |Num|/ |* |- |
|
||||||
|
* |---+---+---+---|
|
||||||
|
* |7 |8 |9 |+ |
|
||||||
|
* |---+---+---| |
|
||||||
|
* |4 |5 |6 | |
|
||||||
|
* |---+---+---+---|
|
||||||
|
* |1 |2 |3 |Ent|
|
||||||
|
* |---+---+---| |
|
||||||
|
* |0 |. | |
|
||||||
|
* `---------------'
|
||||||
|
*/
|
||||||
|
[0] = KEYMAP(
|
||||||
|
ESC, FN0, FN1, FN2, \
|
||||||
|
NLCK,PSLS,PAST,PMNS, \
|
||||||
|
P7, P8, P9, PPLS, \
|
||||||
|
P4, P5, P6, PENT, \
|
||||||
|
P1, P2, P3, PENT, \
|
||||||
|
P0, NO, PDOT,NO)
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fn action definition
|
||||||
|
*/
|
||||||
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
|
const uint16_t fn_actions[FN_ACTIONS_COUNT] __attribute__ ((section (".keymap.fn_actions"))) = {
|
||||||
|
#else
|
||||||
|
const uint16_t fn_actions[] PROGMEM = {
|
||||||
|
#endif
|
||||||
|
[0] = ACTION_BACKLIGHT_TOGGLE(),
|
||||||
|
[1] = ACTION_BACKLIGHT_DECREASE(),
|
||||||
|
[2] = ACTION_BACKLIGHT_INCREASE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef KEYMAP_EX_ENABLE
|
||||||
|
uint16_t keys_count(void) {
|
||||||
|
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t fn_actions_count(void) {
|
||||||
|
return sizeof(fn_actions) / sizeof(fn_actions[0]);
|
||||||
|
}
|
||||||
|
#endif
|
@ -24,11 +24,11 @@ void led_set(uint8_t usb_led)
|
|||||||
{
|
{
|
||||||
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
|
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
|
||||||
// output low
|
// output low
|
||||||
DDRB |= (1<<2);
|
DDRB |= (1<<PB2);
|
||||||
PORTB &= ~(1<<2);
|
PORTB &= ~(1<<PB2);
|
||||||
} else {
|
} else {
|
||||||
// Hi-Z
|
// Hi-Z
|
||||||
DDRB &= ~(1<<2);
|
DDRB &= ~(1<<PB2);
|
||||||
PORTB &= ~(1<<2);
|
PORTB &= ~(1<<PB2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2013 Kai Ryu <kai1103@gmail.com>
|
Copyright 2013,2014 Kai Ryu <kai1103@gmail.com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -90,6 +90,7 @@ uint8_t ps2_host_send(uint8_t data);
|
|||||||
uint8_t ps2_host_recv_response(void);
|
uint8_t ps2_host_recv_response(void);
|
||||||
uint8_t ps2_host_recv(void);
|
uint8_t ps2_host_recv(void);
|
||||||
void ps2_host_set_led(uint8_t usb_led);
|
void ps2_host_set_led(uint8_t usb_led);
|
||||||
|
uint8_t ps2_enabled(void);
|
||||||
|
|
||||||
|
|
||||||
/* Check port settings for clock and data line */
|
/* Check port settings for clock and data line */
|
||||||
|
Reference in New Issue
Block a user