AW20216S: combine EN pin defines (#23067)

This commit is contained in:
Ryan 2024-02-15 18:05:08 +11:00 committed by GitHub
parent 75c6afaa7f
commit 0b7df03ab7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 32 additions and 44 deletions

View file

@ -113,16 +113,18 @@ static inline void aw20216s_auto_lowpower(pin_t cs_pin) {
void aw20216s_init_drivers(void) { void aw20216s_init_drivers(void) {
spi_init(); 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) #if defined(AW20216S_CS_PIN_2)
aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2); aw20216s_init(AW20216S_CS_PIN_2);
#endif #endif
} }
void aw20216s_init(pin_t cs_pin, pin_t en_pin) { void aw20216s_init(pin_t cs_pin) {
setPinOutput(en_pin);
writePinHigh(en_pin);
aw20216s_soft_reset(cs_pin); aw20216s_soft_reset(cs_pin);
wait_ms(2); wait_ms(2);

View file

@ -42,10 +42,10 @@
# define AW20216S_CS_PIN_2 DRIVER_2_CS # define AW20216S_CS_PIN_2 DRIVER_2_CS
#endif #endif
#ifdef DRIVER_1_EN #ifdef DRIVER_1_EN
# define AW20216S_EN_PIN_1 DRIVER_1_EN # define AW20216S_EN_PIN DRIVER_1_EN
#endif #endif
#ifdef DRIVER_2_EN #ifdef AW20216S_EN_PIN_1
# define AW20216S_EN_PIN_2 DRIVER_2_EN # define AW20216S_EN_PIN AW20216S_EN_PIN_1
#endif #endif
#define aw_led aw20216s_led_t #define aw_led aw20216s_led_t
@ -94,7 +94,7 @@ typedef struct aw20216s_led_t {
extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT]; extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT];
void aw20216s_init_drivers(void); 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(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_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void aw20216s_update_pwm_buffers(pin_t cs_pin, uint8_t index); void aw20216s_update_pwm_buffers(pin_t cs_pin, uint8_t index);

View file

@ -32,5 +32,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15 #define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -32,5 +32,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15 #define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -29,5 +29,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B9 #define AW20216S_CS_PIN_2 B9
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -32,5 +32,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15 #define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -29,7 +29,7 @@
#define SPI_MISO_PIN B4 #define SPI_MISO_PIN B4
#define AW20216S_CS_PIN_1 B12 #define AW20216S_CS_PIN_1 B12
#define AW20216S_EN_PIN_1 A15 #define AW20216S_EN_PIN A15
#define AW20216S_PW_EN_PIN_1 B13 #define AW20216S_PW_EN_PIN B13
#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6 #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B6

View file

@ -111,8 +111,8 @@ led_config_t g_led_config = {{
void keyboard_pre_init_user(void) { void keyboard_pre_init_user(void) {
wait_ms(2000); wait_ms(2000);
setPinOutput(AW20216S_PW_EN_PIN_1); setPinOutput(AW20216S_PW_EN_PIN);
writePinHigh(AW20216S_PW_EN_PIN_1); writePinHigh(AW20216S_PW_EN_PIN);
} }
# endif # endif

View file

@ -28,5 +28,4 @@
#define AW20216S_CS_PIN_1 B13 #define AW20216S_CS_PIN_1 B13
#define AW20216S_CS_PIN_2 B14 #define AW20216S_CS_PIN_2 B14
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -22,3 +22,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TAPPING_TERM 250 #define TAPPING_TERM 250
#define RGBLIGHT_DEFAULT_MODE SOLID_WHITE #define RGBLIGHT_DEFAULT_MODE SOLID_WHITE
#define DYNAMIC_KEYMAP_LAYER_COUNT 5

View file

@ -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, 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, 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 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) { bool encoder_update_user(uint8_t index, bool clockwise) {

View file

@ -234,7 +234,7 @@ bool rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) { if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds(); set_rgb_caps_leds();
} }
return; return false;
} else { } else {
/* EFFECTS duration is finished */ /* EFFECTS duration is finished */
effect_started_time = 0; effect_started_time = 0;

View file

@ -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. // 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. // Press Fn+N to toggle between 6KRO and NKRO. This setting is persisted to the EEPROM and thus persists between restarts.
[0] = LAYOUT( [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_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_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, 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,
@ -367,7 +367,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
if (host_keyboard_led_state().caps_lock) { if (host_keyboard_led_state().caps_lock) {
set_rgb_caps_leds(); set_rgb_caps_leds();
} }
return; return false;
} else { } else {
/* EFFECTS duration is finished */ /* EFFECTS duration is finished */
effect_started_time = 0; effect_started_time = 0;

View file

@ -46,9 +46,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_WINLK: case KC_WINLK:
if (record->event.pressed) { if (record->event.pressed) {
if(!keymap_config.no_gui) { if(!keymap_config.no_gui) {
process_magic(GUI_OFF, record); keymap_config.no_gui = true;
} else { } else {
process_magic(GUI_ON, record); keymap_config.no_gui = false;
} }
} else unregister_code16(keycode); } else unregister_code16(keycode);
break; break;

View file

@ -32,5 +32,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15 #define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13

View file

@ -5,7 +5,7 @@
/* RGB Config */ /* RGB Config */
#define AW20216S_CS_PIN_1 B6 #define AW20216S_CS_PIN_1 B6
#define AW20216S_EN_PIN_1 B7 #define AW20216S_EN_PIN B7
/* SPI Config */ /* SPI Config */
#define SPI_DRIVER SPIDQ #define SPI_DRIVER SPIDQ

View file

@ -31,4 +31,4 @@
#define SPI_MISO_PIN A6 #define SPI_MISO_PIN A6
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13

View file

@ -32,5 +32,4 @@
#define AW20216S_CS_PIN_1 A15 #define AW20216S_CS_PIN_1 A15
#define AW20216S_CS_PIN_2 B15 #define AW20216S_CS_PIN_2 B15
#define AW20216S_EN_PIN_1 C13 #define AW20216S_EN_PIN C13
#define AW20216S_EN_PIN_2 C13