Skip to content

Commit

Permalink
cont
Browse files Browse the repository at this point in the history
  • Loading branch information
4pplet committed Oct 3, 2022
1 parent ab054d8 commit 107b979
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 75 deletions.
31 changes: 31 additions & 0 deletions keyboards/4pplet/eagle_viper_rep/rev_b/chconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2020 QMK
*
* 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/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i keyboards/acheron/austin/chconf.h -r platforms/chibios/common/configs/chconf.h`
*/

#pragma once

#define CH_CFG_ST_FREQUENCY 10000

#define CH_CFG_OPTIMIZE_SPEED FALSE

#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE

#include_next <chconf.h>

32 changes: 18 additions & 14 deletions keyboards/4pplet/eagle_viper_rep/rev_b/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BACKLIGHT_PIN A6
#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 1
#define BACKLIGHT_PAL_MODE 2
#define BACKLIGHT_PAL_MODE 1
#define BACKLIGHT_LEVELS 6
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6
#define BACKLIGHT_ON_STATE 1
#define BACKLIGHT_LEVELS 10
#define BACKLIGHT_BREATHING TRUE

// UPDATED:
// In switch on PA6
// Underglow on PA8 like waffling80

/* Underglow */
#define RGBLED_NUM 16
#define WS2812_EXTERNAL_PULLUP
#define RGB_DI_PIN A8
#define WS2812_PWM_DRIVER PWMD1
#define WS2812_PWM_CHANNEL 1
#define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
//#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
//#define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
//#define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU.

#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
Expand Down
106 changes: 47 additions & 59 deletions keyboards/4pplet/eagle_viper_rep/rev_b/rev_b.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rev_b.h"

void board_init(void) {
setPinInputHigh(CAPS_PIN);
setPinInputHigh(SCROLL_PIN);
setPinInputHigh(NUM_PIN);


void keyboard_pre_init_kb(void) {
setPinOutput(CAPS_PIN);
setPinOutput(SCROLL_PIN);
setPinOutput(NUM_PIN);
setPinOutput(LAYER_1);
setPinOutput(LAYER_2);
setPinOutput(LAYER_3);
setPinOutput(LAYER_4);
setPinOutput(LAYER_5);
keyboard_pre_init_user();
}

/* Set indicator leds to indicate lock states */
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res && LOCK_LIGHTS) {
if(led_state.caps_lock){
setPinOutput(CAPS_PIN);
writePin(CAPS_PIN, 0);
}
else
setPinInputHigh(CAPS_PIN);
if(led_state.scroll_lock){
setPinOutput(SCROLL_PIN);
writePin(SCROLL_PIN, 0);
}
else
setPinInputHigh(SCROLL_PIN);
if(led_state.num_lock){
setPinOutput(NUM_PIN);
writePin(NUM_PIN, 0);
}
else
setPinInputHigh(NUM_PIN);
if (res && LOCK_LIGHTS) {
writePin(NUM_PIN, led_state.num_lock);
writePin(CAPS_PIN, led_state.caps_lock);
writePin(SCROLL_PIN, led_state.scroll_lock);
}
return res;
return true;
}

layer_state_t layer_state_set_kb(layer_state_t state) {
Expand All @@ -59,50 +52,45 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
void setLayerLed(layer_state_t state){
switch(get_highest_layer(state)){
case 0 :
setPinOutput(LAYER_1);
writePin(LAYER_1, 0);
setPinInputHigh(LAYER_2);
setPinInputHigh(LAYER_3);
setPinInputHigh(LAYER_4);
setPinInputHigh(LAYER_5);
writePin(LAYER_1, 1);
writePin(LAYER_2, 0);
writePin(LAYER_3, 0);
writePin(LAYER_4, 0);
writePin(LAYER_5, 0);
break;
case 1 :
setPinOutput(LAYER_2);
writePin(LAYER_2, 0);
setPinInputHigh(LAYER_1);
setPinInputHigh(LAYER_3);
setPinInputHigh(LAYER_4);
setPinInputHigh(LAYER_5);
writePin(LAYER_1, 0);
writePin(LAYER_2, 1);
writePin(LAYER_3, 0);
writePin(LAYER_4, 0);
writePin(LAYER_5, 0);
break;
case 2 :
setPinOutput(LAYER_3);
writePin(LAYER_3, 0);
setPinInputHigh(LAYER_1);
setPinInputHigh(LAYER_2);
setPinInputHigh(LAYER_4);
setPinInputHigh(LAYER_5);
writePin(LAYER_1, 0);
writePin(LAYER_2, 0);
writePin(LAYER_3, 1);
writePin(LAYER_4, 0);
writePin(LAYER_5, 0);
break;
case 3 :
writePin(LAYER_4, 0);
setPinInputHigh(LAYER_5);
setPinInputHigh(LAYER_1);
setPinInputHigh(LAYER_2);
setPinInputHigh(LAYER_3);
setPinOutput(LAYER_4);
writePin(LAYER_1, 0);
writePin(LAYER_2, 0);
writePin(LAYER_3, 0);
writePin(LAYER_4, 1);
writePin(LAYER_5, 0);
break;
case 4 :
setPinOutput(LAYER_5);
writePin(LAYER_5, 0);
setPinInputHigh(LAYER_1);
setPinInputHigh(LAYER_2);
setPinInputHigh(LAYER_3);
setPinInputHigh(LAYER_4);
writePin(LAYER_1, 0);
writePin(LAYER_2, 0);
writePin(LAYER_3, 0);
writePin(LAYER_4, 0);
writePin(LAYER_5, 1);
break;
default :
setPinInputHigh(LAYER_1);
setPinInputHigh(LAYER_2);
setPinInputHigh(LAYER_3);
setPinInputHigh(LAYER_4);
setPinInputHigh(LAYER_5);
writePin(LAYER_1, 0);
writePin(LAYER_2, 0);
writePin(LAYER_3, 0);
writePin(LAYER_4, 0);
writePin(LAYER_5, 0);
}
}
2 changes: 0 additions & 2 deletions keyboards/4pplet/eagle_viper_rep/rev_b/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = yes
# BACKLIGHT_DRIVER = pwm
RGBLIGHT_ENABLE = yes
WS2812_DRIVER = pwm

# Wildcard to allow APM32 MCU
DFU_SUFFIX_ARGS = -p FFFF -v FFFF
Expand Down

0 comments on commit 107b979

Please sign in to comment.