tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Macros

#define BIT_(n)   (1U << (n))
 n-th Bit
 
#define BIT_SET_(x, n)   ( (x) | BIT_(n) )
 set n-th bit of x to 1
 
#define BIT_CLR_(x, n)   ( (x) & (~BIT_(n)) )
 clear n-th bit of x
 
#define BIT_TEST_(x, n)   ( ((x) & BIT_(n)) ? true : false )
 check if n-th bit of x is 1
 
#define _B8__(x)
 
#define BIN8(d)   ((uint8_t) _B8__(0x##d##UL))
 
#define BIN16(dmsb, dlsb)   (((uint16_t)BIN8(dmsb)<<8) + BIN8(dlsb))
 
#define BIN32(dmsb, db2, db3, dlsb)
 

Functions

static uint32_t bit_set (uint32_t value, uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE
 
static uint32_t bit_clear (uint32_t value, uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE
 
static bool bit_test (uint32_t value, uint8_t n)
 create a mask with n-bit lsb set to 1
 
static uint32_t bit_mask (uint8_t n) ATTR_CONST ATTR_ALWAYS_INLINE
 
static uint32_t bit_mask_range (uint8_t start, uint32_t end) ATTR_CONST ATTR_ALWAYS_INLINE
 
static uint32_t bit_set_range (uint32_t value, uint8_t start, uint8_t end, uint32_t pattern) ATTR_CONST ATTR_ALWAYS_INLINE
 

Detailed Description

Macro Definition Documentation

#define _B8__ (   x)
Value:
(((x&0x0000000FUL)?1:0) \
+((x&0x000000F0UL)?2:0) \
+((x&0x00000F00UL)?4:0) \
+((x&0x0000F000UL)?8:0) \
+((x&0x000F0000UL)?16:0) \
+((x&0x00F00000UL)?32:0) \
+((x&0x0F000000UL)?64:0) \
+((x&0xF0000000UL)?128:0))

Definition at line 107 of file binary.h.

#define BIN32 (   dmsb,
  db2,
  db3,
  dlsb 
)
Value:
(((uint32_t)BIN8(dmsb)<<24) \
+ ((uint32_t)BIN8(db2)<<16) \
+ ((uint32_t)BIN8(db3)<<8) \
+ BIN8(dlsb))

Definition at line 118 of file binary.h.