rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
tools.h File Reference

Macro tools for easy implementation of other macros. More...

Go to the source code of this file.

Macros

#define TOKEN_PASTE2(x, y)   x ## y
 Concatenate two tokens together.
 
#define TOKEN_PASTE(x, y)   TOKEN_PASTE2(x, y)
 This macro allows concatenation of tokens even in recursive macro.
 
#define RFLPC_SET_BIT(val, bit)   (val) |= (1UL << (bit))
 Sets a given bit to 1.
 
#define RFLPC_CLR_BIT(val, bit)   (val) &= ~(1UL << (bit))
 Clears a given bit to 0.
 
#define RFLPC_SET_BITS_VAL(val, bit_pos, bit_val, bit_count)
 Sets some bits values from the position of the LSB bit and the number of bits to set. More...
 
#define rflpc_idle   asm volatile ("wfi")
 Switch the CM3 to wait for interrupt mode (wfi asm instruction). More...
 

Detailed Description

Macro tools for easy implementation of other macros.

Definition in file tools.h.

Macro Definition Documentation

#define rflpc_idle   asm volatile ("wfi")

Switch the CM3 to wait for interrupt mode (wfi asm instruction).

This allow the CM3 to 'sleep' while waiting for interrupt instead waiting with a b .

Definition at line 55 of file tools.h.

#define RFLPC_SET_BITS_VAL (   val,
  bit_pos,
  bit_val,
  bit_count 
)
Value:
do { \
uint32_t mask = ((1 << (bit_count)) - 1) << (bit_pos); \
/* Clear bits */ \
(val) &= ~mask; \
(val) |= ((bit_val) << (bit_pos)) & mask; \
} while(0)

Sets some bits values from the position of the LSB bit and the number of bits to set.

The bit_val is the values of the bits BEFORE shift

Definition at line 45 of file tools.h.

Referenced by rflpc_adc_sample(), and rflpc_dac_write().