1
0

Merge branch 'master' into led_matrix

This commit is contained in:
Kai Ryu 2014-04-11 17:04:41 +09:00
commit ddcf5df645
6 changed files with 23 additions and 5 deletions

View File

@ -30,6 +30,7 @@ void bootmagic(void)
/* eeconfig clear */
if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EEPROM_CLEAR)) {
eeconfig_disable();
eeconfig_init();
}

View File

@ -2,6 +2,7 @@
#include <stdbool.h>
#include <avr/eeprom.h>
#include "eeconfig.h"
#include "keymap_ex.h"
void eeconfig_init(void)
{
@ -13,6 +14,9 @@ void eeconfig_init(void)
#ifdef BACKLIGHT_ENABLE
eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
#endif
#ifdef KEYMAP_EX_ENABLE
keymap_ex_init();
#endif
}
void eeconfig_enable(void)
@ -22,6 +26,9 @@ void eeconfig_enable(void)
void eeconfig_disable(void)
{
#ifdef KEYMAP_EX_ENABLE
keymap_ex_disable();
#endif
eeprom_write_word(EECONFIG_MAGIC, 0xFFFF);
}

View File

@ -68,7 +68,9 @@ void keyboard_init(void)
#endif
#ifdef PS2_MOUSE_ENABLE
ps2_mouse_init();
if (ps2_enabled()) {
ps2_mouse_init();
}
#endif
#ifdef BOOTMAGIC_ENABLE
@ -80,7 +82,7 @@ void keyboard_init(void)
#endif
#ifdef KEYMAP_EX_ENABLE
keymap_init();
keymap_ex_init();
#endif
}
@ -133,7 +135,9 @@ MATRIX_LOOP_END:
#endif
#ifdef PS2_MOUSE_ENABLE
ps2_mouse_task();
if (ps2_enabled()) {
ps2_mouse_task();
}
#endif
// update LED

View File

@ -23,12 +23,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef KEYMAP_EX_ENABLE
void keymap_init(void) {
void keymap_ex_init(void) {
if (!check_keymap_in_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) {
uint16_t checksum_in_eeprom = eeprom_read_word(&((keymap_ex_t*)EECONFIG_KEYMAP_EX)->checksum);
uint16_t checksum = EECONFIG_MAGIC_NUMBER;

View File

@ -47,7 +47,8 @@ typedef struct {
#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))
void keymap_init(void);
void keymap_ex_init(void);
void keymap_ex_disable(void);
bool check_keymap_in_eeprom(void);
void write_keymap_to_eeprom(void);
uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col);

View File

@ -90,6 +90,7 @@ uint8_t ps2_host_send(uint8_t data);
uint8_t ps2_host_recv_response(void);
uint8_t ps2_host_recv(void);
void ps2_host_set_led(uint8_t usb_led);
uint8_t ps2_enabled(void);
/* Check port settings for clock and data line */