Skip to content

Commit 4c29451

Browse files
committed
STM32G0: USART3_4_LPUART1_IRQn compilation issue with G070xx
1 parent 9b8492b commit 4c29451

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

targets/TARGET_STM/TARGET_STM32G0/serial_device.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,32 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
129129

130130
#if defined(USART3_BASE)
131131
if (obj_s->uart == UART_3) {
132+
#if defined(LPUART1_BASE)
132133
irq_n = USART3_4_LPUART1_IRQn;
134+
#else
135+
irq_n = USART3_4_IRQn;
136+
#endif
133137
vector = (uint32_t)&uart3_irq;
134138
}
135139
#endif
136140

137141
#if defined(USART4_BASE)
138142
if (obj_s->uart == UART_4) {
143+
#if defined(LPUART1_BASE)
139144
irq_n = USART3_4_LPUART1_IRQn;
145+
#else
146+
irq_n = USART3_4_IRQn;
147+
#endif
140148
vector = (uint32_t)&uart4_irq;
141149
}
142150
#endif
143151

144152
#if defined(LPUART1_BASE)
145153
if (obj_s->uart == LPUART_1) {
146-
#if defined(STM32G031xx)
147-
irq_n = LPUART1_IRQn;
148-
#else
154+
#if defined(USART3_BASE)
149155
irq_n = USART3_4_LPUART1_IRQn;
156+
#else
157+
irq_n = LPUART1_IRQn;
150158
#endif
151159
vector = (uint32_t)&lpuart1_irq;
152160
}
@@ -326,21 +334,29 @@ static IRQn_Type serial_get_irq_n(UARTName uart_name)
326334
#endif
327335
#if defined(USART3_BASE)
328336
case UART_3:
337+
#if defined(LPUART1_BASE)
329338
irq_n = USART3_4_LPUART1_IRQn;
339+
#else
340+
irq_n = USART3_4_IRQn;
341+
#endif
330342
break;
331343
#endif
332344
#if defined(USART4_BASE)
333345
case UART_4:
346+
#if defined(LPUART1_BASE)
334347
irq_n = USART3_4_LPUART1_IRQn;
348+
#else
349+
irq_n = USART3_4_IRQn;
350+
#endif
335351
break;
336352
#endif
337353

338354
#if defined(LPUART1_BASE)
339355
case LPUART_1:
340-
#if defined(STM32G031xx)
341-
irq_n = LPUART1_IRQn;
342-
#else
356+
#if defined(USART3_BASE)
343357
irq_n = USART3_4_LPUART1_IRQn;
358+
#else
359+
irq_n = LPUART1_IRQn;
344360
#endif
345361
break;
346362
#endif

0 commit comments

Comments
 (0)