Skip to content

Commit aa442f2

Browse files
Add new UART/USART/LPUART initialization variants needed for STM32U5
1 parent 1bf7f55 commit aa442f2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

source/chip/STM32/peripherals/USARTv2/STM32-USARTv2-ChipUartLowLevel.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ const ChipUartLowLevel::Parameters ChipUartLowLevel::uart5Parameters {UART5_BASE
345345
#if defined(RCC_APB1ENR_LPUART1EN)
346346
const ChipUartLowLevel::Parameters ChipUartLowLevel::lpuart1Parameters {LPUART1_BASE, offsetof(RCC_TypeDef, APB1ENR),
347347
RCC_APB1ENR_LPUART1EN, offsetof(RCC_TypeDef, APB1RSTR), RCC_APB1RSTR_LPUART1RST};
348+
#elif defined(RCC_APB3ENR_LPUART1EN)
349+
const ChipUartLowLevel::Parameters ChipUartLowLevel::lpuart1Parameters {LPUART1_BASE, offsetof(RCC_TypeDef, APB3ENR),
350+
RCC_APB3ENR_LPUART1EN, offsetof(RCC_TypeDef, APB3RSTR), RCC_APB3RSTR_LPUART1RST};
348351
#elif defined(RCC_APBENR1_LPUART1EN)
349352
const ChipUartLowLevel::Parameters ChipUartLowLevel::lpuart1Parameters {LPUART1_BASE, offsetof(RCC_TypeDef, APBENR1),
350353
RCC_APBENR1_LPUART1EN, offsetof(RCC_TypeDef, APBRSTR1), RCC_APBRSTR1_LPUART1RST};
@@ -374,6 +377,9 @@ const ChipUartLowLevel::Parameters ChipUartLowLevel::usart1Parameters {USART1_BA
374377
#if defined(RCC_APB1ENR_USART2EN)
375378
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart2Parameters {USART2_BASE, offsetof(RCC_TypeDef, APB1ENR),
376379
RCC_APB1ENR_USART2EN, offsetof(RCC_TypeDef, APB1RSTR), RCC_APB1RSTR_USART2RST};
380+
#elif defined(RCC_APB1ENR1_USART2EN)
381+
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart2Parameters {USART2_BASE, offsetof(RCC_TypeDef, APB1ENR1),
382+
RCC_APB1ENR1_USART2EN, offsetof(RCC_TypeDef, APB1RSTR1), RCC_APB1RSTR1_USART2RST};
377383
#elif defined(RCC_APBENR1_USART2EN)
378384
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart2Parameters {USART2_BASE, offsetof(RCC_TypeDef, APBENR1),
379385
RCC_APBENR1_USART2EN, offsetof(RCC_TypeDef, APBRSTR1), RCC_APBRSTR1_USART2RST};
@@ -386,6 +392,9 @@ const ChipUartLowLevel::Parameters ChipUartLowLevel::usart2Parameters {USART2_BA
386392
#if defined(RCC_APB1ENR_USART3EN)
387393
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart3Parameters {USART3_BASE, offsetof(RCC_TypeDef, APB1ENR),
388394
RCC_APB1ENR_USART3EN, offsetof(RCC_TypeDef, APB1RSTR), RCC_APB1RSTR_USART3RST};
395+
#elif defined(RCC_APB1ENR1_USART3EN)
396+
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart3Parameters {USART3_BASE, offsetof(RCC_TypeDef, APB1ENR1),
397+
RCC_APB1ENR1_USART3EN, offsetof(RCC_TypeDef, APB1RSTR1), RCC_APB1RSTR1_USART3RST};
389398
#elif defined(RCC_APBENR1_USART3EN)
390399
const ChipUartLowLevel::Parameters ChipUartLowLevel::usart3Parameters {USART3_BASE, offsetof(RCC_TypeDef, APBENR1),
391400
RCC_APBENR1_USART3EN, offsetof(RCC_TypeDef, APBRSTR1), RCC_APBRSTR1_USART3RST};
@@ -395,8 +404,15 @@ const ChipUartLowLevel::Parameters ChipUartLowLevel::usart3Parameters {USART3_BA
395404
#endif // def DISTORTOS_CHIP_USART3_ENABLE
396405

397406
#ifdef DISTORTOS_CHIP_UART4_ENABLE
407+
#if defined(RCC_APB1ENR_UART4EN)
398408
const ChipUartLowLevel::Parameters ChipUartLowLevel::uart4Parameters {UART4_BASE, offsetof(RCC_TypeDef, APB1ENR),
399409
RCC_APB1ENR_UART4EN, offsetof(RCC_TypeDef, APB1RSTR), RCC_APB1RSTR_UART4RST};
410+
#elif defined(RCC_APB1ENR1_UART4EN)
411+
const ChipUartLowLevel::Parameters ChipUartLowLevel::uart4Parameters {UART4_BASE, offsetof(RCC_TypeDef, APB1ENR1),
412+
RCC_APB1ENR1_UART4EN, offsetof(RCC_TypeDef, APB1RSTR1), RCC_APB1RSTR1_UART4RST};
413+
#else
414+
#error "Unsupported UART4 variant!"
415+
#endif
400416
#endif // def DISTORTOS_CHIP_UART4_ENABLE
401417

402418
#ifdef DISTORTOS_CHIP_USART4_ENABLE
@@ -412,8 +428,15 @@ const ChipUartLowLevel::Parameters ChipUartLowLevel::usart4Parameters {USART4_BA
412428
#endif // def DISTORTOS_CHIP_USART4_ENABLE
413429

414430
#ifdef DISTORTOS_CHIP_UART5_ENABLE
431+
#if defined(RCC_APB1ENR_UART5EN)
415432
const ChipUartLowLevel::Parameters ChipUartLowLevel::uart5Parameters {UART5_BASE, offsetof(RCC_TypeDef, APB1ENR),
416433
RCC_APB1ENR_UART5EN, offsetof(RCC_TypeDef, APB1RSTR), RCC_APB1RSTR_UART5RST};
434+
#elif defined(RCC_APB1ENR1_UART5EN)
435+
const ChipUartLowLevel::Parameters ChipUartLowLevel::uart5Parameters {UART5_BASE, offsetof(RCC_TypeDef, APB1ENR1),
436+
RCC_APB1ENR1_UART5EN, offsetof(RCC_TypeDef, APB1RSTR1), RCC_APB1RSTR1_UART5RST};
437+
#else
438+
#error "Unsupported UART5 variant!"
439+
#endif
417440
#endif // def DISTORTOS_CHIP_UART5_ENABLE
418441

419442
#ifdef DISTORTOS_CHIP_USART5_ENABLE

0 commit comments

Comments
 (0)