Commit 4d9dce77 authored by Krzysztof Blazewicz's avatar Krzysztof Blazewicz
Browse files

stmhal/mphalport.h: use single GPIOx->BSRR register

parent 13400e13
......@@ -57,13 +57,8 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
#define mp_hal_pin_input(p) mp_hal_pin_config((p), MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_NONE, 0)
#define mp_hal_pin_output(p) mp_hal_pin_config((p), MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_NONE, 0)
#define mp_hal_pin_open_drain(p) mp_hal_pin_config((p), MP_HAL_PIN_MODE_OPEN_DRAIN, MP_HAL_PIN_PULL_NONE, 0)
#if defined(MCU_SERIES_F7) || defined(MCU_SERIES_L4)
#define mp_hal_pin_high(p) (((p)->gpio->BSRR) = (p)->pin_mask)
#define mp_hal_pin_low(p) (((p)->gpio->BSRR) = ((p)->pin_mask << 16))
#else
#define mp_hal_pin_high(p) (((p)->gpio->BSRRL) = (p)->pin_mask)
#define mp_hal_pin_low(p) (((p)->gpio->BSRRH) = (p)->pin_mask)
#endif
#define mp_hal_pin_od_low(p) mp_hal_pin_low(p)
#define mp_hal_pin_od_high(p) mp_hal_pin_high(p)
#define mp_hal_pin_read(p) (((p)->gpio->IDR >> (p)->pin) & 1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment