Skip to content

Commit

Permalink
Fix macro for non LPUART boards
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Jan 19, 2023
1 parent 606ba75 commit 3083184
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/io/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,20 @@ extern const serialPortIdentifier_e serialPortIdentifiers[SERIAL_PORT_COUNT];

#define SOFTSERIAL_PORT_IDENTIFIER_TO_INDEX(x) ((x) - SERIAL_PORT_SOFTSERIAL1)

#if defined(USE_LPUART1)

#define SERIAL_PORT_IDENTIFIER_TO_INDEX(x) \
(((x) <= SERIAL_PORT_USART_MAX) ? ((x) - SERIAL_PORT_USART1) : ((x) - SERIAL_PORT_LPUART1) + LPUARTDEV_1)

#define SERIAL_PORT_IDENTIFIER_TO_UARTDEV(x) \
(((x) <= SERIAL_PORT_USART_MAX) ? ((x) - SERIAL_PORT_USART1 + UARTDEV_1) : ((x) - SERIAL_PORT_LPUART1) + LPUARTDEV_1)

#else

#define SERIAL_PORT_IDENTIFIER_TO_INDEX(x) ((x) - SERIAL_PORT_USART1)
#define SERIAL_PORT_IDENTIFIER_TO_UARTDEV(x) ((x) - SERIAL_PORT_USART1 + UARTDEV_1)

#endif

//
// runtime
//
Expand Down

0 comments on commit 3083184

Please sign in to comment.