Fix parenthesis in macros

This commit is contained in:
Mario Hüttel 2020-05-02 19:09:17 +02:00
parent 88062dc8e4
commit e237776810

View File

@ -21,14 +21,14 @@
#ifndef __STM32GPIOMACROS_H__
#define __STM32GPIOMACROS_H__
#define MODER_DELETE(pin) ~(0x3U << (pin * 2))
#define PUPDR_DELETE(pin) ~(0x3U << (pin * 2))
#define OUTPUT(pin) (0x01U << (pin * 2))
#define PULLUP(pin) (0x1U << (pin* 2))
#define ALTFUNC(pin) ((0x2) << (pin * 2))
#define PINMASK(pin) ((0x3) << (pin * 2))
#define SETAF(PORT,PIN,AF) PORT->AFR[(PIN < 8 ? 0 : 1)] |= AF << ((PIN < 8 ? PIN : (PIN - 8)) * 4)
#define ANALOG(pin) (0x03 << (pin * 2))
#define MODER_DELETE(pin) ~(0x3U << ((pin) * 2))
#define PUPDR_DELETE(pin) ~(0x3U << ((pin) * 2))
#define OUTPUT(pin) (0x01U << ((pin) * 2))
#define PULLUP(pin) (0x1U << ((pin)* 2))
#define ALTFUNC(pin) ((0x2) << ((pin) * 2))
#define PINMASK(pin) ((0x3) << ((pin) * 2))
#define SETAF(PORT,PIN,AF) PORT->AFR[((PIN) < 8 ? 0 : 1)] |= AF << (((PIN) < 8 ? (PIN) : ((PIN) - 8)) * 4)
#define ANALOG(pin) (0x03 << ((pin) * 2))
#define OTYP_OPENDRAIN(pin) (0x1U << (pin))
#define BITMASK_TO_BITNO(x) (x&0x1?0:x&0x2?1:x&0x4?2:x&0x8?3: \