Skip to content

Commit

Permalink
stlink: replace odr register for the isol variant
Browse files Browse the repository at this point in the history
  • Loading branch information
HrMitrev authored and dragonmux committed Jan 25, 2024
1 parent 74e14c3 commit c0bf9e4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/platforms/stlink/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,20 @@ extern bool debug_bmp;
#define SWD_CR GPIO_CRH(SWDIO_PORT)
#define SWD_CR_MULT (1U << ((14U - 8U) << 2U))

#define SWDIODIR_ODR GPIO_ODR(GPIOA)
#define SWDIODIR_BSRR GPIO_BSRR(GPIOA)
#define SWDIODIR_BRR GPIO_BRR(GPIOA)

#define TMS_SET_MODE() gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN);

#ifdef STLINK_V2_ISOL
/* The ISOL variant floats SWDIO with GPIO A1 */
#define SWDIO_MODE_FLOAT() \
do { \
SWDIODIR_ODR |= (GPIO1); \
#define SWDIO_MODE_FLOAT() \
do { \
SWDIODIR_BSRR = GPIO1; \
} while (0)
#define SWDIO_MODE_DRIVE() \
do { \
SWDIODIR_ODR &= ~(GPIO1); \
#define SWDIO_MODE_DRIVE() \
do { \
SWDIODIR_BRR = GPIO1; \
} while (0)
#else
/* All other variants just set SWDIO_PIN to floating */
Expand Down

0 comments on commit c0bf9e4

Please sign in to comment.