mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 18:06:34 +06:00
Refactoring frenchdev
This commit is contained in:
parent
de80e2c756
commit
a3f151b8e9
|
@ -18,29 +18,30 @@ void matrix_init_kb(void) {
|
|||
PORTD |= (1<<5 | 1<<4);
|
||||
PORTE |= (1<<6);
|
||||
|
||||
ergodox_blink_all_leds();
|
||||
frenchdev_blink_all_leds();
|
||||
frenchdev_blink_all_leds();
|
||||
frenchdev_blink_all_leds();
|
||||
frenchdev_blink_all_leds();
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void ergodox_blink_all_leds(void)
|
||||
void frenchdev_blink_all_leds(void)
|
||||
{
|
||||
ergodox_led_all_off();
|
||||
ergodox_led_all_set(LED_BRIGHTNESS_HI);
|
||||
ergodox_right_led_1_on();
|
||||
frenchdev_led_all_off();
|
||||
frenchdev_led_all_set(LED_BRIGHTNESS_HI);
|
||||
frenchdev_led_1_on();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_2_on();
|
||||
frenchdev_led_2_on();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_3_on();
|
||||
frenchdev_led_3_on();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_1_off();
|
||||
frenchdev_led_1_off();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_2_off();
|
||||
frenchdev_led_2_off();
|
||||
_delay_ms(50);
|
||||
ergodox_right_led_3_off();
|
||||
//ergodox_led_all_on();
|
||||
//_delay_ms(333);
|
||||
ergodox_led_all_off();
|
||||
frenchdev_led_3_off();
|
||||
frenchdev_led_all_off();
|
||||
}
|
||||
|
||||
uint8_t init_mcp23018(void) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
|
||||
#define CPU_16MHz 0x00
|
||||
|
||||
// I2C aliases and register addresses (see "mcp23018.md")
|
||||
// I2C aliases and register addresses (see "mcp23018.md" on tmk repository)
|
||||
#define I2C_ADDR 0b0100000
|
||||
#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE )
|
||||
#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ )
|
||||
|
@ -25,57 +25,56 @@
|
|||
|
||||
extern uint8_t mcp23018_status;
|
||||
|
||||
void init_ergodox(void);
|
||||
void ergodox_blink_all_leds(void);
|
||||
void init_frenchdev(void);
|
||||
void frenchdev_blink_all_leds(void);
|
||||
uint8_t init_mcp23018(void);
|
||||
uint8_t ergodox_left_leds_update(void);
|
||||
|
||||
#define LED_BRIGHTNESS_LO 15
|
||||
#define LED_BRIGHTNESS_HI 255
|
||||
|
||||
|
||||
inline void ergodox_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); }
|
||||
inline void ergodox_right_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); }
|
||||
inline void ergodox_right_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); }
|
||||
inline void ergodox_right_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); }
|
||||
inline void ergodox_right_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); }
|
||||
inline void frenchdev_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); }
|
||||
inline void frenchdev_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); }
|
||||
inline void frenchdev_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); }
|
||||
inline void frenchdev_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); }
|
||||
inline void frenchdev_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); }
|
||||
|
||||
inline void ergodox_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); }
|
||||
inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); }
|
||||
inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); }
|
||||
inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
|
||||
inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
|
||||
inline void frenchdev_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); }
|
||||
inline void frenchdev_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); }
|
||||
inline void frenchdev_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); }
|
||||
inline void frenchdev_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
|
||||
inline void frenchdev_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
|
||||
|
||||
inline void ergodox_led_all_on(void)
|
||||
inline void frenchdev_led_all_on(void)
|
||||
{
|
||||
ergodox_board_led_on();
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_3_on();
|
||||
frenchdev_board_led_on();
|
||||
frenchdev_led_1_on();
|
||||
frenchdev_led_2_on();
|
||||
frenchdev_led_3_on();
|
||||
}
|
||||
|
||||
inline void ergodox_led_all_off(void)
|
||||
inline void frenchdev_led_all_off(void)
|
||||
{
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
frenchdev_board_led_off();
|
||||
frenchdev_led_1_off();
|
||||
frenchdev_led_2_off();
|
||||
frenchdev_led_3_off();
|
||||
}
|
||||
|
||||
inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; }
|
||||
inline void ergodox_right_led_2_set(uint8_t n) { OCR1B = n; }
|
||||
inline void ergodox_right_led_3_set(uint8_t n) { OCR1C = n; }
|
||||
inline void ergodox_right_led_set(uint8_t led, uint8_t n) {
|
||||
inline void frenchdev_led_1_set(uint8_t n) { OCR1A = n; }
|
||||
inline void frenchdev_led_2_set(uint8_t n) { OCR1B = n; }
|
||||
inline void frenchdev_led_3_set(uint8_t n) { OCR1C = n; }
|
||||
inline void frenchdev_led_set(uint8_t led, uint8_t n) {
|
||||
(led == 1) ? (OCR1A = n) :
|
||||
(led == 2) ? (OCR1B = n) :
|
||||
(OCR1C = n);
|
||||
}
|
||||
|
||||
inline void ergodox_led_all_set(uint8_t n)
|
||||
inline void frenchdev_led_all_set(uint8_t n)
|
||||
{
|
||||
ergodox_right_led_1_set(n);
|
||||
ergodox_right_led_2_set(n);
|
||||
ergodox_right_led_3_set(n);
|
||||
frenchdev_led_1_set(n);
|
||||
frenchdev_led_2_set(n);
|
||||
frenchdev_led_3_set(n);
|
||||
}
|
||||
|
||||
#define KEYMAP( \
|
||||
|
|
|
@ -374,18 +374,18 @@ uint8_t old_layer=_BASE;
|
|||
void matrix_scan_user(void) {
|
||||
uint8_t layer = biton32(layer_state);
|
||||
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
frenchdev_led_1_off();
|
||||
frenchdev_led_2_off();
|
||||
switch (layer) {
|
||||
case _BASE:
|
||||
ergodox_right_led_2_on();
|
||||
frenchdev_led_2_on();
|
||||
break;
|
||||
case _SYMBOLS:
|
||||
ergodox_right_led_1_on();
|
||||
frenchdev_led_1_on();
|
||||
break;
|
||||
case _MEDIA:
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_2_on();
|
||||
frenchdev_led_1_on();
|
||||
frenchdev_led_2_on();
|
||||
default:
|
||||
// none
|
||||
break;
|
||||
|
@ -399,9 +399,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK)){
|
||||
ergodox_right_led_3_on();
|
||||
frenchdev_led_3_on();
|
||||
} else {
|
||||
ergodox_right_led_3_off();
|
||||
frenchdev_led_3_off();
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
/*
|
||||
|
||||
Note to self: adapted from ergodox EZ matrix
|
||||
The "column" and "row" in here actually refers to the opposite on the keyboard
|
||||
see definition of KEYMAP in v1.h, the grid is transposed so that a "row" in here is actually a "column" on the physical keyboard
|
||||
Nicolas
|
||||
|
||||
Note for ErgoDox EZ customizers: Here be dragons!
|
||||
This is not a file you want to be messing with.
|
||||
All of the interesting stuff for you is under keymaps/ :)
|
||||
Love, Erez
|
||||
|
||||
Note to self, the "column" and "row" in here actually refers to the opposite on the keyboard
|
||||
see definition of KEYMAP in v1.h, the grid is transposed so that a "row" in here is actually a "column" on the physical keyboard
|
||||
Nicolas
|
||||
|
||||
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
|
||||
Copyright 2013 Nicolas Poirey <nicolas.poirey@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -164,7 +166,7 @@ uint8_t matrix_scan(void)
|
|||
print("left side not responding\n");
|
||||
} else {
|
||||
print("left side attached\n");
|
||||
ergodox_blink_all_leds();
|
||||
frenchdev_blink_all_leds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
|
|||
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE ?= yes # Console for debug(+400)
|
||||
COMMAND_ENABLE ?= yes # Commands for debug and configuration
|
||||
CUSTOM_MATRIX ?= yes # Custom matrix file (taken and adapted from the ErgoDox EZ to acomodate custom number of columns)
|
||||
CUSTOM_MATRIX ?= yes # Custom matrix file (taken and adapted from the ErgoDox EZ to handle custom number of columns)
|
||||
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
UNICODE_ENABLE ?= yes # Unicode
|
||||
|
|
Loading…
Reference in New Issue
Block a user