native: Fix macros for setting pin mode.

Fixes #184
This commit is contained in:
Gareth McMullin 2017-01-24 10:49:45 +13:00
parent a77fb9ac1b
commit 7ba2987a83
1 changed files with 12 additions and 9 deletions

View File

@ -109,22 +109,25 @@
#define LED_IDLE_RUN LED_1
#define LED_ERROR LED_2
#define TMS_SET_MODE() \
#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);
#define SWDIO_MODE_FLOAT() \
GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN); \
} while(0)
#define SWDIO_MODE_FLOAT() do { \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_INPUT, \
GPIO_CNF_INPUT_FLOAT, SWDIO_PIN); \
gpio_clear(SWDIO_DIR_PORT, SWDIO_DIR_PIN);
#define SWDIO_MODE_DRIVE() \
gpio_clear(SWDIO_DIR_PORT, SWDIO_DIR_PIN); \
} while(0)
#define SWDIO_MODE_DRIVE() do { \
gpio_set(SWDIO_DIR_PORT, SWDIO_DIR_PIN); \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN);
#define UART_PIN_SETUP() \
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN); \
} while(0)
#define UART_PIN_SETUP() do { \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN);
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \
} while(0)
#define USB_DRIVER stm32f103_usb_driver
#define USB_IRQ NVIC_USB_LP_CAN_RX0_IRQ