aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzvecr <git@zvecr.com>2019-05-12 06:57:51 +0100
committerDrashna Jaelre <drashna@live.com>2019-05-11 22:57:51 -0700
commitb32ad8b90cc3b6e8bdcdfa646c658b9848bde105 (patch)
treed5a90935affd7eea112992ada6f9efe64e721c65
parent831d765b52a7d97ac7294e7c89afc34465a2ec32 (diff)
downloadqmk_firmware-b32ad8b90cc3b6e8bdcdfa646c658b9848bde105.tar.gz
qmk_firmware-b32ad8b90cc3b6e8bdcdfa646c658b9848bde105.zip
[Keyboard] Convert Staryu to use DIRECT_PINS and BACKLIGHT_PINS (#5848)
* Convert to use DIRECT_PINS and BACKLIGHT_PINS * Convert to use DIRECT_PINS and BACKLIGHT_PINS - remove old comment
-rw-r--r--keyboards/staryu/backlight_staryu.h11
-rwxr-xr-xkeyboards/staryu/config.h25
-rwxr-xr-xkeyboards/staryu/staryu.c27
-rwxr-xr-xkeyboards/staryu/staryu.h14
4 files changed, 31 insertions, 46 deletions
diff --git a/keyboards/staryu/backlight_staryu.h b/keyboards/staryu/backlight_staryu.h
index 3272283e9..b90350e28 100644
--- a/keyboards/staryu/backlight_staryu.h
+++ b/keyboards/staryu/backlight_staryu.h
@@ -17,5 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17#pragma once 17#pragma once
18 18
19// Add backwards compatibility for existing keymaps 19// Add backwards compatibility for existing keymaps
20static inline void backlight_set_value(uint8_t index, uint8_t level) {
21 static const uint8_t backlight_pins[BACKLIGHT_LED_COUNT] = BACKLIGHT_PINS;
22 if (level) {
23 setPinOutput(backlight_pins[index]);
24 } else {
25 setPinInput(backlight_pins[index]);
26 }
27}
28
20#define backlight_led_off(i) backlight_set_value(i, 0) 29#define backlight_led_off(i) backlight_set_value(i, 0)
21#define backlight_led_on(i) backlight_set_value(i, 1) \ No newline at end of file 30#define backlight_led_on(i) backlight_set_value(i, 1)
diff --git a/keyboards/staryu/config.h b/keyboards/staryu/config.h
index 7f8b39ba7..05131b68b 100755
--- a/keyboards/staryu/config.h
+++ b/keyboards/staryu/config.h
@@ -27,20 +27,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
27#define DESCRIPTION 5-key macropad 27#define DESCRIPTION 5-key macropad
28 28
29/* key matrix size */ 29/* key matrix size */
30#define MATRIX_ROWS 1 30#define MATRIX_ROWS 2
31#define MATRIX_COLS 5 31#define MATRIX_COLS 3
32 32
33/* key matrix pins */ 33/* key matrix pins */
34#define MATRIX_ROW_PINS { NO_PIN } 34#define DIRECT_PINS { \
35#define MATRIX_COL_PINS { D0, D1, D2, D3, D4 } 35 { NO_PIN, D0, D1 }, \
36 { D4, D3, D2 }, \
37}
36#define UNUSED_PINS 38#define UNUSED_PINS
37 39
38/* COL2ROW or ROW2COL */
39#define DIODE_DIRECTION COL2ROW
40
41#define RGB_DI_PIN C6 40#define RGB_DI_PIN C6
42#define RGBLED_NUM 1 // Number of LEDs 41#define RGBLED_NUM 1 // Number of LEDs
43#define RGBLIGHT_ANIMATIONS 42#define RGBLIGHT_ANIMATIONS
43#define RGBLIGHT_LIMIT_VAL 200
44// #ifdef RGB_DI_PIN 44// #ifdef RGB_DI_PIN
45// #define RGBLIGHT_HUE_STEP 8 45// #define RGBLIGHT_HUE_STEP 8
46// #define RGBLIGHT_SAT_STEP 8 46// #define RGBLIGHT_SAT_STEP 8
@@ -61,8 +61,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
61// #define RGBLIGHT_EFFECT_ALTERNATING 61// #define RGBLIGHT_EFFECT_ALTERNATING
62// #endif 62// #endif
63 63
64#define BACKLIGHT_LEVELS 1 // either on/off 64#undef BACKLIGHT_PIN
65#define RGBLIGHT_LIMIT_VAL 200 65#define BACKLIGHT_PINS { C2, C7, D5, D6, B0 }
66#define BACKLIGHT_LED_COUNT 5
67#define BACKLIGHT_LEVELS 10
68#define BACKLIGHT_ON_STATE 1
66 69
67/* Set 0 if debouncing isn't needed */ 70/* Set 0 if debouncing isn't needed */
68#define DEBOUNCING_DELAY 5 71#define DEBOUNCING_DELAY 5
72
73/* Bootmagic Lite key configuration */
74#define BOOTMAGIC_LITE_ROW 0
75#define BOOTMAGIC_LITE_COLUMN 1
diff --git a/keyboards/staryu/staryu.c b/keyboards/staryu/staryu.c
index 20334c0b7..4adadf201 100755
--- a/keyboards/staryu/staryu.c
+++ b/keyboards/staryu/staryu.c
@@ -15,30 +15,3 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "staryu.h" 17#include "staryu.h"
18
19#ifdef BACKLIGHT_ENABLE
20
21#ifdef BACKLIGHT_PIN
22 #pragma error "BACKLIGHT_PIN must stay undefined otherwise software pwm is incorrectly used"
23#endif
24
25#define BACKLIGHT_PIN_COUNT 5
26static const pin_t backlight_pins[BACKLIGHT_PIN_COUNT] = { C2, C7, D5, D6, B0 };
27
28void backlight_init_ports(void) {
29 for (uint8_t index = 0; index < BACKLIGHT_PIN_COUNT; index++) {
30 setPinOutput(backlight_pins[index]);
31 }
32}
33
34void backlight_set_value(uint8_t index, uint8_t level) {
35 writePin(backlight_pins[index], !!level);
36}
37
38void backlight_set(uint8_t level) {
39 for (uint8_t index = 0; index < BACKLIGHT_PIN_COUNT; index++) {
40 backlight_set_value(index, level);
41 }
42}
43
44#endif //BACKLIGHT_ENABLE
diff --git a/keyboards/staryu/staryu.h b/keyboards/staryu/staryu.h
index f404dff28..bdce5806f 100755
--- a/keyboards/staryu/staryu.h
+++ b/keyboards/staryu/staryu.h
@@ -15,18 +15,14 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#pragma once 17#pragma once
18
18#include "quantum.h" 19#include "quantum.h"
20#define ___ KC_NO
19 21
20#define LAYOUT( \ 22#define LAYOUT( \
21 K00, K01, \ 23 K01, K02, \
22 K10, K11, K12 \ 24 K10, K11, K12 \
23) { \ 25) { \
24 { K00, K01, K12, K11, K10 }, \ 26 { ___, K01, K02 }, \
27 { K10, K11, K12 } \
25} 28}
26
27
28#ifdef BACKLIGHT_ENABLE
29
30void backlight_set_value(uint8_t index, uint8_t level);
31
32#endif