![](/media/cache/profiles/8b649862360f1c2b5ccee333c282b1d4.jpg.50x50_q85.jpg)
x
Dependencies: AP3000 ARM_RTC Beep BurstSPI FRAMSPI FT813 I2CEEBlockDevice I2CList MCP79412 NMEA0183 PCA9745B SDBlockDevice SPIFBlockDevice SystemClock WDT nmea_parser
Diff: macros.h
- Revision:
- 0:a3b629f6dab5
diff -r 000000000000 -r a3b629f6dab5 macros.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.h Mon Jul 23 12:32:19 2018 +0000 @@ -0,0 +1,24 @@ +#define _BV(bit) (1 << (bit)) +#define bit(b) (1UL << (b)) + +#define bitRead(value, bit) (((value) >> (bit)) & 0x01) +#define bitSet(value, bit) ((value) |= (1UL << (bit))) +#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) +#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) + +#define lowByte(w) ((uint8_t)((w) & 0xff)) +#define highByte(w) ((uint8_t)((w) >> 8)) +#define lowWord(w) ((uint16_t)((w) & 0xffff)) +#define highWord(w) ((uint16_t)((w) >> 16)) +#define bytesToWord(hb, lb) ((uint16_t)((((uint16_t)(hb & 0xFF)) << 8) | ((uint16_t)lb))) +#define wordstoDWord(hw, lw) ((uint32_t)((((uint32_t)(hw & 0xFFFF)) << 16) | ((uint32_t)lw))) + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) + +#define swap(x,y) { x = x + y; y = x - y; x = x - y; } + +#define abs(value) ((value)>0?(value):(-value)) +#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) + +#define LV_MATH_ABS(x) ((x)>0?(x):(-(x)))