hook ws2812 arm stuff up to rgblight stuff

pull/4406/head
Jack Humbert 7 years ago
parent d3e14c0d43
commit 05af481c00

@ -21,7 +21,7 @@ void setColor(uint8_t color, uint8_t *buf,uint32_t mask){
}
}
void setColorRGB(Color c, uint8_t *buf, uint32_t 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);
@ -49,6 +49,10 @@ void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb)
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
@ -151,9 +155,15 @@ void ws2812_setleds(LED_TYPE *ledarray, uint16_t 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) {
}

@ -125,7 +125,9 @@
/* 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 RGBLIGHT_ANIMATIONS
#define WS2812_LED_N 9
#define RGBLED_NUM WS2812_LED_N
#define WS2812_TIM_N 2
#define WS2812_TIM_CH 2

@ -18,18 +18,24 @@
uint8_t *o_fb;
uint16_t counterst = 0;
void matrix_init_kb(void) {
// rgblight_enable();
// rgblight_mode(1);
// rgblight_setrgb(0xFF, 0xFF, 0xFF);
ledDriverInit(2, GPIOA, 0b00000010, &o_fb);
testPatternFB(o_fb);
ledDriverInit(9, GPIOA, 0b00000010, &o_fb);
//testPatternFB(o_fb);
matrix_init_user();
}
void matrix_scan_kb(void) {
matrix_scan_user();
testPatternFB(o_fb);
if (counterst == 0) {
//testPatternFB(o_fb);
}
counterst = (counterst + 1) % 1024;
rgblight_task();
}

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

Loading…
Cancel
Save