diff options
| author | dexter93 <d3xter93@gmail.com> | 2022-01-23 12:43:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-23 12:43:12 +0200 |
| commit | 3c8200883d33d70f77b8d54f2e7bcb21bc5ed51d (patch) | |
| tree | d54286abb53ae056a5901bfc714f389e8a18c76d | |
| parent | d842b2395347e7d54d01ed0b621efc8a44197115 (diff) | |
sn32f2: inherit clocks from chibios (#203)
* Revert "TEMP: HACK: define clock for sn32. 48Mhz"
This reverts commit db1a0f9910e83b1c1dc4c135038e5d998a5cab08.
* inherit clocks from chibios
needs https://github.com/SonixQMK/ChibiOS-Contrib/pull/38
* sn32f2xx: use tickless mode
* pull up chibi
* satisfy linter
* Pull up Chibios-Contrib
* more chibios-contrib
* even more chibi
* sn32f2: bump timedelta to 4
* frequency updates
* hi, please boot
* Revert "hi, please boot"
This reverts commit 97cc1f94cc684873cdf90d0c1a8df43ac023e526.
* Revert "sn32f2: bump timedelta to 4"
This reverts commit ad7c0f9e5a5e9774ac42575e17761fe116653308.
* testing: rgb effects
* pull up chibios-contrib
* matrix: here have some LSD
* k556: here be drugs
* a pinch of coke will do it
* testing: shorter period
* Revert "testing: shorter period"
This reverts commit 4dd9aa8f8fdfed3290feda0215514d989847ea71.
* remove the multipliers
* matrix: revert to original state
* rgb matrix: calculate the ticks from the frequency
* remove redundant include
* Ms
* add correction value
* it's S
* use some hardcoded for now
* bump the period
* scale it down
* scale it down more
* testing: 20khz
* testing: 2kz
* shoot for 20khz, THEN calculate the period
* flip it
* match it
* make sure the value is uint32
* testing: break the time machine
* Revert "testing: break the time machine"
This reverts commit 2f9a66adb055adc80d90930d2bafc18b0abcadb8.
* ms
* Pull up chibios-contrib
* testing: back to hw systick
* testing: back to s
* testing: back to 16bit
* testing: tickless
* testing: timedelta 4
* chibi updates + back to 2
* more chibios
* latest chibios commit
* match the registers
* testing: frequency
* testing: more freq
* testing: use ILRC for systick
* testing: hack
* testing: more ihrc
* testing: more freq
* testing: freq 2
* testing: freq 4
* test: harcode it
* testing: timedelta
* remove this for now
* Revert "testing: timedelta"
This reverts commit a6722c841e4f26b4d34d06b7303d21d2668e0459.
* update configs
* Revert "remove this for now"
This reverts commit f344030ea531710b3988f8137c4ce42676fbd864.
* workaround the chibios timer bug
chThdSleep() fails when the interval does not just fit into the system timer
this is noticeable with a resolution of 16bits in high ST frequencies
* shared matrix: revert to original target frequency
* Revert "workaround the chibios timer bug"
This reverts commit 33affe54c93fffe8cb18039a2183681a6b2644e1.
* Revert "testing: rgb effects"
This reverts commit c112770a284203ed3cccee7fb14b89f2e8f0fd4b.
* Revert "k556: here be drugs"
This reverts commit b9b5aad64cf19daa40541fbd745322bba73ab9df.
| -rw-r--r-- | drivers/led/sn32/rgb_matrix_sn32f24xb.c | 9 | ||||
| m--------- | lib/chibios-contrib | 0 | ||||
| -rw-r--r-- | platforms/chibios/boards/SN_SN32F240B/configs/chconf.h | 6 | ||||
| -rw-r--r-- | platforms/chibios/boards/SN_SN32F240B/configs/mcuconf.h | 9 | ||||
| -rw-r--r-- | platforms/chibios/boards/SN_SN32F260/configs/chconf.h | 6 | ||||
| -rw-r--r-- | platforms/chibios/boards/SN_SN32F260/configs/mcuconf.h | 6 | ||||
| -rw-r--r-- | platforms/chibios/chibios_config.h | 6 |
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 |
