aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32g0.c
diff options
context:
space:
mode:
authorAlex Voinea <voinea.dragos.alexandru@gmail.com>2022-12-12 22:14:09 +0100
committerKevinOConnor <kevin@koconnor.net>2022-12-15 10:05:43 -0500
commite33b41abaabe7d2be2207c79d5ed59cb8ce7babc (patch)
tree60316450af67509040b3dc544aa0c35728e14e6e /src/stm32/stm32g0.c
parent9d668d63a7183a62b9f78ef7e40f1a2089a43097 (diff)
downloadkutter-e33b41abaabe7d2be2207c79d5ed59cb8ce7babc.tar.gz
kutter-e33b41abaabe7d2be2207c79d5ed59cb8ce7babc.tar.xz
kutter-e33b41abaabe7d2be2207c79d5ed59cb8ce7babc.zip
stm32g0: add stm32g0b0 support
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Diffstat (limited to 'src/stm32/stm32g0.c')
-rw-r--r--src/stm32/stm32g0.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/stm32/stm32g0.c b/src/stm32/stm32g0.c
index 244e00d9..84711709 100644
--- a/src/stm32/stm32g0.c
+++ b/src/stm32/stm32g0.c
@@ -32,12 +32,16 @@ lookup_clock_line(uint32_t periph_base)
uint32_t bit = 1 << ((periph_base - AHBPERIPH_BASE) / 0x400);
return (struct cline){.en=&RCC->AHBENR, .rst=&RCC->AHBRSTR, .bit=bit};
}
+#if defined(FDCAN1_BASE) || defined(FDCAN2_BASE)
if ((periph_base == FDCAN1_BASE) || (periph_base == FDCAN2_BASE))
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<12};
+#endif
if (periph_base == USB_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<13};
+#ifdef CRS_BASE
if (periph_base == CRS_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<16};
+#endif
if (periph_base == I2C3_BASE)
return (struct cline){.en=&RCC->APBENR1,.rst=&RCC->APBRSTR1,.bit=1<<23};
if (periph_base == TIM1_BASE)
@@ -56,7 +60,7 @@ lookup_clock_line(uint32_t periph_base)
return (struct cline){.en=&RCC->APBENR2,.rst=&RCC->APBRSTR2,.bit=1<<18};
if (periph_base == ADC1_BASE)
return (struct cline){.en=&RCC->APBENR2,.rst=&RCC->APBRSTR2,.bit=1<<20};
- if (periph_base >= APBPERIPH_BASE && periph_base <= LPTIM1_BASE)
+ if (periph_base >= APBPERIPH_BASE && periph_base < APBPERIPH_BASE + 0x8000)
{
uint32_t bit = 1 << ((periph_base - APBPERIPH_BASE) / 0x400);
return (struct cline){.en=&RCC->APBENR1, .rst=&RCC->APBRSTR1, .bit=bit};