diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2017-09-15 21:44:39 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-09-15 21:44:39 -0400 |
| commit | 5ad5c230d6cf9f90a8337ec54dee8b14e332d3c6 (patch) | |
| tree | ac6e6b0417e3c6550e6c8e07f615fabdc74b1ef1 | |
| parent | afcf3a2878d5b5de0f9daba201ab44d779a8b2b1 (diff) | |
| parent | dc7d0c7b7442b87600352e083e3da4a08cb2d069 (diff) | |
| download | qmk_firmware-5ad5c230d6cf9f90a8337ec54dee8b14e332d3c6.tar.gz qmk_firmware-5ad5c230d6cf9f90a8337ec54dee8b14e332d3c6.zip | |
Merge branch 'luizribeiro-ps2avrGB'
| -rw-r--r-- | common_features.mk | 7 | ||||
| -rw-r--r-- | drivers/avr/ws2812.h | 18 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/config.h | 3 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/i2c.c | 104 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/i2c.h | 25 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/keymaps/default/keymap.c | 27 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/matrix.c | 2 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/ps2avrGB.c | 45 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/ps2avrGB.h | 1 | ||||
| -rw-r--r-- | keyboards/ps2avrGB/rules.mk | 6 | ||||
| -rw-r--r-- | quantum/rgblight.c | 3 | ||||
| -rw-r--r-- | quantum/rgblight.h | 3 | ||||
| -rw-r--r-- | quantum/rgblight_types.h | 45 |
13 files changed, 259 insertions, 30 deletions
diff --git a/common_features.mk b/common_features.mk index d499d1f0b..6f29c97c9 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -93,10 +93,13 @@ endif | |||
| 93 | 93 | ||
| 94 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 94 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
| 95 | OPT_DEFS += -DRGBLIGHT_ENABLE | 95 | OPT_DEFS += -DRGBLIGHT_ENABLE |
| 96 | SRC += ws2812.c | ||
| 97 | SRC += $(QUANTUM_DIR)/rgblight.c | ||
| 98 | CIE1931_CURVE = yes | 96 | CIE1931_CURVE = yes |
| 99 | LED_BREATHING_TABLE = yes | 97 | LED_BREATHING_TABLE = yes |
| 98 | ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) | ||
| 99 | OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER | ||
| 100 | else | ||
| 101 | SRC += ws2812.c | ||
| 102 | endif | ||
| 100 | endif | 103 | endif |
| 101 | 104 | ||
| 102 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | 105 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) |
diff --git a/drivers/avr/ws2812.h b/drivers/avr/ws2812.h index 60924a0fb..f7e0c3144 100644 --- a/drivers/avr/ws2812.h +++ b/drivers/avr/ws2812.h | |||
| @@ -28,23 +28,7 @@ | |||
| 28 | //#include "ws2812_config.h" | 28 | //#include "ws2812_config.h" |
| 29 | //#include "i2cmaster.h" | 29 | //#include "i2cmaster.h" |
| 30 | 30 | ||
| 31 | #ifdef RGBW | 31 | #include "rgblight_types.h" |
| 32 | #define LED_TYPE struct cRGBW | ||
| 33 | #else | ||
| 34 | #define LED_TYPE struct cRGB | ||
| 35 | #endif | ||
| 36 | |||
| 37 | |||
| 38 | /* | ||
| 39 | * Structure of the LED array | ||
| 40 | * | ||
| 41 | * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 | ||
| 42 | * cRGBW: RGBW for SK6812RGBW | ||
| 43 | */ | ||
| 44 | |||
| 45 | struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; | ||
| 46 | struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; | ||
| 47 | |||
| 48 | 32 | ||
| 49 | 33 | ||
| 50 | /* User Interface | 34 | /* User Interface |
diff --git a/keyboards/ps2avrGB/config.h b/keyboards/ps2avrGB/config.h index b5c696f3f..fc17b5d5e 100644 --- a/keyboards/ps2avrGB/config.h +++ b/keyboards/ps2avrGB/config.h | |||
| @@ -29,6 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #define MATRIX_ROWS 8 | 29 | #define MATRIX_ROWS 8 |
| 30 | #define MATRIX_COLS 15 | 30 | #define MATRIX_COLS 15 |
| 31 | 31 | ||
| 32 | #define RGBLED_NUM 16 | ||
| 33 | #define RGBLIGHT_ANIMATIONS | ||
| 34 | |||
| 32 | #define NO_UART 1 | 35 | #define NO_UART 1 |
| 33 | #define BOOTLOADHID_BOOTLOADER 1 | 36 | #define BOOTLOADHID_BOOTLOADER 1 |
| 34 | 37 | ||
diff --git a/keyboards/ps2avrGB/i2c.c b/keyboards/ps2avrGB/i2c.c new file mode 100644 index 000000000..c27f3e3d1 --- /dev/null +++ b/keyboards/ps2avrGB/i2c.c | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <avr/io.h> | ||
| 19 | #include <util/twi.h> | ||
| 20 | |||
| 21 | #include "i2c.h" | ||
| 22 | |||
| 23 | void i2c_set_bitrate(uint16_t bitrate_khz) { | ||
| 24 | uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); | ||
| 25 | if (bitrate_div >= 16) { | ||
| 26 | bitrate_div = (bitrate_div - 16) / 2; | ||
| 27 | } | ||
| 28 | TWBR = bitrate_div; | ||
| 29 | } | ||
| 30 | |||
| 31 | void i2c_init(void) { | ||
| 32 | // set pull-up resistors on I2C bus pins | ||
| 33 | PORTC |= 0b11; | ||
| 34 | |||
| 35 | i2c_set_bitrate(400); | ||
| 36 | |||
| 37 | // enable TWI (two-wire interface) | ||
| 38 | TWCR |= (1 << TWEN); | ||
| 39 | |||
| 40 | // enable TWI interrupt and slave address ACK | ||
| 41 | TWCR |= (1 << TWIE); | ||
| 42 | TWCR |= (1 << TWEA); | ||
| 43 | } | ||
| 44 | |||
| 45 | uint8_t i2c_start(uint8_t address) { | ||
| 46 | // reset TWI control register | ||
| 47 | TWCR = 0; | ||
| 48 | |||
| 49 | // begin transmission and wait for it to end | ||
| 50 | TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); | ||
| 51 | while (!(TWCR & (1<<TWINT))); | ||
| 52 | |||
| 53 | // check if the start condition was successfully transmitted | ||
| 54 | if ((TWSR & 0xF8) != TW_START) { | ||
| 55 | return 1; | ||
| 56 | } | ||
| 57 | |||
| 58 | // transmit address and wait | ||
| 59 | TWDR = address; | ||
| 60 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 61 | while (!(TWCR & (1<<TWINT))); | ||
| 62 | |||
| 63 | // check if the device has acknowledged the READ / WRITE mode | ||
| 64 | uint8_t twst = TW_STATUS & 0xF8; | ||
| 65 | if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) { | ||
| 66 | return 1; | ||
| 67 | } | ||
| 68 | |||
| 69 | return 0; | ||
| 70 | } | ||
| 71 | |||
| 72 | void i2c_stop(void) { | ||
| 73 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 74 | } | ||
| 75 | |||
| 76 | uint8_t i2c_write(uint8_t data) { | ||
| 77 | TWDR = data; | ||
| 78 | |||
| 79 | // transmit data and wait | ||
| 80 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 81 | while (!(TWCR & (1<<TWINT))); | ||
| 82 | |||
| 83 | if ((TWSR & 0xF8) != TW_MT_DATA_ACK) { | ||
| 84 | return 1; | ||
| 85 | } | ||
| 86 | |||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | |||
| 90 | uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) { | ||
| 91 | if (i2c_start(address)) { | ||
| 92 | return 1; | ||
| 93 | } | ||
| 94 | |||
| 95 | for (uint16_t i = 0; i < length; i++) { | ||
| 96 | if (i2c_write(data[i])) { | ||
| 97 | return 1; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | i2c_stop(); | ||
| 102 | |||
| 103 | return 0; | ||
| 104 | } | ||
diff --git a/keyboards/ps2avrGB/i2c.h b/keyboards/ps2avrGB/i2c.h new file mode 100644 index 000000000..27c9d3d05 --- /dev/null +++ b/keyboards/ps2avrGB/i2c.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef __I2C_H__ | ||
| 19 | #define __I2C_H__ | ||
| 20 | |||
| 21 | void i2c_init(void); | ||
| 22 | void i2c_set_bitrate(uint16_t bitrate_khz); | ||
| 23 | uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); | ||
| 24 | |||
| 25 | #endif | ||
diff --git a/keyboards/ps2avrGB/keymaps/default/keymap.c b/keyboards/ps2avrGB/keymaps/default/keymap.c index 3e4cebc81..4650ff633 100644 --- a/keyboards/ps2avrGB/keymaps/default/keymap.c +++ b/keyboards/ps2avrGB/keymaps/default/keymap.c | |||
| @@ -16,17 +16,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "ps2avrGB.h" | 18 | #include "ps2avrGB.h" |
| 19 | #include "action_layer.h" | ||
| 20 | #include "rgblight.h" | ||
| 19 | 21 | ||
| 20 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 22 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 21 | KC_KEYMAP( | 23 | [0] = KEYMAP( |
| 22 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,HOME,END, | 24 | KC_ESC, 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_PSCR,KC_HOME,KC_END, |
| 23 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, DEL, | 25 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_DEL, |
| 24 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, INS, | 26 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_INS, |
| 25 | CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, PGUP, | 27 | KC_FN0, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENT, KC_PGUP, |
| 26 | LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, UP, PGDN, | 28 | KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, KC_PGDN, |
| 27 | LCTL,LALT,LGUI, SPC, RGUI,RALT,RCTL,LEFT,DOWN,RGHT | 29 | KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT |
| 28 | ) | 30 | ), |
| 31 | [1] = KEYMAP( | ||
| 32 | KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI,RGB_HUD,RGB_SAD,RGB_VAD,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END, | ||
| 33 | KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_DEL, | ||
| 34 | KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_INS, | ||
| 35 | KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, | ||
| 36 | KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, | ||
| 37 | KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_RGHT | ||
| 38 | ), | ||
| 29 | }; | 39 | }; |
| 30 | 40 | ||
| 31 | const uint16_t PROGMEM fn_actions[] = { | 41 | const uint16_t PROGMEM fn_actions[] = { |
| 42 | [0] = ACTION_LAYER_MOMENTARY(1), | ||
| 32 | }; | 43 | }; |
diff --git a/keyboards/ps2avrGB/matrix.c b/keyboards/ps2avrGB/matrix.c index beaa54c40..140026013 100644 --- a/keyboards/ps2avrGB/matrix.c +++ b/keyboards/ps2avrGB/matrix.c | |||
| @@ -93,6 +93,8 @@ uint8_t matrix_scan(void) { | |||
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | matrix_scan_user(); | ||
| 97 | |||
| 96 | return 1; | 98 | return 1; |
| 97 | } | 99 | } |
| 98 | 100 | ||
diff --git a/keyboards/ps2avrGB/ps2avrGB.c b/keyboards/ps2avrGB/ps2avrGB.c index e69de29bb..701c5847f 100644 --- a/keyboards/ps2avrGB/ps2avrGB.c +++ b/keyboards/ps2avrGB/ps2avrGB.c | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "ps2avrGB.h" | ||
| 19 | #include "rgblight.h" | ||
| 20 | |||
| 21 | #include <avr/pgmspace.h> | ||
| 22 | |||
| 23 | #include "action_layer.h" | ||
| 24 | #include "i2c.h" | ||
| 25 | #include "quantum.h" | ||
| 26 | |||
| 27 | extern rgblight_config_t rgblight_config; | ||
| 28 | |||
| 29 | void rgblight_set(void) { | ||
| 30 | if (!rgblight_config.enable) { | ||
| 31 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | ||
| 32 | led[i].r = 0; | ||
| 33 | led[i].g = 0; | ||
| 34 | led[i].b = 0; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | i2c_init(); | ||
| 39 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | ||
| 40 | } | ||
| 41 | |||
| 42 | __attribute__ ((weak)) | ||
| 43 | void matrix_scan_user(void) { | ||
| 44 | rgblight_task(); | ||
| 45 | } | ||
diff --git a/keyboards/ps2avrGB/ps2avrGB.h b/keyboards/ps2avrGB/ps2avrGB.h index 813f31f80..35902cff4 100644 --- a/keyboards/ps2avrGB/ps2avrGB.h +++ b/keyboards/ps2avrGB/ps2avrGB.h | |||
| @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 18 | #ifndef KEYMAP_COMMON_H | 18 | #ifndef KEYMAP_COMMON_H |
| 19 | #define KEYMAP_COMMON_H | 19 | #define KEYMAP_COMMON_H |
| 20 | 20 | ||
| 21 | #include "quantum_keycodes.h" | ||
| 21 | #include "keycode.h" | 22 | #include "keycode.h" |
| 22 | #include "action.h" | 23 | #include "action.h" |
| 23 | 24 | ||
diff --git a/keyboards/ps2avrGB/rules.mk b/keyboards/ps2avrGB/rules.mk index e2b5922ea..9e76993c4 100644 --- a/keyboards/ps2avrGB/rules.mk +++ b/keyboards/ps2avrGB/rules.mk | |||
| @@ -20,7 +20,6 @@ PROTOCOL = VUSB | |||
| 20 | # unsupported features for now | 20 | # unsupported features for now |
| 21 | NO_UART = yes | 21 | NO_UART = yes |
| 22 | NO_SUSPEND_POWER_DOWN = yes | 22 | NO_SUSPEND_POWER_DOWN = yes |
| 23 | BACKLIGHT_ENABLE = no | ||
| 24 | 23 | ||
| 25 | # processor frequency | 24 | # processor frequency |
| 26 | F_CPU = 12000000 | 25 | F_CPU = 12000000 |
| @@ -31,13 +30,16 @@ MOUSEKEY_ENABLE = yes | |||
| 31 | EXTRAKEY_ENABLE = yes | 30 | EXTRAKEY_ENABLE = yes |
| 32 | CONSOLE_ENABLE = yes | 31 | CONSOLE_ENABLE = yes |
| 33 | COMMAND_ENABLE = yes | 32 | COMMAND_ENABLE = yes |
| 33 | BACKLIGHT_ENABLE = no | ||
| 34 | RGBLIGHT_ENABLE = yes | ||
| 35 | RGBLIGHT_CUSTOM_DRIVER = yes | ||
| 34 | 36 | ||
| 35 | OPT_DEFS = -DDEBUG_LEVEL=0 | 37 | OPT_DEFS = -DDEBUG_LEVEL=0 |
| 36 | OPT_DEFS += -DBOOTLOADER_SIZE=2048 | 38 | OPT_DEFS += -DBOOTLOADER_SIZE=2048 |
| 37 | 39 | ||
| 38 | # custom matrix setup | 40 | # custom matrix setup |
| 39 | CUSTOM_MATRIX = yes | 41 | CUSTOM_MATRIX = yes |
| 40 | SRC = matrix.c | 42 | SRC = matrix.c i2c.c |
| 41 | 43 | ||
| 42 | # programming options | 44 | # programming options |
| 43 | PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex | 45 | PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex |
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 5ae6e69d6..9ac1893d2 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c | |||
| @@ -373,7 +373,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { | |||
| 373 | rgblight_set(); | 373 | rgblight_set(); |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | __attribute__ ((weak)) | 376 | #ifndef RGBLIGHT_CUSTOM_DRIVER |
| 377 | void rgblight_set(void) { | 377 | void rgblight_set(void) { |
| 378 | if (rgblight_config.enable) { | 378 | if (rgblight_config.enable) { |
| 379 | #ifdef RGBW | 379 | #ifdef RGBW |
| @@ -394,6 +394,7 @@ void rgblight_set(void) { | |||
| 394 | #endif | 394 | #endif |
| 395 | } | 395 | } |
| 396 | } | 396 | } |
| 397 | #endif | ||
| 397 | 398 | ||
| 398 | #ifdef RGBLIGHT_ANIMATIONS | 399 | #ifdef RGBLIGHT_ANIMATIONS |
| 399 | 400 | ||
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 7acd5a257..c1b3378b3 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -62,7 +62,10 @@ | |||
| 62 | #include <stdint.h> | 62 | #include <stdint.h> |
| 63 | #include <stdbool.h> | 63 | #include <stdbool.h> |
| 64 | #include "eeconfig.h" | 64 | #include "eeconfig.h" |
| 65 | #ifndef RGBLIGHT_CUSTOM_DRIVER | ||
| 65 | #include "ws2812.h" | 66 | #include "ws2812.h" |
| 67 | #endif | ||
| 68 | #include "rgblight_types.h" | ||
| 66 | 69 | ||
| 67 | extern LED_TYPE led[RGBLED_NUM]; | 70 | extern LED_TYPE led[RGBLED_NUM]; |
| 68 | 71 | ||
diff --git a/quantum/rgblight_types.h b/quantum/rgblight_types.h new file mode 100644 index 000000000..b1aa7026c --- /dev/null +++ b/quantum/rgblight_types.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | * light weight WS2812 lib include | ||
| 3 | * | ||
| 4 | * Version 2.3 - Nev 29th 2015 | ||
| 5 | * Author: Tim (cpldcpu@gmail.com) | ||
| 6 | * | ||
| 7 | * Please do not change this file! All configuration is handled in "ws2812_config.h" | ||
| 8 | * | ||
| 9 | * This program is free software: you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation, either version 2 of the License, or | ||
| 12 | * (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License | ||
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef RGBLIGHT_TYPES | ||
| 24 | #define RGBLIGHT_TYPES | ||
| 25 | |||
| 26 | #include <avr/io.h> | ||
| 27 | |||
| 28 | #ifdef RGBW | ||
| 29 | #define LED_TYPE struct cRGBW | ||
| 30 | #else | ||
| 31 | #define LED_TYPE struct cRGB | ||
| 32 | #endif | ||
| 33 | |||
| 34 | |||
| 35 | /* | ||
| 36 | * Structure of the LED array | ||
| 37 | * | ||
| 38 | * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 | ||
| 39 | * cRGBW: RGBW for SK6812RGBW | ||
| 40 | */ | ||
| 41 | |||
| 42 | struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; | ||
| 43 | struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; | ||
| 44 | |||
| 45 | #endif | ||
