From a7902aa4d0f597f2b5821dfebceeffb39213d67f Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Fri, 23 Oct 2020 15:53:13 +0000 Subject: [PATCH] stm32l1: rcc/lcd: fix RTCSEL HSE definition Wrong since original commit in 2013. LCD code can't actually automatically determine clock speed if it's HSE, as we don't know here whether what HSE is, nor what it's divided by. For more fun, that old 2014 API doesn't have any way of flagging that it failed either. Hooray. --- include/libopencm3/stm32/l1/rcc.h | 2 +- lib/stm32/l1/lcd.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libopencm3/stm32/l1/rcc.h b/include/libopencm3/stm32/l1/rcc.h index b688a34f..cf8a7197 100644 --- a/include/libopencm3/stm32/l1/rcc.h +++ b/include/libopencm3/stm32/l1/rcc.h @@ -430,7 +430,7 @@ #define RCC_CSR_RTCSEL_NONE (0x0) #define RCC_CSR_RTCSEL_LSE (0x1) #define RCC_CSR_RTCSEL_LSI (0x2) -#define RCC_CSR_RTCSEL_HSI (0x3) +#define RCC_CSR_RTCSEL_HSE (0x3) #define RCC_CSR_LSECSSD (1 << 12) #define RCC_CSR_LSECSSON (1 << 11) #define RCC_CSR_LSEBYP (1 << 10) diff --git a/lib/stm32/l1/lcd.c b/lib/stm32/l1/lcd.c index 68173ab8..b013735d 100644 --- a/lib/stm32/l1/lcd.c +++ b/lib/stm32/l1/lcd.c @@ -131,9 +131,9 @@ void lcd_set_refresh_frequency(uint32_t frequency) case RCC_CSR_RTCSEL_LSI: lcd_clock = 37000; break; - case RCC_CSR_RTCSEL_HSI: - lcd_clock = 16000000; - break; + case RCC_CSR_RTCSEL_HSE: + /* no current method of determining clock and divider! */ + return; default: /* RCC Clock not selected */ return;