aboutsummaryrefslogtreecommitdiff
path: root/keyboards/winkeyless/bface/bface.c
diff options
context:
space:
mode:
authormechmerlin <mechmerlin@gmail.com>2019-07-14 18:11:16 -0700
committermechmerlin <mechmerlin@gmail.com>2019-07-14 18:11:16 -0700
commit77a7e3c91fa97b7e9263b0b8db75721e150ea3e9 (patch)
tree7e1af200a5661c8b9d8cb075545d32ddf7f97138 /keyboards/winkeyless/bface/bface.c
parentb8c5efa555eb680ad2bf6a7f9a12d0b4ccab0d15 (diff)
downloadqmk_firmware-77a7e3c91fa97b7e9263b0b8db75721e150ea3e9.tar.gz
qmk_firmware-77a7e3c91fa97b7e9263b0b8db75721e150ea3e9.zip
remove custom i2c and led driver
Diffstat (limited to 'keyboards/winkeyless/bface/bface.c')
-rw-r--r--keyboards/winkeyless/bface/bface.c94
1 files changed, 68 insertions, 26 deletions
diff --git a/keyboards/winkeyless/bface/bface.c b/keyboards/winkeyless/bface/bface.c
index 8422a4a40..1c83be4b8 100644
--- a/keyboards/winkeyless/bface/bface.c
+++ b/keyboards/winkeyless/bface/bface.c
@@ -1,30 +1,23 @@
1/* 1/* Copyright 2019 MechMerlin
2Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> 2 *
3Copyright 2018 Sebastian Kaim <sebb@sebb767.de> 3 * This program is free software: you can redistribute it and/or modify
4 4 * it under the terms of the GNU General Public License as published by
5This program is free software: you can redistribute it and/or modify 5 * the Free Software Foundation, either version 2 of the License, or
6it under the terms of the GNU General Public License as published by 6 * (at your option) any later version.
7the Free Software Foundation, either version 2 of the License, or 7 *
8(at your option) any later version. 8 * This program is distributed in the hope that it will be useful,
9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10This program is distributed in the hope that it will be useful, 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * GNU General Public License for more details.
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 *
13GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License
14 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15You should have received a copy of the GNU General Public License 15 */
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#include "bface.h"
20#include "rgblight.h" 16#include "rgblight.h"
21 17#include "i2c_master.h"
22#include <avr/pgmspace.h>
23
24#include "action_layer.h"
25#include "i2c.h"
26#include "quantum.h" 18#include "quantum.h"
27 19
20#ifdef RGBLIGHT_ENABLE
28extern rgblight_config_t rgblight_config; 21extern rgblight_config_t rgblight_config;
29 22
30void rgblight_set(void) { 23void rgblight_set(void) {
@@ -37,10 +30,59 @@ void rgblight_set(void) {
37 } 30 }
38 31
39 i2c_init(); 32 i2c_init();
40 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); 33 i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
34}
35#endif
36
37void matrix_init_kb(void) {
38#ifdef RGBLIGHT_ENABLE
39 if (rgblight_config.enable) {
40 i2c_init();
41 i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
42 }
43#endif
44 // call user level keymaps, if any
45 matrix_init_user();
46}
47
48void matrix_scan_kb(void) {
49#ifdef RGBLIGHT_ENABLE
50 rgblight_task();
51#endif
52 matrix_scan_user();
53 /* Nothing else for now. */
41} 54}
42 55
43__attribute__ ((weak)) 56__attribute__ ((weak))
44void matrix_scan_user(void) { 57void matrix_scan_user(void) {
45 rgblight_task(); 58}
59
60void backlight_init_ports(void) {
61 // initialize pins D0, D1, D4 and D6 as output
62 setPinOutput(D0);
63 setPinOutput(D1);
64 setPinOutput(D4);
65 setPinOutput(D6);
66
67 // turn backlight LEDs on
68 writePinHigh(D0);
69 writePinHigh(D1);
70 writePinHigh(D4);
71 writePinHigh(D6);
72}
73
74void backlight_set(uint8_t level) {
75 if (level == 0) {
76 // turn backlight LEDs off
77 writePinLow(D0);
78 writePinLow(D1);
79 writePinLow(D4);
80 writePinLow(D6);
81 } else {
82 // turn backlight LEDs on
83 writePinHigh(D0);
84 writePinHigh(D1);
85 writePinHigh(D4);
86 writePinHigh(D6);
87 }
46} 88}