🔧 Some STM32 UART Sanity Checks (#24795)

This commit is contained in:
ellensp
2022-10-20 15:23:22 +13:00
committed by Scott Lahteine
parent 682a9b6fbe
commit 4d9bf91edc
6 changed files with 187 additions and 29 deletions

View File

@ -50,3 +50,62 @@
#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx)
#error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
#endif
/**
* Check for common serial pin conflicts
*/
#define _CHECK_SERIAL_PIN(N) (( \
BTN_EN1 == N || DOGLCD_CS == N || HEATER_BED_PIN == N || FAN_PIN == N || \
SDIO_D2_PIN == N || SDIO_D3_PIN == N || SDIO_CK_PIN == N || SDIO_CMD_PIN == N \
))
#define CHECK_SERIAL_PIN(T,N) defined(UART##N##_##T##_PIN) && _CHECK_SERIAL_PIN(UART##N##_##T##_PIN)
#if SERIAL_IN_USE(1)
#if CHECK_SERIAL_PIN(TX,1)
#error "Serial Port 1 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,1)
#error "Serial Port 1 RX IO pins conflict with another pin on the board."
#endif
#endif
#if SERIAL_IN_USE(2)
#if CHECK_SERIAL_PIN(TX,2)
#error "Serial Port 2 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,2)
#error "Serial Port 2 RX IO pins conflict with another pin on the board."
#endif
#endif
#if SERIAL_IN_USE(3)
#if CHECK_SERIAL_PIN(TX,3)
#error "Serial Port 3 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,3)
#error "Serial Port 3 RX IO pins conflict with another pin on the board."
#endif
#endif
#if SERIAL_IN_USE(4)
#if CHECK_SERIAL_PIN(TX,4)
#error "Serial Port 4 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,4)
#error "Serial Port 4 RX IO pins conflict with another pin on the board."
#endif
#endif
#if SERIAL_IN_USE(5)
#if CHECK_SERIAL_PIN(TX,5)
#error "Serial Port 5 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,5)
#error "Serial Port 5 RX IO pins conflict with another pin on the board."
#endif
#endif
#if SERIAL_IN_USE(6)
#if CHECK_SERIAL_PIN(TX,6)
#error "Serial Port 6 TX IO pins conflict with another pin on the board."
#endif
#if CHECK_SERIAL_PIN(RX,6)
#error "Serial Port 6 RX IO pins conflict with another pin on the board."
#endif
#endif
#undef CHECK_SERIAL_PIN
#undef _CHECK_SERIAL_PIN