Skip to content

Commit

Permalink
AW20216S: combine EN pin defines (#23067)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored Feb 15, 2024
1 parent 75c6afa commit 0b7df03
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 44 deletions.
14 changes: 8 additions & 6 deletions drivers/led/aw20216s.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ static inline void aw20216s_auto_lowpower(pin_t cs_pin) {
void aw20216s_init_drivers(void) {
spi_init();

aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1);
#if defined(AW20216S_EN_PIN)
setPinOutput(AW20216S_EN_PIN);
writePinHigh(AW20216S_EN_PIN);
#endif

aw20216s_init(AW20216S_CS_PIN_1);
#if defined(AW20216S_CS_PIN_2)
aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2);
aw20216s_init(AW20216S_CS_PIN_2);
#endif
}

void aw20216s_init(pin_t cs_pin, pin_t en_pin) {
setPinOutput(en_pin);
writePinHigh(en_pin);

void aw20216s_init(pin_t cs_pin) {
aw20216s_soft_reset(cs_pin);
wait_ms(2);

Expand Down
8 changes: 4 additions & 4 deletions drivers/led/aw20216s.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
# define AW20216S_CS_PIN_2 DRIVER_2_CS
#endif
#ifdef DRIVER_1_EN
# define AW20216S_EN_PIN_1 DRIVER_1_EN
# define AW20216S_EN_PIN DRIVER_1_EN
#endif
#ifdef DRIVER_2_EN
# define AW20216S_EN_PIN_2 DRIVER_2_EN
#ifdef AW20216S_EN_PIN_1
# define AW20216S_EN_PIN AW20216S_EN_PIN_1
#endif

#define aw_led aw20216s_led_t
Expand Down Expand Up @@ -94,7 +94,7 @@ typedef struct aw20216s_led_t {
extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT];

void aw20216s_init_drivers(void);
void aw20216s_init(pin_t cs_pin, pin_t en_pin);
void aw20216s_init(pin_t cs_pin);
void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void aw20216s_update_pwm_buffers(pin_t cs_pin, uint8_t index);
Expand Down
3 changes: 1 addition & 2 deletions keyboards/darkproject/kd83a_bfg_edition/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
3 changes: 1 addition & 2 deletions keyboards/darkproject/kd87a_bfg_edition/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
3 changes: 1 addition & 2 deletions keyboards/gmmk/gmmk2/p65/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B9
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
3 changes: 1 addition & 2 deletions keyboards/gmmk/gmmk2/p96/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
4 changes: 2 additions & 2 deletions keyboards/gmmk/numpad/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define SPI_MISO_PIN B4

#define AW20216S_CS_PIN_1 B12
#define AW20216S_EN_PIN_1 A15
#define AW20216S_PW_EN_PIN_1 B13
#define AW20216S_EN_PIN A15
#define AW20216S_PW_EN_PIN B13

#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6
4 changes: 2 additions & 2 deletions keyboards/gmmk/numpad/numpad.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ led_config_t g_led_config = {{

void keyboard_pre_init_user(void) {
wait_ms(2000);
setPinOutput(AW20216S_PW_EN_PIN_1);
writePinHigh(AW20216S_PW_EN_PIN_1);
setPinOutput(AW20216S_PW_EN_PIN);
writePinHigh(AW20216S_PW_EN_PIN);
}
# endif

Expand Down
3 changes: 1 addition & 2 deletions keyboards/gmmk/pro/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@

#define AW20216S_CS_PIN_1 B13
#define AW20216S_CS_PIN_2 B14
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
1 change: 1 addition & 0 deletions keyboards/gmmk/pro/rev1/ansi/keymaps/coryginsberg/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define TAPPING_TERM 250
#define RGBLIGHT_DEFAULT_MODE SOLID_WHITE
#define DYNAMIC_KEYMAP_LAYER_COUNT 5
10 changes: 1 addition & 9 deletions keyboards/gmmk/pro/rev1/ansi/keymaps/coryginsberg/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, XXXXXXX, RGB_SAI, XXXXXXX, XXXXXXX, XXXXXXX, RGB_HUI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MODE_REVERSE,
_______, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, RGB_TOG,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK
),
[5] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
)
};

bool encoder_update_user(uint8_t index, bool clockwise) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/gmmk/pro/rev1/ansi/keymaps/hachetman/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ bool rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return;
return false;
} else {
/* EFFECTS duration is finished */
effect_started_time = 0;
Expand Down
4 changes: 2 additions & 2 deletions keyboards/gmmk/pro/rev1/ansi/keymaps/macos/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Since this is, among other things, a "gaming" keyboard, a key combination to enable NKRO on the fly is provided for convenience.
// Press Fn+N to toggle between 6KRO and NKRO. This setting is persisted to the EEPROM and thus persists between restarts.
[0] = LAYOUT(
KC_ESC, KC_BRID, KC_BRIU, KC_MSCTRL, KC_LNPD, RGB_VAD, RGB_VAI, KC_F7, KC_F8, KC_MRWD, KC_MPLY, KC_MFFD, KC_F12, KC_EJCT, KC_MUTE,
KC_ESC, KC_BRID, KC_BRIU, XXXXXXX, XXXXXXX, RGB_VAD, RGB_VAI, KC_F7, KC_F8, KC_MRWD, KC_MPLY, KC_MFFD, KC_F12, KC_EJCT, KC_MUTE,
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,
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_PGUP,
KC_CAPS, 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_PGDN,
Expand Down Expand Up @@ -367,7 +367,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds();
}
return;
return false;
} else {
/* EFFECTS duration is finished */
effect_started_time = 0;
Expand Down
4 changes: 2 additions & 2 deletions keyboards/gmmk/pro/rev1/ansi/keymaps/paddlegame/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_WINLK:
if (record->event.pressed) {
if(!keymap_config.no_gui) {
process_magic(GUI_OFF, record);
keymap_config.no_gui = true;
} else {
process_magic(GUI_ON, record);
keymap_config.no_gui = false;
}
} else unregister_code16(keycode);
break;
Expand Down
3 changes: 1 addition & 2 deletions keyboards/jukaie/jk01/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13
2 changes: 1 addition & 1 deletion keyboards/phentech/rpk_001/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/* RGB Config */
#define AW20216S_CS_PIN_1 B6
#define AW20216S_EN_PIN_1 B7
#define AW20216S_EN_PIN B7

/* SPI Config */
#define SPI_DRIVER SPIDQ
Expand Down
2 changes: 1 addition & 1 deletion keyboards/projectd/65/projectd_65_ansi/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
#define SPI_MISO_PIN A6

#define AW20216S_CS_PIN_1 A15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN C13
3 changes: 1 addition & 2 deletions keyboards/projectd/75/ansi/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@

#define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13
#define AW20216S_EN_PIN_2 C13
#define AW20216S_EN_PIN C13

0 comments on commit 0b7df03

Please sign in to comment.