qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit b32ad8b90cc3b6e8bdcdfa646c658b9848bde105
parent 831d765b52a7d97ac7294e7c89afc34465a2ec32
Author: zvecr <git@zvecr.com>
Date:   Sun, 12 May 2019 06:57:51 +0100

[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

Diffstat:
keyboards/staryu/backlight_staryu.h | 12++++++++++--
keyboards/staryu/config.h | 25++++++++++++++++---------
keyboards/staryu/staryu.c | 27---------------------------
keyboards/staryu/staryu.h | 14+++++---------
4 files changed, 31 insertions(+), 47 deletions(-)

diff --git 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/>. #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) diff --git 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/>. #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 diff --git 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 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 diff --git 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 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