rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
Pin configuration

Macros

#define RFLPC_PIN_MAKE(port, pin)   ((port) << 5 | (pin))
 Can be used to create a rflpc_pin_t from a port index and a pin index.
 
#define RFLPC_PIN_GET_PORT(pin)   (((pin) >> 5) & 0x7)
 Returns the X part of the PX_Y form pin description (i.e. More...
 
#define RFLPC_PIN_GET_PIN(pin)   ((pin) & 0x1F)
 Returns the Y part of the PX_Y form pin description (i.e. More...
 

Typedefs

typedef uint8_t rflpc_pin_t
 Represents a pin. More...
 

Enumerations

enum  {
  RFLPC_PIN_P0_0,
  RFLPC_PIN_P0_1,
  RFLPC_PIN_P0_2,
  RFLPC_PIN_P0_3,
  RFLPC_PIN_P0_4,
  RFLPC_PIN_P0_5,
  RFLPC_PIN_P0_6,
  RFLPC_PIN_P0_7,
  RFLPC_PIN_P0_8,
  RFLPC_PIN_P0_9,
  RFLPC_PIN_P0_10,
  RFLPC_PIN_P0_11,
  RFLPC_PIN_P0_12,
  RFLPC_PIN_P0_13,
  RFLPC_PIN_P0_14,
  RFLPC_PIN_P0_15,
  RFLPC_PIN_P0_16,
  RFLPC_PIN_P0_17,
  RFLPC_PIN_P0_18,
  RFLPC_PIN_P0_19,
  RFLPC_PIN_P0_20,
  RFLPC_PIN_P0_21,
  RFLPC_PIN_P0_22,
  RFLPC_PIN_P0_23,
  RFLPC_PIN_P0_24,
  RFLPC_PIN_P0_25,
  RFLPC_PIN_P0_26,
  RFLPC_PIN_P0_27,
  RFLPC_PIN_P0_28,
  RFLPC_PIN_P0_29,
  RFLPC_PIN_P0_30,
  RFLPC_PIN_P0_31,
  RFLPC_PIN_P1_0 = RFLPC_PIN_MAKE(1,0),
  RFLPC_PIN_P1_1,
  RFLPC_PIN_P1_2,
  RFLPC_PIN_P1_3,
  RFLPC_PIN_P1_4,
  RFLPC_PIN_P1_5,
  RFLPC_PIN_P1_6,
  RFLPC_PIN_P1_7,
  RFLPC_PIN_P1_8,
  RFLPC_PIN_P1_9,
  RFLPC_PIN_P1_10,
  RFLPC_PIN_P1_11,
  RFLPC_PIN_P1_12,
  RFLPC_PIN_P1_13,
  RFLPC_PIN_P1_14,
  RFLPC_PIN_P1_15,
  RFLPC_PIN_P1_16,
  RFLPC_PIN_P1_17,
  RFLPC_PIN_P1_18,
  RFLPC_PIN_P1_19,
  RFLPC_PIN_P1_20,
  RFLPC_PIN_P1_21,
  RFLPC_PIN_P1_22,
  RFLPC_PIN_P1_23,
  RFLPC_PIN_P1_24,
  RFLPC_PIN_P1_25,
  RFLPC_PIN_P1_26,
  RFLPC_PIN_P1_27,
  RFLPC_PIN_P1_28,
  RFLPC_PIN_P1_29,
  RFLPC_PIN_P1_30,
  RFLPC_PIN_P1_31,
  RFLPC_PIN_P2_0 = RFLPC_PIN_MAKE(2,0),
  RFLPC_PIN_P2_1,
  RFLPC_PIN_P2_2,
  RFLPC_PIN_P2_3,
  RFLPC_PIN_P2_4,
  RFLPC_PIN_P2_5,
  RFLPC_PIN_P2_6,
  RFLPC_PIN_P2_7,
  RFLPC_PIN_P2_8,
  RFLPC_PIN_P2_9,
  RFLPC_PIN_P2_10,
  RFLPC_PIN_P2_11,
  RFLPC_PIN_P2_12,
  RFLPC_PIN_P2_13,
  RFLPC_PIN_P3_25 = RFLPC_PIN_MAKE(3,25),
  RFLPC_PIN_P3_26,
  RFLPC_PIN_P4_28 = RFLPC_PIN_MAKE(4,28),
  RFLPC_PIN_P4_29
}
 Shortcuts macro for all pins.
 
enum  rflpc_pin_mode_t {
  RFLPC_PIN_MODE_RESISTOR_PULL_UP,
  RFLPC_PIN_MODE_REPEATER,
  RFLPC_PIN_MODE_RESISTOR_NONE,
  RFLPC_PIN_MODE_RESISTOR_PULL_DOWN
}
 Pin mode. More...
 

Functions

void rflpc_pin_set (rflpc_pin_t pin, int function, rflpc_pin_mode_t mode, int opendrain)
 Sets the operational mode for a given pin on a given port. More...
 

Detailed Description

Macro Definition Documentation

#define RFLPC_PIN_GET_PIN (   pin)    ((pin) & 0x1F)

Returns the Y part of the PX_Y form pin description (i.e.

the PIN number of a gpio port)

Definition at line 52 of file pinconf.h.

#define RFLPC_PIN_GET_PORT (   pin)    (((pin) >> 5) & 0x7)

Returns the X part of the PX_Y form pin description (i.e.

GPIO PORT)

Definition at line 50 of file pinconf.h.

Referenced by rflpc_led_clr(), rflpc_led_set(), and rflpc_led_val().

Typedef Documentation

typedef uint8_t rflpc_pin_t

Represents a pin.

The 3 MSB represents the port The 5 LSB bits reprensent the pin

i.e. To use pin 2.3, set the value to (2 << 5 | 3)

Definition at line 44 of file pinconf.h.

Enumeration Type Documentation

Pin mode.

Affects the behavior only if the pin is used as input

Enumerator
RFLPC_PIN_MODE_RESISTOR_PULL_UP 

The pin has pull-up resistor enabled.

RFLPC_PIN_MODE_REPEATER 

The pin has repeater mode enabled.

RFLPC_PIN_MODE_RESISTOR_NONE 

The pin has neither pull-up nor pull-down.

RFLPC_PIN_MODE_RESISTOR_PULL_DOWN 

The pin has pull-down resistor enabled.

Definition at line 156 of file pinconf.h.

Function Documentation

void rflpc_pin_set ( rflpc_pin_t  pin,
int  function,
rflpc_pin_mode_t  mode,
int  opendrain 
)

Sets the operational mode for a given pin on a given port.

Note
See the LPC17xx user manual to get a description of functions as the functions are dependent on the pin
Parameters
pinThe pin
functionHow the pin is used (0..3).
modeThe pin mode (see rflpc_pin_mode_t)
opendrainControl the open drain mode for pins used as output. 0 for normal mode (no open drain), 1 for open drain.