x
Dependencies: AP3000 ARM_RTC Beep BurstSPI FRAMSPI FT813 I2CEEBlockDevice I2CList MCP79412 NMEA0183 PCA9745B SDBlockDevice SPIFBlockDevice SystemClock WDT nmea_parser
macros.h@0:a3b629f6dab5, 2018-07-23 (annotated)
- Committer:
- JackB
- Date:
- Mon Jul 23 12:32:19 2018 +0000
- Revision:
- 0:a3b629f6dab5
x
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JackB | 0:a3b629f6dab5 | 1 | #define _BV(bit) (1 << (bit)) |
JackB | 0:a3b629f6dab5 | 2 | #define bit(b) (1UL << (b)) |
JackB | 0:a3b629f6dab5 | 3 | |
JackB | 0:a3b629f6dab5 | 4 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) |
JackB | 0:a3b629f6dab5 | 5 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) |
JackB | 0:a3b629f6dab5 | 6 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) |
JackB | 0:a3b629f6dab5 | 7 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) |
JackB | 0:a3b629f6dab5 | 8 | |
JackB | 0:a3b629f6dab5 | 9 | #define lowByte(w) ((uint8_t)((w) & 0xff)) |
JackB | 0:a3b629f6dab5 | 10 | #define highByte(w) ((uint8_t)((w) >> 8)) |
JackB | 0:a3b629f6dab5 | 11 | #define lowWord(w) ((uint16_t)((w) & 0xffff)) |
JackB | 0:a3b629f6dab5 | 12 | #define highWord(w) ((uint16_t)((w) >> 16)) |
JackB | 0:a3b629f6dab5 | 13 | #define bytesToWord(hb, lb) ((uint16_t)((((uint16_t)(hb & 0xFF)) << 8) | ((uint16_t)lb))) |
JackB | 0:a3b629f6dab5 | 14 | #define wordstoDWord(hw, lw) ((uint32_t)((((uint32_t)(hw & 0xFFFF)) << 16) | ((uint32_t)lw))) |
JackB | 0:a3b629f6dab5 | 15 | |
JackB | 0:a3b629f6dab5 | 16 | #define min(a,b) ((a)<(b)?(a):(b)) |
JackB | 0:a3b629f6dab5 | 17 | #define max(a,b) ((a)>(b)?(a):(b)) |
JackB | 0:a3b629f6dab5 | 18 | |
JackB | 0:a3b629f6dab5 | 19 | #define swap(x,y) { x = x + y; y = x - y; x = x - y; } |
JackB | 0:a3b629f6dab5 | 20 | |
JackB | 0:a3b629f6dab5 | 21 | #define abs(value) ((value)>0?(value):(-value)) |
JackB | 0:a3b629f6dab5 | 22 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) |
JackB | 0:a3b629f6dab5 | 23 | |
JackB | 0:a3b629f6dab5 | 24 | #define LV_MATH_ABS(x) ((x)>0?(x):(-(x))) |