summaryrefslogtreecommitdiff
path: root/keyboards/gmmk/compact/led_matrix.c
blob: 3db25edf363bae733c660698e5dc0b9aadb8fff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "rgb_matrix.h"


extern void _set_color(int index, uint8_t r, uint8_t g, uint8_t b);

extern void process_backlight(uint8_t devid, volatile LED_TYPE* states);

static void flush(void)
{
    process_backlight(0, NULL);
}

void set_color(int index, uint8_t r, uint8_t g, uint8_t b) {
    if (index >= 0 && index < DRIVER_LED_TOTAL)
    {
        _set_color(index, r, g, b);
    }   
}

static void set_color_all(uint8_t r, uint8_t g, uint8_t b) {
    for (int i = 0; i < DRIVER_LED_TOTAL; i++)
        set_color(i, r, g, b);
}

void init(void) {
}

const rgb_matrix_driver_t rgb_matrix_driver = {
    .init          = init,
    .flush         = flush,
    .set_color     = set_color,
    .set_color_all = set_color_all,
};

int rand(void) {
    static uint32_t seed = 134775813U;
    seed                 = seed * 1664525U + 1013904223U;
    return seed;
}