summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/led/sn32/rgb_matrix_sn32f24xb.c9
m---------lib/chibios-contrib0
-rw-r--r--platforms/chibios/boards/SN_SN32F240B/configs/chconf.h6
-rw-r--r--platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h9
-rw-r--r--platforms/chibios/boards/SN_SN32F260/configs/chconf.h6
-rw-r--r--platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h6
-rw-r--r--platforms/chibios/chibios_config.h6
7 files changed, 22 insertions, 20 deletions
diff --git a/drivers/led/sn32/rgb_matrix_sn32f24xb.c b/drivers/led/sn32/rgb_matrix_sn32f24xb.c
index 800e4fb90..5a7a5f2e7 100644
--- a/drivers/led/sn32/rgb_matrix_sn32f24xb.c
+++ b/drivers/led/sn32/rgb_matrix_sn32f24xb.c
@@ -53,6 +53,7 @@ static uint8_t chan_col_order[LED_MATRIX_COLS] = {0}; // track the channel col o
static uint8_t current_row = 0; // LED row scan counter
static uint8_t row_idx = 0; // key row scan counter
extern matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
+static const uint32_t periodticks = 256;
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[LED_MATRIX_ROWS_HW] = LED_MATRIX_ROW_PINS; // We expect a R,B,G order here
static const pin_t led_col_pins[LED_MATRIX_COLS] = LED_MATRIX_COL_PINS;
@@ -61,10 +62,10 @@ bool enable_pwm = false;
/* PWM configuration structure. We use timer CT16B1 with 24 channels. */
static PWMConfig pwmcfg = {
- freq, /* PWM clock frequency. */
- 256, /* PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */
- NULL, /* RGB Callback */
- { /* Default all channels to disabled - Channels will be configured durring init */
+ freq, /* PWM clock frequency. */
+ periodticks, /* PWM period (in ticks) 1S (1/10kHz=0.1mS 0.1ms*10000 ticks=1S) */
+ NULL, /* RGB Callback */
+ { /* Default all channels to disabled - Channels will be configured durring init */
{PWM_OUTPUT_DISABLED, NULL, 0},
{PWM_OUTPUT_DISABLED, NULL, 0},
{PWM_OUTPUT_DISABLED, NULL, 0},
diff --git a/lib/chibios-contrib b/lib/chibios-contrib
-Subproject ffe447b82af58105f9bac5599e11526645f051e
+Subproject dad30e387aa1b7b74e80a364f154f527cc3928b
diff --git a/platforms/chibios/boards/SN_SN32F240B/configs/chconf.h b/platforms/chibios/boards/SN_SN32F240B/configs/chconf.h
index f6e2e7167..536733cd3 100644
--- a/platforms/chibios/boards/SN_SN32F240B/configs/chconf.h
+++ b/platforms/chibios/boards/SN_SN32F240B/configs/chconf.h
@@ -43,7 +43,7 @@
* @note Allowed values are 16, 32 or 64 bits.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
-#define CH_CFG_ST_RESOLUTION 32
+#define CH_CFG_ST_RESOLUTION 16
#endif
/**
@@ -52,7 +52,7 @@
* setting also defines the system tick time unit.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
-#define CH_CFG_ST_FREQUENCY 100000
+#define CH_CFG_ST_FREQUENCY 187500
#endif
/**
@@ -80,7 +80,7 @@
* this value.
*/
#if !defined(CH_CFG_ST_TIMEDELTA)
-#define CH_CFG_ST_TIMEDELTA 0
+#define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */
diff --git a/platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h b/platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h
index d3bae4cff..7950cd62d 100644
--- a/platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h
+++ b/platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h
@@ -61,12 +61,9 @@
#define PLATFORM_USB_USE_USB1 TRUE
/*
- * Timer driver system settings.
+ * System Clock settings.
*/
-#define SYS_CLOCK_SETUP 1
-#define SYS0_CLKCFG_VAL 0
-#define AHB_PRESCALAR 0
-#define CLKOUT_SEL_VAL 0x0
-#define CLKOUT_PRESCALAR 0x0
+// Defaults are correct
+
#endif /* MCUCONF_H */
diff --git a/platforms/chibios/boards/SN_SN32F260/configs/chconf.h b/platforms/chibios/boards/SN_SN32F260/configs/chconf.h
index 38494cebd..78b2f16b3 100644
--- a/platforms/chibios/boards/SN_SN32F260/configs/chconf.h
+++ b/platforms/chibios/boards/SN_SN32F260/configs/chconf.h
@@ -43,7 +43,7 @@
* @note Allowed values are 16, 32 or 64 bits.
*/
#if !defined(CH_CFG_ST_RESOLUTION)
-#define CH_CFG_ST_RESOLUTION 32
+#define CH_CFG_ST_RESOLUTION 16
#endif
/**
@@ -52,7 +52,7 @@
* setting also defines the system tick time unit.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
-#define CH_CFG_ST_FREQUENCY 100000
+#define CH_CFG_ST_FREQUENCY 187500
#endif
/**
@@ -80,7 +80,7 @@
* this value.
*/
#if !defined(CH_CFG_ST_TIMEDELTA)
-#define CH_CFG_ST_TIMEDELTA 0
+#define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */
diff --git a/platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h b/platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h
index ffabfb846..ab0543332 100644
--- a/platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h
+++ b/platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h
@@ -37,7 +37,11 @@
/*
* HAL driver system settings.
*/
-
+/*
+ * CT driver system settings.
+ */
+#define SN32_HAS_CT16B0 TRUE
+#define SN32_HAS_CT16B1 TRUE
/*
* SN driver system settings.
*/
diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h
index 1c481e145..8de532a7d 100644
--- a/platforms/chibios/chibios_config.h
+++ b/platforms/chibios/chibios_config.h
@@ -89,6 +89,6 @@
# define PAL_OUTPUT_SPEED_HIGHEST 0
#endif
-#if defined(SN32F2xx)
-# define CPU_CLOCK 48000000
-#endif \ No newline at end of file
+#if defined(SN32F2)
+# define CPU_CLOCK SN32_HCLK
+#endif