Compare commits

...

35 Commits

Author SHA1 Message Date
Jack Humbert e917fa2eb4 adds rgb to preonic
5 years ago
Jack Humbert 69147de462 update license header
6 years ago
Jack Humbert 018b764e6d freq change via chax
6 years ago
Jack Humbert b87dd45ae0 ws2812 takes normal config now
6 years ago
Jack Humbert 16110aff6f correct items from merge
6 years ago
Jack Humbert 5a305d9472 updates to rgb config
6 years ago
Jack Humbert 4c68334ca6 correct items from merge
6 years ago
Jack Humbert 5112eab859 merge
6 years ago
Jack Humbert b088f77fbd couple more changes from chax
6 years ago
Jack Humbert 64230257b0 update config via chax's suggestion (for LT, etc)
6 years ago
Jack Humbert e8bbcaa671 working on arm and avr
6 years ago
Jack Humbert 05af481c00 hook ws2812 arm stuff up to rgblight stuff
6 years ago
Jack Humbert d3e14c0d43 merge
6 years ago
Jack Humbert 4fdc9badd3 Merge branch 'master' of github.com:qmk/qmk_firmware into planck_rev6
6 years ago
Jack Humbert af6107bee8 working example
6 years ago
Jack Humbert d233737c95 last commit for glasser code
6 years ago
Jack Humbert 3e282ab203 update ws2812 driver/config
6 years ago
Jack Humbert 1c0d85c143 update build includes for chibios
6 years ago
Jack Humbert 7c19e9fa04 pwm ws driver (not working)
6 years ago
Jack Humbert 9fccfc8dd5 conditional autio
6 years ago
Jack Humbert 1cb72a9c59 dont break other revs
6 years ago
Jack Humbert 82146ecfc0 dont break other revs
6 years ago
Jack Humbert 4a1984d33e merge from master
6 years ago
Jack Humbert 676080372c try mouse wheel again
6 years ago
Jack Humbert 0af7415981 Merge branch 'master' of github.com:qmk/qmk_firmware into planck_rev6
6 years ago
Jack Humbert df371458b3 flip direction
6 years ago
Jack Humbert e0e5efbead muse working with encoder as control
6 years ago
Jack Humbert edb4460e64 start muse implementation
6 years ago
Jack Humbert fe72bfa070 adds default encoder res
6 years ago
Jack Humbert 25642c8840 adds default encoder res
6 years ago
Jack Humbert 03b1904b2e Merge branch 'master' of github.com:qmk/qmk_firmware into planck_rev6
6 years ago
Jack Humbert bb71a988c2 flesh out dip and encoder support
6 years ago
Jack Humbert ddee61c9ba adds ws2812 driver for arm
6 years ago
Jack Humbert 91efe74365 music map init, dip scan added
6 years ago
Jack Humbert 12a64ff24b initial files for rev 6 with encoder
6 years ago

@ -115,7 +115,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
endif
RGB_MATRIX_ENABLE ?= no
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 custom
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 WS2812 custom
ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
$(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type)
@ -128,10 +128,11 @@ endif
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
RGB_MATRIX_ENABLE = IS31FL3731
RGB_MATRIX_ENABLE = IS31FL3731
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DIS31FL3731
COMMON_VPATH += $(DRIVER_PATH)/issi
SRC += is31fl3731.c
@ -139,12 +140,19 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DIS31FL3733
COMMON_VPATH += $(DRIVER_PATH)/issi
SRC += is31fl3733.c
SRC += i2c_master.c
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DWS2812
SRC += ws2812.c
endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
OPT_DEFS += -DTAP_DANCE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c

@ -0,0 +1,204 @@
/*
* LEDDriver.c
*
* Created on: Aug 26, 2013
* Author: Omri Iluz
*/
#include "ws2812.h"
#include "stdlib.h"
#include "quantum.h"
static uint8_t *fb;
static int sLeds;
static stm32_gpio_t *sPort;
static uint32_t sMask;
uint8_t* dma_source;
static LED_TYPE led_array[RGBLED_NUM];
void setColor(uint8_t color, uint8_t *buf,uint32_t mask){
int i;
for (i=0;i<8;i++){
buf[i]=((color<<i)&0b10000000?0x0:mask);
}
}
void setColorRGB(Color c, uint8_t *buf, uint32_t mask) {
setColor(c.G,buf, mask);
setColor(c.R,buf+8, mask);
setColor(c.B,buf+16, mask);
}
/**
* @brief Initialize Led Driver
* @details Initialize the Led Driver based on parameters.
* Following initialization, the frame buffer would automatically be
* exported to the supplied port and pins in the right timing to drive
* a chain of WS2812B controllers
* @note The function assumes the controller is running at 72Mhz
* @note Timing is critical for WS2812. While all timing is done in hardware
* need to verify memory bandwidth is not exhausted to avoid DMA delays
*
* @param[in] leds length of the LED chain controlled by each pin
* @param[in] port which port would be used for output
* @param[in] mask Which pins would be used for output, each pin is a full chain
* @param[out] o_fb initialized frame buffer
*
*/
void WS2812_init(void) {
static uint8_t * p;
//uint32_t port = RGBLED_PORT;
//ledDriverInit(RGBLED_NUM, (stm32_gpio_t *)(port & 0xFFF0), 1 << (port & 0xF), &p);
pin_t rgb_pin = RGB_DI_PIN;
ledDriverInit(RGBLED_NUM, PAL_PORT(rgb_pin), 1 << PAL_PAD(rgb_pin), &p);
}
void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb) {
sLeds=leds;
sPort=port;
sMask=mask;
palSetGroupMode(port, sMask, 0, PAL_MODE_OUTPUT_PUSHPULL|PAL_STM32_OSPEED_HIGHEST|PAL_STM32_PUPDR_FLOATING);
// maybe don't do whole port?
// palSetPadMode(port, 8, PAL_MODE_OUTPUT_PUSHPULL|PAL_STM32_OSPEED_HIGHEST|PAL_STM32_PUPDR_FLOATING);
// configure pwm timers -
// timer 2 as master, active for data transmission and inactive to disable transmission during reset period (50uS)
// timer 3 as slave, during active time creates a 1.25 uS signal, with duty cycle controlled by frame buffer values
static PWMConfig pwmc2 = {72000000 / 90, /* 800Khz PWM clock frequency. 1/90 of PWMC3 */
(72000000 / 90) * 0.05, /*Total period is 50ms (20FPS), including sLeds cycles + reset length for ws2812b and FB writes */
NULL,
{ {PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_DISABLED, NULL},
{PWM_OUTPUT_DISABLED, NULL},
{PWM_OUTPUT_DISABLED, NULL}},
TIM_CR2_MMS_2, /* master mode selection */
0, };
/* master mode selection */
static PWMConfig pwmc3 = {72000000,/* 72Mhz PWM clock frequency. */
90, /* 90 cycles period (1.25 uS per period @72Mhz */
NULL,
{ {PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}},
0,
0,
};
dma_source = chHeapAlloc(NULL, 1);
fb = chHeapAlloc(NULL, ((sLeds) * 24)+10);
*o_fb=fb;
int j;
for (j = 0; j < (sLeds) * 24; j++) fb[j] = 0;
dma_source[0] = sMask;
// DMA stream 2, triggered by channel3 pwm signal. if FB indicates, reset output value early to indicate "0" bit to ws2812
dmaStreamAllocate(STM32_DMA1_STREAM2, 10, NULL, NULL);
dmaStreamSetPeripheral(STM32_DMA1_STREAM2, &(sPort->BSRR.H.clear));
dmaStreamSetMemory0(STM32_DMA1_STREAM2, fb);
dmaStreamSetTransactionSize(STM32_DMA1_STREAM2, (sLeds) * 24);
dmaStreamSetMode(
STM32_DMA1_STREAM2,
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_MINC | STM32_DMA_CR_PSIZE_BYTE
| STM32_DMA_CR_MSIZE_BYTE | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(2));
// DMA stream 3, triggered by pwm update event. output high at beginning of signal
dmaStreamAllocate(STM32_DMA1_STREAM3, 10, NULL, NULL);
dmaStreamSetPeripheral(STM32_DMA1_STREAM3, &(sPort->BSRR.H.set));
dmaStreamSetMemory0(STM32_DMA1_STREAM3, dma_source);
dmaStreamSetTransactionSize(STM32_DMA1_STREAM3, 1);
dmaStreamSetMode(
STM32_DMA1_STREAM3, STM32_DMA_CR_TEIE |
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE
| STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
// DMA stream 6, triggered by channel1 update event. reset output value late to indicate "1" bit to ws2812.
// always triggers but no affect if dma stream 2 already change output value to 0
dmaStreamAllocate(STM32_DMA1_STREAM6, 10, NULL, NULL);
dmaStreamSetPeripheral(STM32_DMA1_STREAM6, &(sPort->BSRR.H.clear));
dmaStreamSetMemory0(STM32_DMA1_STREAM6, dma_source);
dmaStreamSetTransactionSize(STM32_DMA1_STREAM6, 1);
dmaStreamSetMode(
STM32_DMA1_STREAM6,
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE
| STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
pwmStart(&PWMD2, &pwmc2);
pwmStart(&PWMD3, &pwmc3);
// set pwm3 as slave, triggerd by pwm2 oc1 event. disables pwmd2 for synchronization.
PWMD3.tim->SMCR |= TIM_SMCR_SMS_0 | TIM_SMCR_SMS_2 | TIM_SMCR_TS_0;
PWMD2.tim->CR1 &= ~TIM_CR1_CEN;
// set pwm values.
// 28 (duty in ticks) / 90 (period in ticks) * 1.25uS (period in S) = 0.39 uS
pwmEnableChannel(&PWMD3, 2, 28);
// 58 (duty in ticks) / 90 (period in ticks) * 1.25uS (period in S) = 0.806 uS
pwmEnableChannel(&PWMD3, 0, 58);
// active during transfer of 90 cycles * sLeds * 24 bytes * 1/90 multiplier
pwmEnableChannel(&PWMD2, 0, 90 * sLeds * 24 / 90);
// stop and reset counters for synchronization
PWMD2.tim->CNT = 0;
// Slave (TIM3) needs to "update" immediately after master (TIM2) start in order to start in sync.
// this initial sync is crucial for the stability of the run
PWMD3.tim->CNT = 89;
PWMD3.tim->DIER |= TIM_DIER_CC3DE | TIM_DIER_CC1DE | TIM_DIER_UDE;
dmaStreamEnable(STM32_DMA1_STREAM3);
dmaStreamEnable(STM32_DMA1_STREAM6);
dmaStreamEnable(STM32_DMA1_STREAM2);
// all systems go! both timers and all channels are configured to resonate
// in complete sync without any need for CPU cycles (only DMA and timers)
// start pwm2 for system to start resonating
PWMD2.tim->CR1 |= TIM_CR1_CEN;
}
void ledDriverWaitCycle(void){
while (PWMD2.tim->CNT < 90 * sLeds * 24 / 90){chThdSleepMicroseconds(1);};
}
void testPatternFB(uint8_t *fb){
int i;
Color tmpC = {rand()%256, rand()%256, rand()%256};
for (i=0;i<sLeds;i++){
setColorRGB(tmpC,fb+24*i, sMask);
}
}
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) {
// uint8_t i = 0;
// while (i < number_of_leds) {
// ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
// i++;
// }
uint8_t i = 0;
while (i < number_of_leds) {
setColor(ledarray[i].g, (fb+24*i), sMask);
setColor(ledarray[i].r, (fb+24*i)+8, sMask);
setColor(ledarray[i].b, (fb+24*i)+16, sMask);
i++;
}
}
void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds) {
}
void WS2812_send_color( uint8_t index ) {
setColor(led_array[index].g, (fb+24*index), sMask);
setColor(led_array[index].r, (fb+24*index)+8, sMask);
setColor(led_array[index].b, (fb+24*index)+16, sMask);
}
void WS2812_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
led_array[index].r = red;
led_array[index].g = green;
led_array[index].b = blue;
}
void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
for (int i = 0; i < RGBLED_NUM; i++) {
WS2812_set_color( i, red, green, blue );
}
}
void WS2812_send_colors(void) {
for (int i = 0; i < RGBLED_NUM; i++) {
WS2812_send_color( i );
}
}

@ -0,0 +1,44 @@
/*
Copyright (C) 2013 Omri Iluz
2018 Jack Humbert
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include "hal.h"
#include "rgblight_types.h"
#define sign(x) (( x > 0 ) - ( x < 0 ))
typedef struct Color Color;
struct Color {
uint8_t R;
uint8_t G;
uint8_t B;
};
void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb);
void setColorRGB(Color c, uint8_t *buf, uint32_t mask);
void testPatternFB(uint8_t *fb);
void ledDriverWaitCycle(void);
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
void WS2812_init(void);
void WS2812_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
void WS2812_send_colors(void);

@ -27,6 +27,8 @@
#include <util/delay.h>
#include "debug.h"
static LED_TYPE led_array[RGBLED_NUM];
#ifdef RGBW_BB_TWI
// Port for the I2C
@ -128,11 +130,11 @@ unsigned char I2C_Write(unsigned char c)
c <<= 1;
}
I2C_WriteBit(0);
_delay_us(I2C_DELAY);
_delay_us(I2C_DELAY);
// _delay_us(I2C_DELAY);
//return I2C_ReadBit();
return 0;
@ -141,6 +143,28 @@ unsigned char I2C_Write(unsigned char c)
#endif
// for RGB matrix
void WS2812_init(void) {
}
void WS2812_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
led_array[index].r = red;
led_array[index].g = green;
led_array[index].b = blue;
}
void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
for (int i = 0; i < RGBLED_NUM; i++) {
WS2812_set_color( i, red, green, blue );
}
}
void inline WS2812_send_colors(void) {
ws2812_setleds_pin(led_array, RGBLED_NUM, _BV(RGB_DI_PIN & 0xF));
}
// Setleds for standard RGB
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
{

@ -20,8 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIGHT_WS2812_H_
#define LIGHT_WS2812_H_
#pragma once
#include <avr/io.h>
#include <avr/interrupt.h>
@ -30,6 +29,10 @@
#include "rgblight_types.h"
void WS2812_init(void);
void WS2812_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
void WS2812_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
void WS2812_send_colors(void);
/* User Interface
*
@ -68,5 +71,3 @@ void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
#ifndef CONCAT_EXP
#define CONCAT_EXP(a, b) CONCAT(a, b)
#endif
#endif /* LIGHT_WS2812_H_ */

@ -3,6 +3,18 @@
#define BL_GREEN OCR1A
#define BL_BLUE OCR1C
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
/*{row | col << 4}
| {x=0..224, y=0..64}
| | modifier
| | | */
{{0|(0<<4)}, {0, 32}, 0},
{{0|(1<<4)}, {75, 32}, 0},
{{0|(2<<4)}, {150, 32}, 0},
{{0|(2<<4)}, {224, 23}, 0},
};
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up

@ -48,7 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 20
@ -146,6 +146,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
#define WS2812_LED_N RGBLED_NUM
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_KEYPRESSES
/*
* Feature disable options
* These options are also useful to firmware size reduction.

@ -1,21 +0,0 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

@ -54,16 +54,17 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
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
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870)
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality by default
RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870)
RGB_MATRIX_ENABLE = WS2812
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality by default
MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID

@ -36,4 +36,3 @@
// Most tactile encoders have detents every 4 stages
#define ENCODER_RESOLUTION 4

@ -144,6 +144,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Exit | | | A | O | | E | U | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PLOVER] = LAYOUT_planck_grid(
KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 ,
XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
@ -163,12 +164,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT_planck_grid(
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______,
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
#ifdef AUDIO_ENABLE

@ -48,7 +48,7 @@
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#define CH_CFG_ST_FREQUENCY 100000
#define CH_CFG_ST_FREQUENCY 1000
/**
* @brief Time delta constant for the tick-less mode.
@ -58,7 +58,7 @@
* The value one is not valid, timeouts are rounded up to
* this value.
*/
#define CH_CFG_ST_TIMEDELTA 2
#define CH_CFG_ST_TIMEDELTA 0
/** @} */

@ -54,6 +54,9 @@
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 6
/* Prevent modifiers from being stuck on after layer changes. */
#define PREVENT_STUCK_MODIFIERS
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
//#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
@ -126,14 +129,12 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1
#define WS2812_LED_N 2
#define RGBLED_NUM WS2812_LED_N
#define WS2812_TIM_N 2
#define WS2812_TIM_CH 2
#define PORT_WS2812 GPIOA
#define PIN_WS2812 1
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP
//#define WS2812_EXTERNAL_PULLUP
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 9
#define RGB_DI_PIN A1
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_KEYPRESSES
#endif

@ -111,7 +111,7 @@
* @brief Enables the PWM subsystem.
*/
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
#define HAL_USE_PWM FALSE
#define HAL_USE_PWM TRUE
#endif
/**

@ -225,7 +225,7 @@
* ST driver system settings.
*/
#define STM32_ST_IRQ_PRIORITY 8
#define STM32_ST_USE_TIMER 2
#define STM32_ST_USE_TIMER 3
/*
* UART driver system settings.

@ -14,11 +14,45 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rev6.h"
#include "rgblight.h"
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
/*{row | col << 4}
| {x=0..224, y=0..64}
| | modifier
| | | */
{{2|(5<<4)}, {112, 39}, 0},
{{7|(1<<4)}, {148, 60}, 0},
{{3|(4<<4)}, {206, 53}, 0},
{{4|(4<<4)}, {206, 3}, 0},
{{4|(1<<4)}, {150, 3}, 0},
{{0|(4<<4)}, {74, 3}, 0},
{{0|(1<<4)}, {18, 3}, 0},
{{3|(1<<4)}, {18, 54}, 0},
{{7|(4<<4)}, {77, 60}, 0}
};
uint8_t *o_fb;
uint16_t counterst = 0;
void matrix_init_kb(void) {
// rgblight_enable();
// rgblight_mode(1);
// rgblight_setrgb(0xFF, 0xFF, 0xFF);
//ledDriverInit(9, GPIOA, 0b00000010, &o_fb);
//testPatternFB(o_fb);
matrix_init_user();
}
void matrix_scan_kb(void) {
matrix_scan_user();
if (counterst == 0) {
//testPatternFB(o_fb);
}
counterst = (counterst + 1) % 1024;
//rgblight_task();
}

@ -53,5 +53,6 @@ NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file
AUDIO_ENABLE = yes
RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = WS2812
# SERIAL_LINK_ENABLE = yes
ENCODER_ENABLE = yes

@ -157,7 +157,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_ADJUST] = LAYOUT_preonic_grid( \
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL, \
_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL, \
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \

@ -41,14 +41,14 @@
* @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits.
*/
#define CH_CFG_ST_RESOLUTION 16
#define CH_CFG_ST_RESOLUTION 32
/**
* @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#define CH_CFG_ST_FREQUENCY 10000
#define CH_CFG_ST_FREQUENCY 1000
/**
* @brief Time delta constant for the tick-less mode.
@ -58,7 +58,7 @@
* The value one is not valid, timeouts are rounded up to
* this value.
*/
#define CH_CFG_ST_TIMEDELTA 2
#define CH_CFG_ST_TIMEDELTA 0
/** @} */

@ -122,14 +122,13 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1
#define WS2812_LED_N 2
#define RGBLED_NUM WS2812_LED_N
#define WS2812_TIM_N 2
#define WS2812_TIM_CH 2
#define PORT_WS2812 GPIOA
#define PIN_WS2812 1
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP
//#define WS2812_EXTERNAL_PULLUP
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 9
#define RGB_DI_PIN A1
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_KEYPRESSES
#endif

@ -225,7 +225,7 @@
* ST driver system settings.
*/
#define STM32_ST_IRQ_PRIORITY 8
#define STM32_ST_USE_TIMER 4
#define STM32_ST_USE_TIMER 3
/*
* UART driver system settings.

@ -14,6 +14,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rev3.h"
#include "rgblight.h"
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
/*{row | col << 4}
| {x=0..224, y=0..64}
| | modifier
| | | */
{{2|(5<<4)}, {112, 39}, 0},
{{7|(1<<4)}, {148, 60}, 0},
{{3|(4<<4)}, {206, 53}, 0},
{{4|(4<<4)}, {206, 3}, 0},
{{4|(1<<4)}, {150, 3}, 0},
{{0|(4<<4)}, {74, 3}, 0},
{{0|(1<<4)}, {18, 3}, 0},
{{3|(1<<4)}, {18, 54}, 0},
{{7|(4<<4)}, {77, 60}, 0}
};
uint8_t *o_fb;
void matrix_init_kb(void) {
matrix_init_user();

@ -53,4 +53,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file
AUDIO_ENABLE = yes
RGBLIGHT_ENABLE = no
RGB_MATRIX_ENABLE = WS2812
# SERIAL_LINK_ENABLE = yes

@ -38,7 +38,7 @@ F_USB = $(F_CPU)
# Bootloader
# This definition is optional, and if your keyboard supports multiple bootloaders of
# different sizes, comment this out, and the correct address will be loaded
# different sizes, comment this out, and the correct address will be loaded
# automatically (+60). See bootloader.mk for all options.
ifeq ($(strip $(KEYBOARD)), preonic/rev1)
BOOTLOADER = atmel-dfu
@ -51,7 +51,7 @@ endif
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
@ -73,4 +73,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
LAYOUTS = ortho_5x12
DEFAULT_FOLDER = preonic/rev2
DEFAULT_FOLDER = preonic/rev2

@ -92,7 +92,7 @@ void eeconfig_update_rgb_matrix_default(void) {
rgb_matrix_config.hue = 0;
rgb_matrix_config.sat = 255;
rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
rgb_matrix_config.speed = 0;
rgb_matrix_config.speed = 1;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void eeconfig_debug_rgb_matrix(void) {
@ -626,6 +626,9 @@ void rgb_matrix_custom(void) {
// }
}
static uint8_t tick_slower = 5;
static uint8_t tick_counter = 0;
void rgb_matrix_task(void) {
#ifdef TRACK_PREVIOUS_EFFECT
static uint8_t toggle_enable_last = 255;
@ -645,7 +648,10 @@ void rgb_matrix_task(void) {
return;
}
g_tick++;
if (tick_counter == 0) {
g_tick++;
}
tick_counter = ( tick_counter + 1) % tick_slower;
if ( g_any_key_hit < 0xFFFFFFFF ) {
g_any_key_hit++;

@ -28,6 +28,8 @@
#include "is31fl3731.h"
#elif defined (IS31FL3733)
#include "is31fl3733.h"
#elif defined (WS2812)
#include "ws2812.h"
#endif
typedef struct Point {

@ -80,3 +80,14 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
#endif
#endif
#if defined(WS2812)
const rgb_matrix_driver_t rgb_matrix_driver = {
.init = WS2812_init,
.flush = WS2812_send_colors,
.set_color = WS2812_set_color,
.set_color_all = WS2812_set_color_all,
};
#endif

@ -319,7 +319,7 @@ void rgblight_disable_noeeprom(void) {
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_disable();
#endif
_delay_ms(50);
wait_ms(50);
rgblight_set();
}

Loading…
Cancel
Save