aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f0.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-10-12 13:32:46 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-10-12 13:32:46 -0400
commit1b801508baf58b8053bb30d101efce018b159a5e (patch)
treee30bd5b2472ab3e78a48650519491fbd3592ded8 /src/stm32/stm32f0.c
parent9d9fe3cb1b4afee3f6273ae80c6f702600e12df7 (diff)
downloadkutter-1b801508baf58b8053bb30d101efce018b159a5e.tar.gz
kutter-1b801508baf58b8053bb30d101efce018b159a5e.tar.xz
kutter-1b801508baf58b8053bb30d101efce018b159a5e.zip
stm32: Add comments to configuration of OSPEEDR gpio speed
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/stm32f0.c')
-rw-r--r--src/stm32/stm32f0.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c
index a2a3a52f..06b5d3ab 100644
--- a/src/stm32/stm32f0.c
+++ b/src/stm32/stm32f0.c
@@ -64,6 +64,8 @@ gpio_clock_enable(GPIO_TypeDef *regs)
RCC->AHBENR;
}
+#define STM_OSPEED 0x2 // ~2Mhz at 50pF
+
// Set the mode and extended function of a pin
void
gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
@@ -84,7 +86,7 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
regs->MODER = (regs->MODER & ~m_msk) | (mode_bits << m_shift);
regs->PUPDR = (regs->PUPDR & ~m_msk) | (pup << m_shift);
regs->OTYPER = (regs->OTYPER & ~(1 << pos)) | (od << pos);
- regs->OSPEEDR = (regs->OSPEEDR & ~m_msk) | (0x02 << m_shift);
+ regs->OSPEEDR = (regs->OSPEEDR & ~m_msk) | (STM_OSPEED << m_shift);
}
#define USB_BOOT_FLAG_ADDR (CONFIG_RAM_START + CONFIG_RAM_SIZE - 1024)