native: Reformatted the TMS and SWDIO macros in the platform header

This commit is contained in:
dragonmux 2022-08-09 02:19:23 +01:00 committed by Piotr Esden-Tempski
parent 4ca3982599
commit 1890426669
1 changed files with 29 additions and 28 deletions

View File

@ -192,13 +192,14 @@ int usbuart_debug_write(const char *buf, size_t len);
#define SWD_CR GPIO_CRL(SWDIO_PORT)
#define SWD_CR_SHIFT (4U << 2U)
#define TMS_SET_MODE() do { \
#define TMS_SET_MODE() \
do { \
gpio_set(TMS_DIR_PORT, TMS_DIR_PIN); \
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN); \
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN); \
} while (0)
#define SWDIO_MODE_FLOAT() do { \
#define SWDIO_MODE_FLOAT() \
do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xfU << SWD_CR_SHIFT); \
cr |= (0x4U << SWD_CR_SHIFT); \
@ -206,7 +207,8 @@ int usbuart_debug_write(const char *buf, size_t len);
SWD_CR = cr; \
} while (0)
#define SWDIO_MODE_DRIVE() do { \
#define SWDIO_MODE_DRIVE() \
do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xfU << SWD_CR_SHIFT); \
cr |= (0x1U << SWD_CR_SHIFT); \
@ -214,11 +216,10 @@ int usbuart_debug_write(const char *buf, size_t len);
SWD_CR = cr; \
} while (0)
#define UART_PIN_SETUP() do { \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_INPUT, \
GPIO_CNF_INPUT_PULL_UPDOWN, USBUSART_RX_PIN); \
#define UART_PIN_SETUP() \
do { \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USBUSART_RX_PIN); \
gpio_set(USBUSART_PORT, USBUSART_RX_PIN); \
} while (0)