Skip to content

Commit

Permalink
Working NVM implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Fort committed Jun 10, 2021
1 parent 3eb3d84 commit 31cba4e
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion keyboards/massdrop/alt/keymaps/drugo/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

#define SERIAL_NUM "FRT001"

#define UNICODE_SELECTED_MODES UC_LNX, UC_WINC
#define UNICODE_SELECTED_MODES UC_LNX, UC_WINC, UC_MAC
#define UCIS_MAX_CODE_POINTS 32
6 changes: 6 additions & 0 deletions keyboards/massdrop/alt/keymaps/drugo/config_led.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
#define DISABLE_RGB_MATRIX_DUAL_BEACON
#define DISABLE_RGB_MATRIX_BREATHING
#define DISABLE_RGB_MATRIX_HUE_BREATHING
#define DISABLE_RGB_MATRIX_HUE_PENDULUM
#define DISABLE_RGB_MATRIX_HUE_WAVE

#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY 50

// Set default RGB effect
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_ALPHAS_MODS
Expand Down
54 changes: 53 additions & 1 deletion keyboards/massdrop/alt/keymaps/drugo/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ enum {
TD_LOCK, //ESC/GUI+L
};

enum alt_rgb_mode {
RGB_MODE_ALL,
RGB_MODE_KEYLIGHT,
RGB_MODE_UNDERGLOW,
RGB_MODE_NONE,
};

typedef union {
uint32_t raw;
struct {
uint8_t rgb_mode :8;
};
} alt_config_t;

alt_config_t alt_config;

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// DEFAULT
[0] = LAYOUT_65_ansi_blocker(
Expand All @@ -39,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______,U_T_AUTO,U_T_AGCR, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_HOME, \
_______,RGB_RMOD, RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_BRIU, \
_______, RGB_TOG, RGB_FRZ, _______, _______, MD_BOOT, NK_TOGG, DBG_TOG, DBG_KBD,DBG_MTRX, _______, _______, KC_VOLU, KC_BRID, \
UC_M_MA, RGB_TOG, RGB_FRZ, _______, EEP_RST, MD_BOOT, NK_TOGG, DBG_TOG, DBG_KBD,DBG_MTRX, _______, _______, KC_VOLU, KC_BRID, \
UNI_ON , UC_M_WC, UC_M_LN, KC_MPLY, MO(2) , _______, KC_MPRV, KC_VOLD, KC_MNXT \
),
// MACRO
Expand Down Expand Up @@ -110,6 +126,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return false;
case EEP_RST:
if (record->event.pressed) {
key_timer = timer_read32();
} else {
if (timer_elapsed32(key_timer) >= 500) {
eeconfig_init();
}
}
return false;
#ifdef UCIS_ENABLE
case UNI_ON:
if (record->event.pressed) {
Expand Down Expand Up @@ -196,24 +221,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
rgb_matrix_set_color_all(0, 0, 0);
alt_config.rgb_mode = RGB_MODE_KEYLIGHT;
}
break;
case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
alt_config.rgb_mode = RGB_MODE_UNDERGLOW;
}
break;
case LED_FLAG_UNDERGLOW: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
alt_config.rgb_mode = RGB_MODE_NONE;
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
alt_config.rgb_mode = RGB_MODE_ALL;
}
break;
}
eeconfig_update_user(alt_config.raw);
}
return false;
case RGB_FRZ:
Expand All @@ -235,6 +265,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}

void keyboard_post_init_kb(void) {
alt_config.raw = eeconfig_read_user();
switch (alt_config.rgb_mode) {
case RGB_MODE_ALL:
rgb_matrix_set_flags(LED_FLAG_ALL);
rgb_matrix_enable_noeeprom();
break;
case RGB_MODE_KEYLIGHT:
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT);
rgb_matrix_set_color_all(0, 0, 0);
break;
case RGB_MODE_UNDERGLOW:
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
rgb_matrix_set_color_all(0, 0, 0);
break;
case RGB_MODE_NONE:
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_disable_noeeprom();
break;
}
}

#ifdef TAP_DANCE_ENABLE
void lock_esc(qk_tap_dance_state_t *state, void *user_data){
if (state->count == 1) {
Expand Down
Binary file removed util/applet-mdflash.bin
Binary file not shown.
Binary file added util/mdloader
Binary file not shown.
File renamed without changes.
Binary file added util/old_mdloder/mdloader_mac
Binary file not shown.

0 comments on commit 31cba4e

Please sign in to comment.