diff --git a/docs/drivers/sn32f2xx.md b/docs/drivers/sn32f2xx.md index 4742ae7d1dac..6985e99222d9 100644 --- a/docs/drivers/sn32f2xx.md +++ b/docs/drivers/sn32f2xx.md @@ -61,20 +61,20 @@ You can then call the SN32F2XX API by including `sn32f2xx.h` in your code. Add the following to your `config.h`: -|Define |Default |Description | -|-------------------------------|------------------------------|----------------------------------------------------------------------------------------------------| -|`SN32_RGB_MATRIX_ROW_PINS` |*Not defined* |The GPIO pins connected to the RGB sink triplets on every row of the LEDs in the matrix1 | -|`SN32_RGB_MATRIX_COL_PINS` |`MATRIX_COL_PINS` |The GPIO pins connected to the LED columns on every column of the LEDs in the matrix2 | -|`SN32_RGB_MATRIX_COLS` |`MATRIX_COLS` |Number of LED columns in the LED matrix | -|`SN32_RGB_MATRIX_ROWS` |`MATRIX_ROWS` |Number of LED rows in the LED matrix | -|`SN32_RGB_MATRIX_ROW_CHANNELS` |`3` |The number of available color channels for each LED | -|`SN32_PWM_OUTPUT_ACTIVE_LEVEL` |`SN32_PWM_OUTPUT_ACTIVE_LOW` |The logic level that enables PWM output. Depends on transistor controlling PWM | -|`SN32_RGB_OUTPUT_ACTIVE_LEVEL` |`SN32_RGB_OUTPUT_ACTIVE_HIGH` |The logic level that enables RGB output. Depends on transistor controlling RGB sinks | -|`SN32_PWM_DIRECTION` |`DIODE_DIRECTION` |The scanning logic direction for the LED matrix | -|`SN32_PWM_CONTROL` |`HARDWARE_PWM` |Toggles hardware or software control for the PWM | -|`SN32_LED_OUTPUT_LUMINOSITY_R` |`1` |Luminosity correction factor for the Red channel | -|`SN32_LED_OUTPUT_LUMINOSITY_G` |`1` |Luminosity correction factor for the Green channel | -|`SN32_LED_OUTPUT_LUMINOSITY_B` |`1` |Luminosity correction factor for the Blue channel | +|Define |Default |Description | +|-----------------------------------|----------------------------------|----------------------------------------------------------------------------------------------------| +|`SN32F2XX_RGB_MATRIX_ROW_PINS` |*Not defined* |The GPIO pins connected to the RGB sink triplets on every row of the LEDs in the matrix1 | +|`SN32F2XX_RGB_MATRIX_COL_PINS` |`MATRIX_COL_PINS` |The GPIO pins connected to the LED columns on every column of the LEDs in the matrix2 | +|`SN32F2XX_RGB_MATRIX_COLS` |`MATRIX_COLS` |Number of LED columns in the LED matrix | +|`SN32F2XX_RGB_MATRIX_ROWS` |`MATRIX_ROWS` |Number of LED rows in the LED matrix | +|`SN32F2XX_RGB_MATRIX_ROW_CHANNELS` |`3` |The number of available color channels for each LED | +|`SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL` |`SN32F2XX_PWM_OUTPUT_ACTIVE_LOW` |The logic level that enables PWM output. Depends on transistor controlling PWM | +|`SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL` |`SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH` |The logic level that enables RGB output. Depends on transistor controlling RGB sinks | +|`SN32F2XX_PWM_DIRECTION` |`DIODE_DIRECTION` |The scanning logic direction for the LED matrix | +|`SN32F2XX_PWM_CONTROL` |`HARDWARE_PWM` |Toggles hardware or software control for the PWM | +|`SN32F2XX_LED_OUTPUT_LUMINOSITY_R` |`1` |Luminosity correction factor for the Red channel | +|`SN32F2XX_LED_OUTPUT_LUMINOSITY_G` |`1` |Luminosity correction factor for the Green channel | +|`SN32F2XX_LED_OUTPUT_LUMINOSITY_B` |`1` |Luminosity correction factor for the Blue channel | Notes: diff --git a/drivers/led/sn32f2xx.c b/drivers/led/sn32f2xx.c index 9c7231913f6c..b58589d36b2c 100644 --- a/drivers/led/sn32f2xx.c +++ b/drivers/led/sn32f2xx.c @@ -25,11 +25,11 @@ # define MATRIX_IO_DELAY 30 #endif -#define SN32_PWM_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH -#define SN32_PWM_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW +#define SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW -#define SN32_RGB_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW +#define SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LOW PWM_OUTPUT_ACTIVE_LOW #define HARDWARE_PWM 0 #define SOFTWARE_PWM 1 @@ -68,36 +68,36 @@ (B) (E) GPIO GND */ -#if (SN32_PWM_DIRECTION == COL2ROW) -static uint8_t chan_col_order[SN32_RGB_MATRIX_COLS] = {0}; // track the channel col order -static uint8_t current_row = 0; // LED row scan counter -static uint8_t current_key_row = 0; // key row scan counter -# if (SN32_PWM_CONTROL == SOFTWARE_PWM) -static uint8_t led_duty_cycle[SN32_RGB_MATRIX_COLS] = {0}; // track the channel duty cycle +#if (SN32F2XX_PWM_DIRECTION == COL2ROW) +static uint8_t chan_col_order[SN32F2XX_RGB_MATRIX_COLS] = {0}; // track the channel col order +static uint8_t current_row = 0; // LED row scan counter +static uint8_t current_key_row = 0; // key row scan counter +# if (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) +static uint8_t led_duty_cycle[SN32F2XX_RGB_MATRIX_COLS] = {0}; // track the channel duty cycle # endif -#elif (SN32_PWM_DIRECTION == ROW2COL) +#elif (SN32F2XX_PWM_DIRECTION == ROW2COL) /* make sure to `#define MATRIX_UNSELECT_DRIVE_HIGH` in this configuration*/ -static uint8_t chan_row_order[SN32_RGB_MATRIX_ROWS_HW] = {0}; // track the channel row order -static uint8_t current_key_col = 0; // key col scan counter -static uint8_t last_key_col = 0; // key col scan counter -# if (SN32_PWM_CONTROL == SOFTWARE_PWM) -static uint8_t led_duty_cycle[SN32_RGB_MATRIX_ROWS_HW] = {0}; // track the channel duty cycle +static uint8_t chan_row_order[SN32F2XX_RGB_MATRIX_ROWS_HW] = {0}; // track the channel row order +static uint8_t current_key_col = 0; // key col scan counter +static uint8_t last_key_col = 0; // key col scan counter +# if (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) +static uint8_t led_duty_cycle[SN32F2XX_RGB_MATRIX_ROWS_HW] = {0}; // track the channel duty cycle # endif #endif #if (DIODE_DIRECTION == ROW2COL) static matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; #endif #if defined(SHARED_MATRIX) -extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values -extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values -static matrix_row_t shared_matrix[MATRIX_ROWS]; // scan values -static volatile bool matrix_locked = false; // matrix update check -static volatile bool matrix_scanned = false; +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +static matrix_row_t shared_matrix[MATRIX_ROWS]; // scan values +static volatile bool matrix_locked = false; // matrix update check +static volatile bool matrix_scanned = false; #endif // SHARED MATRIX -static const uint32_t periodticks = RGB_MATRIX_MAXIMUM_BRIGHTNESS; -static const uint32_t freq = (RGB_MATRIX_HUE_STEP * RGB_MATRIX_SAT_STEP * RGB_MATRIX_VAL_STEP * RGB_MATRIX_SPD_STEP * RGB_MATRIX_LED_PROCESS_LIMIT); -static const pin_t led_row_pins[SN32_RGB_MATRIX_ROWS_HW] = SN32_RGB_MATRIX_ROW_PINS; // We expect a R,B,G order here -static const pin_t led_col_pins[SN32_RGB_MATRIX_COLS] = SN32_RGB_MATRIX_COL_PINS; +static const uint32_t periodticks = RGB_MATRIX_MAXIMUM_BRIGHTNESS; +static const uint32_t freq = (RGB_MATRIX_HUE_STEP * RGB_MATRIX_SAT_STEP * RGB_MATRIX_VAL_STEP * RGB_MATRIX_SPD_STEP * RGB_MATRIX_LED_PROCESS_LIMIT); +static const pin_t led_row_pins[SN32F2XX_RGB_MATRIX_ROWS_HW] = SN32F2XX_RGB_MATRIX_ROW_PINS; // We expect a R,B,G order here +static const pin_t led_col_pins[SN32F2XX_RGB_MATRIX_COLS] = SN32F2XX_RGB_MATRIX_COL_PINS; static RGB led_state[SN32F2XX_LED_COUNT]; // led state buffer static RGB led_state_buf[SN32F2XX_LED_COUNT]; // led state buffer bool led_state_buf_update_required = false; @@ -119,31 +119,31 @@ bool matrix_can_read(void) { static void rgb_callback(PWMDriver *pwmp); #if !defined(SN32F2) -#error Driver is MCU specific to the Sonix SN32F2 family. +# error Driver is MCU specific to the Sonix SN32F2 family. #endif // !defined(SN32F2) #if defined(SN32F240B) /* PWM configuration structure. We use timer CT16B1 with 24 channels. */ static PWMConfig pwmcfg = { freq, /* PWM clock frequency. */ - periodticks, /* PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */ + periodticks, /* PWM period = periodticks * (1 / CH_CFG_ST_FREQUENCY) ≈ 255 * (1 / 187500) ≈ 1.36 ms */ NULL, /* RGB Callback */ { /* Default all channels to disabled - Channels will be configured during init */ - [0 ... PWM_CHANNELS-1] = {PWM_OUTPUT_DISABLED, NULL, 0}, + [0 ... PWM_CHANNELS - 1] = {PWM_OUTPUT_DISABLED, NULL, 0}, }, 0 /* HW dependent part.*/ }; static void rgb_ch_ctrl(PWMConfig *cfg) { /* Enable PWM function, IOs and select the PWM modes for the LED pins */ -#if (SN32_PWM_DIRECTION == COL2ROW) - for (uint8_t i = 0; i < SN32_RGB_MATRIX_COLS; i++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) +# if (SN32F2XX_PWM_DIRECTION == COL2ROW) + for (uint8_t i = 0; i < SN32F2XX_RGB_MATRIX_COLS; i++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) // Only P0.0 to P2.15 can be used as pwm output if (led_col_pins[i] > C15) continue; -# endif // SN32_PWM_CONTROL - /* We use a tricky here, accordint to pfpa table of sn32f240b datasheet, +# endif // SN32F2XX_PWM_CONTROL + /* We use a trick here, according to pfpa table of sn32f240b datasheet, pwm channel and pfpa of pin Px.y can be calculated as below: channel = (x*16+y)%24 pfpa = 1, when (x*16+y)>23 @@ -151,13 +151,13 @@ static void rgb_ch_ctrl(PWMConfig *cfg) { uint8_t pio_value = ((uint32_t)(PAL_PORT(led_col_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_col_pins[i]); uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_col_order[i] = ch_idx; -#elif (SN32_PWM_DIRECTION == ROW2COL) - for (uint8_t i = 0; i < SN32_RGB_MATRIX_ROWS_HW; i++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) +# elif (SN32F2XX_PWM_DIRECTION == ROW2COL) + for (uint8_t i = 0; i < SN32F2XX_RGB_MATRIX_ROWS_HW; i++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) // Only P0.0 to P2.15 can be used as pwm output if (led_row_pins[i] > C15) continue; -# endif // SN32_PWM_CONTROL - /* We use a tricky here, accordint to pfpa table of sn32f240b datasheet, +# endif // SN32F2XX_PWM_CONTROL + /* We use a trick here, according to pfpa table of sn32f240b datasheet, pwm channel and pfpa of pin Px.y can be calculated as below: channel = (x*16+y)%24 pfpa = 1, when (x*16+y)>23 @@ -165,11 +165,11 @@ static void rgb_ch_ctrl(PWMConfig *cfg) { uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(B0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_row_pins[i]); uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_row_order[i] = ch_idx; -#endif // SN32_PWM_DIRECTION -#if (SN32_PWM_CONTROL == HARDWARE_PWM) - cfg->channels[ch_idx].pfpamsk = pio_value > (PWM_CHANNELS -1); - cfg->channels[ch_idx].mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL; -#endif // SN32_PWM_CONTROL +# endif // SN32F2XX_PWM_DIRECTION +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) + cfg->channels[ch_idx].pfpamsk = pio_value > (PWM_CHANNELS - 1); + cfg->channels[ch_idx].mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL; +# endif // SN32F2XX_PWM_CONTROL } } #elif defined(SN32F260) @@ -179,122 +179,122 @@ static const PWMConfig pwmcfg = { periodticks, /* PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */ rgb_callback, /* led Callback */ .channels = - { - /* Default all channels to disabled */ - [0 ... PWM_CHANNELS-1] = {.mode = PWM_OUTPUT_DISABLED}, - /* Enable selected channels */ -# if defined(SN32_ACTIVATE_PWM_CHAN_0) - [0] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_0 -# if defined(SN32_ACTIVATE_PWM_CHAN_1) - [1] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_1 -# if defined(SN32_ACTIVATE_PWM_CHAN_2) - [2] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_2 -# if defined(SN32_ACTIVATE_PWM_CHAN_3) - [3] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_3 -# if defined(SN32_ACTIVATE_PWM_CHAN_4) - [4] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_4 -# if defined(SN32_ACTIVATE_PWM_CHAN_5) - [5] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_5 -# if defined(SN32_ACTIVATE_PWM_CHAN_6) - [6] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_6 -# if defined(SN32_ACTIVATE_PWM_CHAN_7) - [7] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_7 -# if defined(SN32_ACTIVATE_PWM_CHAN_8) - [8] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_8 -# if defined(SN32_ACTIVATE_PWM_CHAN_9) - [9] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_9 -# if defined(SN32_ACTIVATE_PWM_CHAN_10) - [10] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_10 -# if defined(SN32_ACTIVATE_PWM_CHAN_11) - [11] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_11 -# if defined(SN32_ACTIVATE_PWM_CHAN_12) - [12] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_12 -# if defined(SN32_ACTIVATE_PWM_CHAN_13) - [13] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_13 -# if defined(SN32_ACTIVATE_PWM_CHAN_14) - [14] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_14 -# if defined(SN32_ACTIVATE_PWM_CHAN_15) - [15] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_15 -# if defined(SN32_ACTIVATE_PWM_CHAN_16) - [16] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_16 -# if defined(SN32_ACTIVATE_PWM_CHAN_17) - [17] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_17 -# if defined(SN32_ACTIVATE_PWM_CHAN_18) - [18] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_18 -# if defined(SN32_ACTIVATE_PWM_CHAN_19) - [19] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_19 -# if defined(SN32_ACTIVATE_PWM_CHAN_20) - [20] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_20 -# if defined(SN32_ACTIVATE_PWM_CHAN_21) - [21] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_21 -# if defined(SN32_ACTIVATE_PWM_CHAN_22) - [22] = {.mode = SN32_PWM_OUTPUT_ACTIVE_LEVEL}, -# endif // SN32_ACTIVATE_PWM_CHAN_22 + { + /* Default all channels to disabled */ + [0 ... PWM_CHANNELS - 1] = {.mode = PWM_OUTPUT_DISABLED}, +/* Enable selected channels */ +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_0) + [0] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_0 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_1) + [1] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_1 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_2) + [2] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_2 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_3) + [3] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_3 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_4) + [4] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_4 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_5) + [5] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_5 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_6) + [6] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_6 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_7) + [7] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_7 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_8) + [8] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_8 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_9) + [9] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_9 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_10) + [10] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_10 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_11) + [11] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_11 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_12) + [12] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_12 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_13) + [13] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_13 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_14) + [14] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_14 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_15) + [15] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_15 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_16) + [16] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_16 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_17) + [17] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_17 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_18) + [18] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_18 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_19) + [19] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_19 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_20) + [20] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_20 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_21) + [21] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_21 +# if defined(SN32F2XX_ACTIVATE_PWM_CHAN_22) + [22] = {.mode = SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL}, +# endif // SN32F2XX_ACTIVATE_PWM_CHAN_22 }, 0 /* HW dependent part.*/ }; static void rgb_ch_ctrl(void) { /* Enable PWM function, IOs and select the PWM modes for the LED pins */ -#if (SN32_PWM_DIRECTION == COL2ROW) - for (uint8_t i = 0; i < SN32_RGB_MATRIX_COLS; i++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) +# if (SN32F2XX_PWM_DIRECTION == COL2ROW) + for (uint8_t i = 0; i < SN32F2XX_RGB_MATRIX_COLS; i++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) // Only P0.0 to P0.15 and P3.0 to P3.8 can be used as pwm output if (led_col_pins[i] > A15 && led_col_pins[i] < D0) continue; -# endif // SN32_PWM_CONTROL - /* We use a tricky here, accordint to pfpa table of sn32f260 datasheet, +# endif // SN32F2XX_PWM_CONTROL + /* We use a trick here, according to pfpa table of sn32f260 datasheet, pwm channel and pfpa of pin Px.y can be calculated as below: channel = (x*16+y)%23 */ uint8_t pio_value = ((uint32_t)(PAL_PORT(led_col_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(D0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_col_pins[i]); uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_col_order[i] = ch_idx; -#elif (SN32_PWM_DIRECTION == ROW2COL) - for (uint8_t i = 0; i < SN32_RGB_MATRIX_ROWS_HW; i++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) +# elif (SN32F2XX_PWM_DIRECTION == ROW2COL) + for (uint8_t i = 0; i < SN32F2XX_RGB_MATRIX_ROWS_HW; i++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) // Only P0.0 to P0.15 and P3.0 to P3.8 can be used as pwm output if (led_row_pins[i] > A15 && led_row_pins[i] < D0) continue; -# endif // SN32_PWM_CONTROL - /* We use a tricky here, accordint to pfpa table of sn32f260 datasheet, +# endif // SN32F2XX_PWM_CONTROL + /* We use a trick here, according to pfpa table of sn32f260 datasheet, pwm channel and pfpa of pin Px.y can be calculated as below: channel = (x*16+y)%23 */ uint8_t pio_value = ((uint32_t)(PAL_PORT(led_row_pins[i])) - (uint32_t)(PAL_PORT(A0))) / ((uint32_t)(PAL_PORT(D0)) - (uint32_t)(PAL_PORT(A0))) * PAL_IOPORTS_WIDTH + PAL_PAD(led_row_pins[i]); uint8_t ch_idx = pio_value % PWM_CHANNELS; chan_row_order[i] = ch_idx; -#endif // SN32_PWM_DIRECTION +# endif // SN32F2XX_PWM_DIRECTION } } #else -# error Unsupported MCU. Driver instance cant be configured. +# error Unsupported MCU. Driver instance cant be configured. #endif // chip selection static void shared_matrix_rgb_enable(void) { -# if !defined(SN32F260) +#if !defined(SN32F260) pwmcfg.callback = rgb_callback; -# endif // SN32F260 needs static allocation +#endif // SN32F260 needs static allocation pwmEnablePeriodicNotification(&PWMD1); } @@ -312,51 +312,51 @@ static void shared_matrix_scan_keys(matrix_row_t current_matrix[], uint8_t curre } } if (matrix_locked) { -#if (DIODE_DIRECTION == COL2ROW) -# if (SN32_PWM_DIRECTION == DIODE_DIRECTION) +# if (DIODE_DIRECTION == COL2ROW) +# if (SN32F2XX_PWM_DIRECTION == DIODE_DIRECTION) matrix_read_cols_on_row(current_matrix, current_key); -# else +# else // For each row... for (uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) { matrix_read_cols_on_row(current_matrix, row_index); } -# endif // DIODE_DIRECTION == SN32_PWM_DIRECTION -#elif (DIODE_DIRECTION == ROW2COL) -# if (SN32_PWM_DIRECTION == DIODE_DIRECTION) +# endif // DIODE_DIRECTION == SN32F2XX_PWM_DIRECTION +# elif (DIODE_DIRECTION == ROW2COL) +# if (SN32F2XX_PWM_DIRECTION == DIODE_DIRECTION) matrix_read_rows_on_col(current_matrix, current_key, row_shifter); -# else +# else // For each col... matrix_row_t row_shifter = MATRIX_ROW_SHIFTER; for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++, row_shifter <<= 1) { matrix_read_rows_on_col(current_matrix, current_key, row_shifter); } -# endif // SN32_PWM_DIRECTION -#endif // DIODE_DIRECTION +# endif // SN32F2XX_PWM_DIRECTION +# endif // DIODE_DIRECTION matrix_scanned = true; } } } #endif // SHARED_MATRIX -#if (SN32_PWM_DIRECTION == COL2ROW) +#if (SN32F2XX_PWM_DIRECTION == COL2ROW) static void shared_matrix_rgb_disable_output(void) { // Disable PWM outputs on column pins - for (uint8_t y = 0; y < SN32_RGB_MATRIX_COLS; y++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) + for (uint8_t y = 0; y < SN32F2XX_RGB_MATRIX_COLS; y++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) pwmDisableChannel(&PWMD1, chan_col_order[y]); -# elif (SN32_PWM_CONTROL == SOFTWARE_PWM) +# elif (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) gpio_set_pin_input(led_col_pins[y]); -# endif // SN32_PWM_CONTROL +# endif // SN32F2XX_PWM_CONTROL } // Disable LED outputs on RGB channel pins - for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) + for (uint8_t x = 0; x < SN32F2XX_RGB_MATRIX_ROWS_HW; x++) { +# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_low(led_row_pins[x]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_high(led_row_pins[x]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL } } @@ -364,38 +364,38 @@ static void update_pwm_channels(PWMDriver *pwmp) { // Advance to the next LED RGB channels current_row++; /* Check if counter has wrapped around, reset before the next pass */ - if (current_row == SN32_RGB_MATRIX_ROWS_HW) current_row = 0; -# if defined(SHARED_MATRIX) + if (current_row == SN32F2XX_RGB_MATRIX_ROWS_HW) current_row = 0; +# if defined(SHARED_MATRIX) uint8_t last_key_row = current_key_row; -# endif // SHARED_MATRIX +# endif // SHARED_MATRIX // Advance to the next key matrix row -# if (SN32_PWM_CONTROL == HARDWARE_PWM) - if (current_row % SN32_RGB_MATRIX_ROW_CHANNELS == 2) current_key_row++; -# elif (SN32_PWM_CONTROL == SOFTWARE_PWM) - if (current_row % SN32_RGB_MATRIX_ROW_CHANNELS == 0) current_key_row++; -# endif // SN32_PWM_CONTROL +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) + if (current_row % SN32F2XX_RGB_MATRIX_ROW_CHANNELS == 2) current_key_row++; +# elif (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) + if (current_row % SN32F2XX_RGB_MATRIX_ROW_CHANNELS == 0) current_key_row++; +# endif // SN32F2XX_PWM_CONTROL /* Check if counter has wrapped around, reset before the next pass */ - if (current_key_row == SN32_RGB_MATRIX_ROWS) current_key_row = 0; + if (current_key_row == SN32F2XX_RGB_MATRIX_ROWS) current_key_row = 0; // Disable LED output before scanning the key matrix if (current_key_row < ROWS_PER_HAND) { shared_matrix_rgb_disable_output(); -# if defined(SHARED_MATRIX) +# if defined(SHARED_MATRIX) shared_matrix_scan_keys(shared_matrix, current_key_row, last_key_row); -# endif // SHARED_MATRIX +# endif // SHARED_MATRIX } bool enable_pwm_output = false; - for (uint8_t current_key_col = 0; current_key_col < SN32_RGB_MATRIX_COLS; current_key_col++) { + for (uint8_t current_key_col = 0; current_key_col < SN32F2XX_RGB_MATRIX_COLS; current_key_col++) { uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col]; -# if (SN32_PWM_CONTROL == SOFTWARE_PWM) +# if (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) if (led_index >= SN32F2XX_LED_COUNT) continue; -# endif // SN32_PWM_CONTROL +# endif // SN32F2XX_PWM_CONTROL // Check if we need to enable RGB output if (led_state[led_index].b > 0) enable_pwm_output |= true; if (led_state[led_index].g > 0) enable_pwm_output |= true; if (led_state[led_index].r > 0) enable_pwm_output |= true; // Update matching RGB channel PWM configuration -# if (SN32_PWM_CONTROL == HARDWARE_PWM) - switch (current_row % SN32_RGB_MATRIX_ROW_CHANNELS) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) + switch (current_row % SN32F2XX_RGB_MATRIX_ROW_CHANNELS) { case 0: pwmEnableChannel(pwmp, chan_col_order[current_key_col], led_state[led_index].b); break; @@ -407,20 +407,10 @@ static void update_pwm_channels(PWMDriver *pwmp) { break; default:; } -# elif (SN32_PWM_CONTROL == SOFTWARE_PWM) - switch (current_row % SN32_RGB_MATRIX_ROW_CHANNELS) { +# elif (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) + switch (current_row % SN32F2XX_RGB_MATRIX_ROW_CHANNELS) { case 0: led_duty_cycle[current_key_col] = led_state[led_index].r; -# if defined(EVISION_BOTCHED_RED_CHANNEL) // some keyboards have a 151k resistor value tied to the R channel instead of a 10k, as the rest. - /* Boost the output for that channel maximizing the current draw by disabling other sinks */ -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) - gpio_write_pin_low(led_row_pins[current_row + 1]); - gpio_write_pin_low(led_row_pins[current_row + 2]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) - gpio_write_pin_high(led_row_pins[current_row + 1]); - gpio_write_pin_high(led_row_pins[current_row + 2]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL -# endif // EVISION_BOTCHED_RED_CHANNEL break; case 1: led_duty_cycle[current_key_col] = led_state[led_index].b; @@ -434,41 +424,41 @@ static void update_pwm_channels(PWMDriver *pwmp) { } // Enable RGB output if (enable_pwm_output) { -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) +# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_high(led_row_pins[current_row]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_low(led_row_pins[current_row]); # endif } } -#elif (SN32_PWM_DIRECTION == ROW2COL) +#elif (SN32F2XX_PWM_DIRECTION == ROW2COL) static void shared_matrix_rgb_disable_output(void) { // Disable LED outputs on RGB channel pins - for (uint8_t x = 0; x < SN32_RGB_MATRIX_COLS; x++) { -# if (DIODE_DIRECTION != SN32_PWM_DIRECTION) + for (uint8_t x = 0; x < SN32F2XX_RGB_MATRIX_COLS; x++) { +# if (DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION) gpio_set_pin_input(led_col_pins[x]); -# endif // DIODE_DIRECTION != SN32_PWM_DIRECTION +# endif // DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION // Unselect all columns before scanning the key matrix -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_high(led_col_pins[x]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) +# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_low(led_col_pins[x]); # endif } -# if (DIODE_DIRECTION != SN32_PWM_DIRECTION) +# if (DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION) // Disable PWM outputs on row pins - for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { -# if (SN32_PWM_CONTROL == HARDWARE_PWM) + for (uint8_t x = 0; x < SN32F2XX_RGB_MATRIX_ROWS_HW; x++) { +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) pwmDisableChannel(&PWMD1, chan_row_order[x]); -# endif // SN32_PWM_CONTROL -# if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) +# endif // SN32F2XX_PWM_CONTROL +# if (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH) gpio_write_pin_low(led_row_pins[x]); -# elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) +# elif (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_LOW) gpio_write_pin_high(led_row_pins[x]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL } -# endif // DIODE_DIRECTION != SN32_PWM_DIRECTION +# endif // DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION } static void update_pwm_channels(PWMDriver *pwmp) { @@ -480,99 +470,95 @@ static void update_pwm_channels(PWMDriver *pwmp) { if (current_key_col < MATRIX_COLS) row_shifter <<= 1; if (current_key_col == MATRIX_COLS) row_shifter = MATRIX_ROW_SHIFTER; # endif // DIODE_DIRECTION == ROW2COL - if (current_key_col == SN32_RGB_MATRIX_COLS) current_key_col = 0; + if (current_key_col == SN32F2XX_RGB_MATRIX_COLS) current_key_col = 0; // Disable LED output before scanning the key matrix if (current_key_col < MATRIX_COLS) { shared_matrix_rgb_disable_output(); -# if defined(SHARED_MATRIX) +# if defined(SHARED_MATRIX) shared_matrix_scan_keys(shared_matrix, current_key_col, last_key_col); -# endif // SHARED_MATRIX - } - - for (uint8_t x = 0; x < SN32_RGB_MATRIX_COLS; x++) { -# if (DIODE_DIRECTION != SN32_PWM_DIRECTION) - gpio_set_pin_output_push_pull(led_col_pins[x]); -# endif // DIODE_DIRECTION != SN32_PWM_DIRECTION +# endif // SHARED_MATRIX } bool enable_pwm_output = false; for (uint8_t current_key_row = 0; current_key_row < MATRIX_ROWS; current_key_row++) { uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col]; -# if (SN32_PWM_CONTROL == SOFTWARE_PWM) +# if (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) if (led_index >= SN32F2XX_LED_COUNT) continue; # endif - uint8_t led_row_id = (current_key_row * SN32_RGB_MATRIX_ROW_CHANNELS); + uint8_t led_row_id = (current_key_row * SN32F2XX_RGB_MATRIX_ROW_CHANNELS); // Check if we need to enable RGB output if (led_state[led_index].b > 0) enable_pwm_output |= true; if (led_state[led_index].g > 0) enable_pwm_output |= true; if (led_state[led_index].r > 0) enable_pwm_output |= true; // Update matching RGB channel PWM configuration -# if (SN32_PWM_CONTROL == HARDWARE_PWM) +# if (SN32F2XX_PWM_CONTROL == HARDWARE_PWM) pwmEnableChannelI(pwmp, chan_row_order[(led_row_id + 0)], led_state[led_index].r); pwmEnableChannelI(pwmp, chan_row_order[(led_row_id + 1)], led_state[led_index].b); pwmEnableChannelI(pwmp, chan_row_order[(led_row_id + 2)], led_state[led_index].g); } // Enable RGB output if (enable_pwm_output) { -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) + gpio_set_pin_output_push_pull(led_col_pins[last_key_col]); +# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_high(led_col_pins[last_key_col]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_low(led_col_pins[last_key_col]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL } -# elif (SN32_PWM_CONTROL == SOFTWARE_PWM) +# elif (SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) led_duty_cycle[(led_row_id + 0)] = led_state[led_index].r; led_duty_cycle[(led_row_id + 1)] = led_state[led_index].b; led_duty_cycle[(led_row_id + 2)] = led_state[led_index].g; } // Enable RGB output if (enable_pwm_output) { -# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) + gpio_set_pin_output_push_pull(led_col_pins[last_key_col]); +# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) gpio_write_pin_high(led_col_pins[current_key_col]); -# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) +# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) gpio_write_pin_low(led_col_pins[current_key_col]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL } -# endif // SN32_PWM_CONTROL +# endif // SN32F2XX_PWM_CONTROL } -#endif // SN32_PWM_DIRECTION == ROW2COL +#endif // SN32F2XX_PWM_DIRECTION == ROW2COL static void rgb_callback(PWMDriver *pwmp) { // Disable the interrupt pwmDisablePeriodicNotification(pwmp); -#if ((SN32_PWM_CONTROL == SOFTWARE_PWM) && (SN32_PWM_DIRECTION == COL2ROW)) - for (uint8_t pwm_cnt = 0; pwm_cnt < (SN32_RGB_MATRIX_COLS * RGB_MATRIX_HUE_STEP); pwm_cnt++) { - uint8_t pwm_index = (pwm_cnt % SN32_RGB_MATRIX_COLS); +#if ((SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) && (SN32F2XX_PWM_DIRECTION == COL2ROW)) + for (uint8_t pwm_cnt = 0; pwm_cnt < (SN32F2XX_RGB_MATRIX_COLS * RGB_MATRIX_HUE_STEP); pwm_cnt++) { + uint8_t pwm_index = (pwm_cnt % SN32F2XX_RGB_MATRIX_COLS); if (((uint16_t)(pwmp->ct->TC) < ((uint16_t)(led_duty_cycle[pwm_index] + periodticks))) && (led_duty_cycle[pwm_index] > 0)) { gpio_set_pin_output_push_pull(led_col_pins[pwm_index]); -# if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) +# if (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_LOW) gpio_write_pin_low(led_col_pins[pwm_index]); } else { gpio_set_pin_input_high(led_col_pins[pwm_index]); -# elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) +# elif (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH) gpio_write_pin_high(led_col_pins[pwm_index]); } else { gpio_set_pin_input_low(led_col_pins[pwm_index]); -# endif // SN32_PWM_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL } } -#elif ((SN32_PWM_CONTROL == SOFTWARE_PWM) && (SN32_PWM_DIRECTION == ROW2COL)) - for (uint8_t pwm_cnt = 0; pwm_cnt < (SN32_RGB_MATRIX_ROWS_HW * RGB_MATRIX_HUE_STEP); pwm_cnt++) { - uint8_t pwm_index = (pwm_cnt % SN32_RGB_MATRIX_ROWS_HW); +#elif ((SN32F2XX_PWM_CONTROL == SOFTWARE_PWM) && (SN32F2XX_PWM_DIRECTION == ROW2COL)) + for (uint8_t pwm_cnt = 0; pwm_cnt < (SN32F2XX_RGB_MATRIX_ROWS_HW * RGB_MATRIX_HUE_STEP); pwm_cnt++) { + uint8_t pwm_index = (pwm_cnt % SN32F2XX_RGB_MATRIX_ROWS_HW); if (((uint16_t)(pwmp->ct->TC) < ((uint16_t)(led_duty_cycle[pwm_index] + periodticks))) && (led_duty_cycle[pwm_index] > 0)) { -# if (DIODE_DIRECTION != SN32_PWM_DIRECTION) +# if (DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION) gpio_set_pin_output_push_pull(led_row_pins[pwm_index]); -# endif // DIODE_DIRECTION != SN32_PWM_DIRECTION +# endif // DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION -# if (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW) +# if (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_LOW) gpio_write_pin_low(led_row_pins[pwm_index]); } else { gpio_write_pin_high(led_row_pins[pwm_index]); -# elif (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH) +# elif (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH) gpio_write_pin_high(led_row_pins[pwm_index]); } else { gpio_write_pin_low(led_row_pins[pwm_index]); -# endif // SN32_PWM_OUTPUT_ACTIVE_LEVEL +# endif // SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL } } #endif @@ -587,30 +573,28 @@ static void rgb_callback(PWMDriver *pwmp) { } void sn32f2xx_init(void) { - for (uint8_t x = 0; x < SN32_RGB_MATRIX_ROWS_HW; x++) { + for (uint8_t x = 0; x < SN32F2XX_RGB_MATRIX_ROWS_HW; x++) { gpio_set_pin_output_push_pull(led_row_pins[x]); -# if ((SN32_PWM_DIRECTION == COL2ROW) && (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH) || \ - (SN32_PWM_DIRECTION == ROW2COL) && (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_HIGH)) +#if ((SN32F2XX_PWM_DIRECTION == COL2ROW) && (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH) || (SN32F2XX_PWM_DIRECTION == ROW2COL) && (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH)) gpio_write_pin_low(led_row_pins[x]); -# elif ((SN32_PWM_DIRECTION == COL2ROW) && (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW) || \ - (SN32_PWM_DIRECTION == ROW2COL) && (SN32_PWM_OUTPUT_ACTIVE_LEVEL == SN32_PWM_OUTPUT_ACTIVE_LOW)) +#elif ((SN32F2XX_PWM_DIRECTION == COL2ROW) && (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW) || (SN32F2XX_PWM_DIRECTION == ROW2COL) && (SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_LOW)) gpio_write_pin_high(led_row_pins[x]); -# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL +#endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL } // Determine which PWM channels we need to control -# if defined(SN32F240B) +#if defined(SN32F240B) rgb_ch_ctrl(&pwmcfg); -# elif defined(SN32F260) +#elif defined(SN32F260) rgb_ch_ctrl(); -# endif // chip selection +#endif // chip selection -# if defined(SHARED_MATRIX) +#if defined(SHARED_MATRIX) // initialize matrix state: all keys off for (uint8_t i = 0; i < MATRIX_ROWS; i++) { shared_matrix[i] = 0; } -# endif // SHARED_MATRIX +#endif // SHARED_MATRIX pwmStart(&PWMD1, &pwmcfg); shared_matrix_rgb_enable(); @@ -624,9 +608,9 @@ void sn32f2xx_flush(void) { } void sn32f2xx_set_color(int index, uint8_t r, uint8_t g, uint8_t b) { - uint8_t color_r = r * SN32_LED_OUTPUT_LUMINOSITY_R; - uint8_t color_g = g * SN32_LED_OUTPUT_LUMINOSITY_G; - uint8_t color_b = b * SN32_LED_OUTPUT_LUMINOSITY_B; + uint8_t color_r = r * SN32F2XX_LED_OUTPUT_LUMINOSITY_R; + uint8_t color_g = g * SN32F2XX_LED_OUTPUT_LUMINOSITY_G; + uint8_t color_b = b * SN32F2XX_LED_OUTPUT_LUMINOSITY_B; #ifdef UNDERGLOW_RBG bool flip_gb = false; diff --git a/drivers/led/sn32f2xx.h b/drivers/led/sn32f2xx.h index e07c086efa7f..5b541a1bc385 100644 --- a/drivers/led/sn32f2xx.h +++ b/drivers/led/sn32f2xx.h @@ -19,59 +19,59 @@ #include #include -#if !defined(SN32_LED_OUTPUT_LUMINOSITY_R) -# define SN32_LED_OUTPUT_LUMINOSITY_R 1 +#if !defined(SN32F2XX_LED_OUTPUT_LUMINOSITY_R) +# define SN32F2XX_LED_OUTPUT_LUMINOSITY_R 1 #endif -#if !defined(SN32_LED_OUTPUT_LUMINOSITY_G) -# define SN32_LED_OUTPUT_LUMINOSITY_G 1 +#if !defined(SN32F2XX_LED_OUTPUT_LUMINOSITY_G) +# define SN32F2XX_LED_OUTPUT_LUMINOSITY_G 1 #endif -#if !defined(SN32_LED_OUTPUT_LUMINOSITY_B) -# define SN32_LED_OUTPUT_LUMINOSITY_B 1 +#if !defined(SN32F2XX_LED_OUTPUT_LUMINOSITY_B) +# define SN32F2XX_LED_OUTPUT_LUMINOSITY_B 1 #endif #if defined(RGB_MATRIX_SN32F2XX) # define SN32F2XX_LED_COUNT RGB_MATRIX_LED_COUNT #endif -#if !defined(SN32_PWM_OUTPUT_ACTIVE_LEVEL) -# define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_LOW +#if !defined(SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL) +# define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_LOW #endif -#if !defined(SN32_RGB_OUTPUT_ACTIVE_LEVEL) -# define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH +#if !defined(SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL) +# define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH #endif -#if !defined(SN32_PWM_CONTROL) -# define SN32_PWM_CONTROL HARDWARE_PWM +#if !defined(SN32F2XX_PWM_CONTROL) +# define SN32F2XX_PWM_CONTROL HARDWARE_PWM #endif -#if !defined(SN32_PWM_DIRECTION) -# define SN32_PWM_DIRECTION DIODE_DIRECTION +#if !defined(SN32F2XX_PWM_DIRECTION) +# define SN32F2XX_PWM_DIRECTION DIODE_DIRECTION #endif -#if !defined(SN32_RGB_MATRIX_ROW_CHANNELS) -# define SN32_RGB_MATRIX_ROW_CHANNELS 3 +#if !defined(SN32F2XX_RGB_MATRIX_ROW_CHANNELS) +# define SN32F2XX_RGB_MATRIX_ROW_CHANNELS 3 #endif -#if !defined(SN32_RGB_MATRIX_ROWS) -# define SN32_RGB_MATRIX_ROWS MATRIX_ROWS +#if !defined(SN32F2XX_RGB_MATRIX_ROWS) +# define SN32F2XX_RGB_MATRIX_ROWS MATRIX_ROWS #endif -#if !defined(SN32_RGB_MATRIX_COLS) -# define SN32_RGB_MATRIX_COLS MATRIX_COLS +#if !defined(SN32F2XX_RGB_MATRIX_COLS) +# define SN32F2XX_RGB_MATRIX_COLS MATRIX_COLS #endif -#if !defined(SN32_RGB_MATRIX_ROW_PINS) -# error Missing definition for SN32_RGB_MATRIX_ROW_PINS +#if !defined(SN32F2XX_RGB_MATRIX_ROW_PINS) +# error Missing definition for SN32F2XX_RGB_MATRIX_ROW_PINS #endif -#if !defined(SN32_RGB_MATRIX_COL_PINS) +#if !defined(SN32F2XX_RGB_MATRIX_COL_PINS) # define SHARED_MATRIX -# define SN32_RGB_MATRIX_COL_PINS MATRIX_COL_PINS +# define SN32F2XX_RGB_MATRIX_COL_PINS MATRIX_COL_PINS #endif -#if !defined(SN32_RGB_MATRIX_ROWS_HW) -# define SN32_RGB_MATRIX_ROWS_HW (SN32_RGB_MATRIX_ROWS * SN32_RGB_MATRIX_ROW_CHANNELS) +#if !defined(SN32F2XX_RGB_MATRIX_ROWS_HW) +# define SN32F2XX_RGB_MATRIX_ROWS_HW (SN32F2XX_RGB_MATRIX_ROWS * SN32F2XX_RGB_MATRIX_ROW_CHANNELS) #endif void sn32f2xx_init(void); diff --git a/keyboards/czc/dwarf/config.h b/keyboards/czc/dwarf/config.h index ee885178a3a9..834a8082a194 100644 --- a/keyboards/czc/dwarf/config.h +++ b/keyboards/czc/dwarf/config.h @@ -5,4 +5,4 @@ /* RGB matrix configuration can't be fully expressed in JSON as of now */ #define RGB_MATRIX_LED_COUNT 87 -#define SN32_RGB_MATRIX_ROW_PINS {C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14} \ No newline at end of file +#define SN32F2XX_RGB_MATRIX_ROW_PINS {C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14} \ No newline at end of file diff --git a/keyboards/designedbygg/berserker/config.h b/keyboards/designedbygg/berserker/config.h index de0f8686fa70..51e5c2aed15d 100644 --- a/keyboards/designedbygg/berserker/config.h +++ b/keyboards/designedbygg/berserker/config.h @@ -33,5 +33,5 @@ #define LED_WIN_LOCK_PIN B12 /* RGB LED Config */ -#define SN32_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } #define RGB_MATRIX_LED_COUNT (88) \ No newline at end of file diff --git a/keyboards/designedbygg/ironclad/icl01/config.h b/keyboards/designedbygg/ironclad/icl01/config.h index a2fb9d9f9084..377f4c7f3e0a 100644 --- a/keyboards/designedbygg/ironclad/icl01/config.h +++ b/keyboards/designedbygg/ironclad/icl01/config.h @@ -17,9 +17,9 @@ #pragma once /* RGB LED Config */ -#define SN32_RGB_MATRIX_ROW_PINS \ +#define SN32F2XX_RGB_MATRIX_ROW_PINS \ { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B7, B8, B9, B10, B11, B12 } -#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_LOW -#define SN32_PWM_DIRECTION ROW2COL +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_LOW +#define SN32F2XX_PWM_DIRECTION ROW2COL #define RGB_MATRIX_LED_COUNT (105) \ No newline at end of file diff --git a/keyboards/designedbygg/ironclad/icl03/config.h b/keyboards/designedbygg/ironclad/icl03/config.h index 6b3493b6c826..1e812ba9601a 100644 --- a/keyboards/designedbygg/ironclad/icl03/config.h +++ b/keyboards/designedbygg/ironclad/icl03/config.h @@ -20,6 +20,6 @@ #define LED_WIN_LOCK_PIN B12 /* RGB LED Config */ -#define SN32_RGB_MATRIX_ROW_PINS \ +#define SN32F2XX_RGB_MATRIX_ROW_PINS \ { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } #define RGB_MATRIX_LED_COUNT (109) diff --git a/keyboards/designedbygg/redblade/config.h b/keyboards/designedbygg/redblade/config.h index d490c984aab0..61b7b6514e53 100644 --- a/keyboards/designedbygg/redblade/config.h +++ b/keyboards/designedbygg/redblade/config.h @@ -31,6 +31,6 @@ #define LED_WIN_LOCK_PIN B12 /* RGB LED Config */ -#define SN32_RGB_MATRIX_ROW_PINS \ +#define SN32F2XX_RGB_MATRIX_ROW_PINS \ { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } #define RGB_MATRIX_LED_COUNT (109) diff --git a/keyboards/flesports/fl980/config.h b/keyboards/flesports/fl980/config.h index 9c9589108458..f4a40af251db 100644 --- a/keyboards/flesports/fl980/config.h +++ b/keyboards/flesports/fl980/config.h @@ -16,9 +16,9 @@ #pragma once -#define SN32_RGB_MATRIX_ROW_PINS { C0,C1,C3, C4,C5,C6, C7,C8,C9, C10,C11,C12, C13,C14,B13, C15,B15,B14 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0,C1,C3, C4,C5,C6, C7,C8,C9, C10,C11,C12, C13,C14,B13, C15,B15,B14 } #define RGB_MATRIX_LED_COUNT 98 #define MATRIX_UNSELECT_DRIVE_HIGH -#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH \ No newline at end of file +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH \ No newline at end of file diff --git a/keyboards/hator/gravity/tkl/config.h b/keyboards/hator/gravity/tkl/config.h index 24b96b0b6917..79ca47291c3a 100644 --- a/keyboards/hator/gravity/tkl/config.h +++ b/keyboards/hator/gravity/tkl/config.h @@ -16,13 +16,13 @@ along with this program. If not, see . #pragma once -#define SN32_RGB_MATRIX_ROW_PINS { C3,C1,C0, C6,C5,C4, C9,C8,C7, C12,C11,C10, B13,C14,C13, B14,B15,D3, A2,A4,A3 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3,C1,C0, C6,C5,C4, C9,C8,C7, C12,C11,C10, B13,C14,C13, B14,B15,D3, A2,A4,A3 } -#define SN32_RGB_MATRIX_COL_PINS {A8, A9, A10, A11, A12, A13, A14, A15, B0, B1, B2, B3, B4, B5, B6, B7, B8} +#define SN32F2XX_RGB_MATRIX_COL_PINS {A8, A9, A10, A11, A12, A13, A14, A15, B0, B1, B2, B3, B4, B5, B6, B7, B8} #define RGB_MATRIX_LED_COUNT 104 #define MATRIX_UNSELECT_DRIVE_HIGH -//#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH +//#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH //#define USB_MAX_POWER_CONSUMPTION 500 #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 240 \ No newline at end of file diff --git a/keyboards/hator/gravity/xtkl/config.h b/keyboards/hator/gravity/xtkl/config.h index 625ba5bd85f7..22dece50e220 100644 --- a/keyboards/hator/gravity/xtkl/config.h +++ b/keyboards/hator/gravity/xtkl/config.h @@ -18,7 +18,7 @@ along with this program. If not, see . #define MATRIX_UNSELECT_DRIVE_HIGH -#define SN32_RGB_MATRIX_ROW_PINS { C3,C1,C0, C6,C5,C4, C9,C8,C7, C12,C11,C10, B13,C14,C13, B14,B15,D3, A2,A4,A3 } -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3,C1,C0, C6,C5,C4, C9,C8,C7, C12,C11,C10, B13,C14,C13, B14,B15,D3, A2,A4,A3 } +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH #define RGB_MATRIX_LED_COUNT 104 #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 240 diff --git a/keyboards/keychron/c1/rgb/config.h b/keyboards/keychron/c1/rgb/config.h index 39cc3cd7dc54..4b1d70684c43 100644 --- a/keyboards/keychron/c1/rgb/config.h +++ b/keyboards/keychron/c1/rgb/config.h @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#define SN32_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } #define LED_MAC_PIN B11 // Labeled Mac on KB since no Scroll Lock #define LED_WIN_PIN B12 // Labeled Windows on KB since no Numpad diff --git a/keyboards/keychron/k12/rgb/config.h b/keyboards/keychron/k12/rgb/config.h index 87374a259321..8626eeba6270 100644 --- a/keyboards/keychron/k12/rgb/config.h +++ b/keyboards/keychron/k12/rgb/config.h @@ -16,4 +16,4 @@ #pragma once -#define SN32_RGB_MATRIX_ROW_PINS {C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3} \ No newline at end of file +#define SN32F2XX_RGB_MATRIX_ROW_PINS {C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3} \ No newline at end of file diff --git a/keyboards/keychron/k2/rgb/v2/config.h b/keyboards/keychron/k2/rgb/v2/config.h index 4ea10f15291c..5147b70a57e2 100644 --- a/keyboards/keychron/k2/rgb/v2/config.h +++ b/keyboards/keychron/k2/rgb/v2/config.h @@ -17,5 +17,5 @@ */ #pragma once -#define SN32_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } #define DIP_SWITCH_PINS { D4, D5 } diff --git a/keyboards/keychron/k4/rgb/v2/ansi/config.h b/keyboards/keychron/k4/rgb/v2/ansi/config.h index 111ab0f01df3..e0f22bc0513b 100644 --- a/keyboards/keychron/k4/rgb/v2/ansi/config.h +++ b/keyboards/keychron/k4/rgb/v2/ansi/config.h @@ -15,4 +15,4 @@ #define DIP_SWITCH_PINS { D5, D6 } #define RGB_MATRIX_LED_COUNT 100 -#define SN32_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file diff --git a/keyboards/keychron/k4/rgb/v2/iso/config.h b/keyboards/keychron/k4/rgb/v2/iso/config.h index 5eac10cdd5f5..34a1c6459cfa 100644 --- a/keyboards/keychron/k4/rgb/v2/iso/config.h +++ b/keyboards/keychron/k4/rgb/v2/iso/config.h @@ -15,4 +15,4 @@ #define DIP_SWITCH_PINS { D5, D6 } #define RGB_MATRIX_LED_COUNT 101 -#define SN32_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file diff --git a/keyboards/keychron/k8/rgb/config.h b/keyboards/keychron/k8/rgb/config.h index d981b41b239d..04cdc6b71a28 100644 --- a/keyboards/keychron/k8/rgb/config.h +++ b/keyboards/keychron/k8/rgb/config.h @@ -22,4 +22,4 @@ #define DIP_SWITCH_PINS { D4, D5 } // RGB LED Config -#define SN32_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C3, C1, C0, C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3 } \ No newline at end of file diff --git a/keyboards/ozone/tactical/config.h b/keyboards/ozone/tactical/config.h index e1b472017be8..b60d0fca09a0 100644 --- a/keyboards/ozone/tactical/config.h +++ b/keyboards/ozone/tactical/config.h @@ -18,5 +18,5 @@ #pragma once // RGB config -#define SN32_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } #define RGB_MATRIX_LED_COUNT 69 \ No newline at end of file diff --git a/keyboards/redragon/k552/v2/config.h b/keyboards/redragon/k552/v2/config.h index 47dd843f1c81..f31451ecf0f4 100644 --- a/keyboards/redragon/k552/v2/config.h +++ b/keyboards/redragon/k552/v2/config.h @@ -17,9 +17,9 @@ #pragma once -#define SN32_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } -#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_LOW +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_LOW #define MATRIX_UNSELECT_DRIVE_HIGH #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 diff --git a/keyboards/redragon/k556/config.h b/keyboards/redragon/k556/config.h index d3754fd2183e..89f593c5e274 100644 --- a/keyboards/redragon/k556/config.h +++ b/keyboards/redragon/k556/config.h @@ -21,11 +21,11 @@ /* key matrix size */ #define RGB_MATRIX_LED_COUNT 106 -#define SN32_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } /* Configure the effects: */ #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 /* Configure transistor logic for RGB matrix */ -#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_LOW \ No newline at end of file +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_LOW \ No newline at end of file diff --git a/keyboards/redragon/k582/config.h b/keyboards/redragon/k582/config.h index 376753b58516..59dfdcfbbfc6 100644 --- a/keyboards/redragon/k582/config.h +++ b/keyboards/redragon/k582/config.h @@ -21,11 +21,11 @@ /* key matrix size */ #define RGB_MATRIX_LED_COUNT 104 -#define SN32_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C0, C1, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } /* Configure the effects: */ #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 /* Configure transistor logic for RGB matrix */ -#define SN32_PWM_OUTPUT_ACTIVE_LEVEL SN32_PWM_OUTPUT_ACTIVE_HIGH -#define SN32_RGB_OUTPUT_ACTIVE_LEVEL SN32_RGB_OUTPUT_ACTIVE_LOW +#define SN32F2XX_PWM_OUTPUT_ACTIVE_LEVEL SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH +#define SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL SN32F2XX_RGB_OUTPUT_ACTIVE_LOW diff --git a/keyboards/redragon/k630/config.h b/keyboards/redragon/k630/config.h index a93fbd18e933..a4141f68644e 100644 --- a/keyboards/redragon/k630/config.h +++ b/keyboards/redragon/k630/config.h @@ -18,7 +18,7 @@ /* RGB matrix configuration can't be fully expressed in JSON as of now */ #define RGB_MATRIX_LED_COUNT 61 -#define SN32_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, B6, B7, B8, B9, B10, B11 } /* Configure the effects: */ #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 \ No newline at end of file diff --git a/keyboards/royal_kludge/rk61_rgb/config.h b/keyboards/royal_kludge/rk61_rgb/config.h index 5872dd62574c..7dd80cf02a5c 100644 --- a/keyboards/royal_kludge/rk61_rgb/config.h +++ b/keyboards/royal_kludge/rk61_rgb/config.h @@ -17,7 +17,7 @@ #pragma once /* RGB matrix configuration can't be fully expressed in JSON as of now */ -#define SN32_RGB_MATRIX_ROW_PINS { C5, C6, C4, C8, C9, C7, C11, C12, C10, C14, B13, C13, B15, B14, D3 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C5, C6, C4, C8, C9, C7, C11, C12, C10, C14, B13, C13, B15, B14, D3 } /* Configure the effects: */ #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 \ No newline at end of file diff --git a/keyboards/royal_kludge/rk68_rgb/config.h b/keyboards/royal_kludge/rk68_rgb/config.h index 6da87ccdc05d..85958af84dd2 100644 --- a/keyboards/royal_kludge/rk68_rgb/config.h +++ b/keyboards/royal_kludge/rk68_rgb/config.h @@ -17,7 +17,7 @@ #pragma once /* RGB matrix configuration can't be fully expressed in JSON as of now */ -#define SN32_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } +#define SN32F2XX_RGB_MATRIX_ROW_PINS { C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, B13, D3, B15, B14 } /* Configure the effects: */ #define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 50 \ No newline at end of file