| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Macros | Typedefs | Functions
Common Utility Headers - LPCUSBlib/Common/Common.h
LPCUSBlib

## Detailed Description

Common library convenience headers, macros and functions.

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

## Modules
| Compiler Specific Definitions
| Compiler specific definitions for code optimization and correctness.
| Endianness and Byte Ordering
| Convenience macros and functions relating to byte (re-)ordering.
| Function/Variable Attributes
| Special function/variable attribute macros.
| Global Interrupt Macros
| Convenience macros for the management of interrupts globally within the device.

## Macros
#define | MACROS do
#define | MACROE while (0)
#define | MAX(x, y) (((x) > (y)) ? (x) : (y))
#define | MIN(x, y) (((x) < (y)) ? (x) : (y))
#define | STRINGIFY(x) #x
#define | STRINGIFY_EXPANDED(x) STRINGIFY(x)

## Typedefs
typedef MACHINE_REG_t | uint_reg_t

## Functions
static uint8_t | BitReverse (uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST
static PRAGMA_ALWAYS_INLINE void | Delay_MS (uint16_t Milliseconds) ATTR_ALWAYS_INLINE

## Macro Definition 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).

Definition at line 109 of file Common.h.

#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).

Definition at line 102 of file Common.h.

#define MAX | ( |  | x,
|  |  | y
| ) |  | (((x) > (y)) ? (x) : (y))

Convenience macro to determine the larger of two values.

Note
  This macro should only be used with operands that do not have side effects from being evaluated multiple times.

Parameters

  x | First value to compare
  y | First value to compare

Returns
  The larger of the two input parameters

Definition at line 122 of file Common.h.

#define MIN | ( |  | x,
|  |  | y
| ) |  | (((x) < (y)) ? (x) : (y))

Convenience macro to determine the smaller of two values.

Note
  This macro should only be used with operands that do not have side effects from being evaluated multiple times.

Parameters

  x | First value to compare
  y | First value to compare

Returns
  The smaller of the two input parameters

Definition at line 136 of file Common.h.

#define STRINGIFY | ( |  | x | ) | #x

Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation marks around the input, converting the source into a string literal.

Parameters

  x | Input to convert into a string literal.

Returns
  String version of the input.

Definition at line 147 of file Common.h.

#define STRINGIFY_EXPANDED | ( |  | x | ) | STRINGIFY(x)

Converts the given input into a string after macro expansion, via the C Preprocessor. This macro puts literal quotation marks around the expanded input, converting the source into a string literal.

Parameters

  x | Input to expand and convert into a string literal.

Returns
  String version of the expanded input.

Definition at line 156 of file Common.h.

## Typedef Documentation

typedef MACHINE_REG_t uint_reg_t

Type define for an unsigned integer the same width as the selected architecture's machine register. This is distinct from the non-specific standard int data type, whose width is machine dependant but which may not reflect the actual machine register width on some targets (e.g. LPC).

Definition at line 84 of file Common.h.

## Function Documentation

static uint8_t BitReverse | ( | uint8_t | Byte | ) |
| inline static

Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1, etc.

Parameters

  Byte | Byte of data whose bits are to be reversed.

Definition at line 166 of file Common.h.

static void Delay_MS | ( | uint16_t | Milliseconds | ) |
| inline static

Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations may be slightly higher.

Parameters

  Milliseconds | Number of milliseconds to delay

Definition at line 183 of file Common.h.