]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
[Keyboard] Convert Staryu to use DIRECT_PINS and BACKLIGHT_PINS (#5848)
authorzvecr <git@zvecr.com>
Sun, 12 May 2019 05:57:51 +0000 (06:57 +0100)
committerDrashna Jaelre <drashna@live.com>
Sun, 12 May 2019 05:57:51 +0000 (22:57 -0700)
* Convert to use DIRECT_PINS and BACKLIGHT_PINS

* Convert to use DIRECT_PINS and BACKLIGHT_PINS - remove old comment

keyboards/staryu/backlight_staryu.h
keyboards/staryu/config.h
keyboards/staryu/staryu.c
keyboards/staryu/staryu.h

index 3272283e99e83c348598c4b1da8a7de4e8c87d73..b90350e28ba5458e75d3c6e730cc44a8ab446e23 100644 (file)
@@ -17,5 +17,14 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #pragma once
 
 // Add backwards compatibility for existing keymaps
+static inline void backlight_set_value(uint8_t index, uint8_t level) {
+  static const uint8_t backlight_pins[BACKLIGHT_LED_COUNT] = BACKLIGHT_PINS;
+  if (level) {
+      setPinOutput(backlight_pins[index]);
+  } else {
+      setPinInput(backlight_pins[index]);
+  }
+}
+
 #define backlight_led_off(i) backlight_set_value(i, 0)
-#define backlight_led_on(i) backlight_set_value(i, 1)
\ No newline at end of file
+#define backlight_led_on(i) backlight_set_value(i, 1)
index 7f8b39ba7b60ce95b4cd92f131d7378a5b4cf7f5..05131b68b58763434221aad1e0d2f2ff8af0cd6c 100755 (executable)
@@ -27,20 +27,20 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define DESCRIPTION     5-key macropad
 
 /* key matrix size */
-#define MATRIX_ROWS 1
-#define MATRIX_COLS 5
+#define MATRIX_ROWS 2
+#define MATRIX_COLS 3
 
 /* key matrix pins */
-#define MATRIX_ROW_PINS { NO_PIN }
-#define MATRIX_COL_PINS { D0, D1, D2, D3, D4 }
+#define DIRECT_PINS { \
+    { NO_PIN, D0,     D1 }, \
+    { D4,     D3,     D2 }, \
+}
 #define UNUSED_PINS
 
-/* COL2ROW or ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
 #define RGB_DI_PIN C6
 #define RGBLED_NUM 1     // Number of LEDs
 #define RGBLIGHT_ANIMATIONS
+#define RGBLIGHT_LIMIT_VAL 200
 // #ifdef RGB_DI_PIN
 //   #define RGBLIGHT_HUE_STEP 8
 //   #define RGBLIGHT_SAT_STEP 8
@@ -61,8 +61,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //   #define RGBLIGHT_EFFECT_ALTERNATING
 // #endif
 
-#define BACKLIGHT_LEVELS 1 // either on/off
-#define RGBLIGHT_LIMIT_VAL 200
+#undef BACKLIGHT_PIN
+#define BACKLIGHT_PINS { C2, C7, D5, D6, B0 }
+#define BACKLIGHT_LED_COUNT 5
+#define BACKLIGHT_LEVELS 10
+#define BACKLIGHT_ON_STATE 1
 
 /* Set 0 if debouncing isn't needed */
 #define DEBOUNCING_DELAY 5
+
+/* Bootmagic Lite key configuration */
+#define BOOTMAGIC_LITE_ROW 0
+#define BOOTMAGIC_LITE_COLUMN 1
index 20334c0b78131a8f764820c6d8031cc1ab91f2e6..4adadf20156617b3e115f2270c6e20dbc57192d2 100755 (executable)
@@ -15,30 +15,3 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "staryu.h"
-
-#ifdef BACKLIGHT_ENABLE
-
-#ifdef BACKLIGHT_PIN
-  #pragma error "BACKLIGHT_PIN must stay undefined otherwise software pwm is incorrectly used"
-#endif
-
-#define BACKLIGHT_PIN_COUNT 5
-static const pin_t backlight_pins[BACKLIGHT_PIN_COUNT] = { C2, C7, D5, D6, B0 };
-
-void backlight_init_ports(void) {
-  for (uint8_t index = 0; index < BACKLIGHT_PIN_COUNT; index++) {
-    setPinOutput(backlight_pins[index]);
-  }
-}
-
-void backlight_set_value(uint8_t index, uint8_t level) {
-  writePin(backlight_pins[index], !!level);
-}
-
-void backlight_set(uint8_t level) {
-  for (uint8_t index = 0; index < BACKLIGHT_PIN_COUNT; index++) {
-    backlight_set_value(index, level);
-  }
-}
-
-#endif //BACKLIGHT_ENABLE
index f404dff284e93fb9224c8072481ca184db491cf4..bdce5806f730519ccbff668bc615372410e0ed32 100755 (executable)
@@ -15,18 +15,14 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #pragma once
+
 #include "quantum.h"
+#define ___ KC_NO
 
 #define LAYOUT( \
-            K00, K01, \
+            K01, K02, \
        K10, K11, K12  \
 ) { \
-       { K00, K01, K12, K11, K10 }, \
+       { ___, K01, K02 }, \
+       { K10, K11, K12 }  \
 }
-
-
-#ifdef BACKLIGHT_ENABLE
-
-void backlight_set_value(uint8_t index, uint8_t level);
-
-#endif