Modules | Defines

Common Utility Headers - LUFA/Drivers/Common/Common.h

Modules

 Function/Variable Attributes
 Board Types
 Debugging Macros
 Endian and Bit Macros

Defines

#define MACROS   do
#define MACROE   while (0)
#define pgm_read_ptr(Addr)   (void*)pgm_read_word(Addr)
#define SWAPENDIAN_16(x)   ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
#define SWAPENDIAN_32(x)

Detailed Description

Common utility headers containing macros, functions, enums and types which are common to all aspects of the library.


Define Documentation

#define MACROE   while (0)

Macro for encasing other multi-statement macros. This should be used along with a preceding closing brace at the end of any multi-statement macro, so that the macros contents as a whole are treated as a discrete block and not as a list of separate statements which may cause problems when used as a block (such as inline IF statements).

#define MACROS   do

Macro for encasing other multi-statement macros. This should be used along with an opening brace before the start of any multi-statement macro, so that the macros contents as a whole are treated as a discrete block and not as a list of separate statements which may cause problems when used as a block (such as inline IF statements).

#define pgm_read_ptr (   Addr  )     (void*)pgm_read_word(Addr)

Reads a pointer out of PROGMEM space. This is currently a wrapper for the avr-libc pgm_read_ptr() macro with a void* cast, so that its value can be assigned directly to a pointer variable or used in pointer arithmetic without further casting in C. In a future avr-libc distribution this will be part of the standard API and will be implemented in a more formal manner.

Parameters:
[in] Addr Address of the pointer to read.
Returns:
Pointer retrieved from PROGMEM space.
#define SWAPENDIAN_16 (   x  )     ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))

Swaps the byte ordering of a 16-bit value at compile time. Do not use this macro for swapping byte orderings of dynamic values computed at runtime, use SwapEndian_16() instead. The result of this macro can be used inside struct or other variable initializers outside of a function, something that is not possible with the inline function variant.

Parameters:
[in] x 16-bit value whose byte ordering is to be swapped.
Returns:
Input value with the byte ordering reversed.
#define SWAPENDIAN_32 (   x  ) 
Value:
((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \
                                               (((x) & 0x0000FF00UL) << 8UL)  | (((x) & 0x000000FFUL) << 24UL))

Swaps the byte ordering of a 32-bit value at compile time. Do not use this macro for swapping byte orderings of dynamic values computed at runtime- use SwapEndian_32() instead. The result of this macro can be used inside struct or other variable initializers outside of a function, something that is not possible with the inline function variant.

Parameters:
[in] x 32-bit value whose byte ordering is to be swapped.
Returns:
Input value with the byte ordering reversed.