got LEDs working, ribbon trail program initially implemented

- fixed soft I2C master set hi/lo routines
- fixed bug in matrix_send not setting all LEDs from map
- fix AWU interrupt not firing; requires EXTI line to be configured too even if unused
- fixed wrong dividers used in system clock set function
This commit is contained in:
true
2026-05-08 16:12:18 -07:00
parent d95af918fa
commit abd985e3a1
10 changed files with 117 additions and 56 deletions

View File

@@ -10,6 +10,7 @@
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#include "ch32x035.h"
#include "system_ch32x035.h"
/*
* Uncomment the line corresponding to the desired System clock (SYSCLK) frequency (after
@@ -90,10 +91,10 @@ void SetSysClock_HSI(uint32_t divider)
// set wait states depending on speed
if (divider > RCC_HPRE_DIV1) { // 48MHz is already set to 2 cycles
if (divider >= RCC_HPRE_DIV1) { // 24MHz is 1 cycle
actlr |= (uint32_t)FLASH_ACTLR_LATENCY_0;
} else { // all others are 0 cycle
if (divider == RCC_HPRE_DIV2) { // 24MHz is 1 cycle
actlr |= (uint32_t)FLASH_ACTLR_LATENCY_1;
} else { // all others are 0 cycle
actlr |= (uint32_t)FLASH_ACTLR_LATENCY_0;
}
FLASH->ACTLR = actlr;