LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iocon_8xx.c File Reference
#include "chip.h"

Go to the source code of this file.

Macros

#define PIN_OFFSET(pin)   (PIN_ADDRESS_OFFSETS[pin])
 
#define PIN_BASE_ADDR   (0x40044000)
 
#define PIN_MODE_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & (3 << 3))
 
#define PIN_MODE_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~(3 << 3))
 
#define PIN_MODE_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 3))
 
#define PIN_HYS_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 5))
 
#define PIN_HYS_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~(1 << 5))
 
#define PIN_HYS_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 5))
 
#define PIN_INV_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 6))
 
#define PIN_INV_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 1 << 6))
 
#define PIN_INV_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 6))
 
#define PIN_OD_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 10))
 
#define PIN_OD_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 1 << 10))
 
#define PIN_OD_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 10))
 
#define PIN_SMODE_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 3 << 11))
 
#define PIN_SMODE_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 3 << 11))
 
#define PIN_SMODE_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 11))
 
#define PIN_CLKDIV_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 7 << 13))
 
#define PIN_CLKDIV_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 7 << 13))
 
#define PIN_CLKDIV_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 13))
 
#define PIN_I2CMODE_GET(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 3 << 8))
 
#define PIN_I2CMODE_CLR(pin)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 3 << 8))
 
#define PIN_I2CMODE_SET(pin, val)   (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 8))
 

Functions

void Chip_IOCON_PinSetMode (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, CHIP_PIN_MODE_T mode)
 Set a function mode (pull-up/pull-down) for a pin.
 
void Chip_IOCON_PinSetHysteresis (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, bool enable)
 Enable or disable the hysteresis for a pin.
 
void Chip_IOCON_PinSetInputInverted (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, bool invert)
 Invert input for a pin.
 
void Chip_IOCON_PinSetOpenDrainMode (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, bool open_drain)
 Sets open-drain mode for a pin.
 
void Chip_IOCON_PinSetSampleMode (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, CHIP_PIN_SMODE_T smode)
 Sets the digital filter sampling mode for a pin.
 
void Chip_IOCON_PinSetClockDivisor (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, CHIP_PIN_CLKDIV_T clkdiv)
 Select peripheral clock divider for input filter sampling clock.
 
void Chip_IOCON_PinSetI2CMode (LPC_IOCON_T *pIOCON, CHIP_PINx_T pin, CHIP_PIN_I2CMODE_T mode)
 Set I2C mode for a pin.
 

Variables

static const uint8_t PIN_ADDRESS_OFFSETS []
 

Macro Definition Documentation

#define PIN_BASE_ADDR   (0x40044000)

Definition at line 71 of file iocon_8xx.c.

#define PIN_CLKDIV_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 7 << 13))

Definition at line 94 of file iocon_8xx.c.

#define PIN_CLKDIV_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 7 << 13))

Definition at line 93 of file iocon_8xx.c.

#define PIN_CLKDIV_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 13))

Definition at line 95 of file iocon_8xx.c.

#define PIN_HYS_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~(1 << 5))

Definition at line 78 of file iocon_8xx.c.

#define PIN_HYS_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 5))

Definition at line 77 of file iocon_8xx.c.

#define PIN_HYS_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 5))

Definition at line 79 of file iocon_8xx.c.

#define PIN_I2CMODE_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 3 << 8))

Definition at line 98 of file iocon_8xx.c.

#define PIN_I2CMODE_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 3 << 8))

Definition at line 97 of file iocon_8xx.c.

#define PIN_I2CMODE_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 8))

Definition at line 99 of file iocon_8xx.c.

#define PIN_INV_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 1 << 6))

Definition at line 82 of file iocon_8xx.c.

#define PIN_INV_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 6))

Definition at line 81 of file iocon_8xx.c.

#define PIN_INV_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 6))

Definition at line 83 of file iocon_8xx.c.

#define PIN_MODE_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~(3 << 3))

Definition at line 74 of file iocon_8xx.c.

#define PIN_MODE_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & (3 << 3))

Definition at line 73 of file iocon_8xx.c.

#define PIN_MODE_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 3))

Definition at line 75 of file iocon_8xx.c.

#define PIN_OD_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 1 << 10))

Definition at line 86 of file iocon_8xx.c.

#define PIN_OD_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 1 << 10))

Definition at line 85 of file iocon_8xx.c.

#define PIN_OD_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 10))

Definition at line 87 of file iocon_8xx.c.

#define PIN_OFFSET (   pin)    (PIN_ADDRESS_OFFSETS[pin])

Definition at line 69 of file iocon_8xx.c.

#define PIN_SMODE_CLR (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) &= ~( 3 << 11))

Definition at line 90 of file iocon_8xx.c.

#define PIN_SMODE_GET (   pin)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) & ( 3 << 11))

Definition at line 89 of file iocon_8xx.c.

#define PIN_SMODE_SET (   pin,
  val 
)    (*(volatile uint32_t *) (PIN_BASE_ADDR + PIN_OFFSET(pin)) |= (val << 11))

Definition at line 91 of file iocon_8xx.c.

Variable Documentation

const uint8_t PIN_ADDRESS_OFFSETS[]
static
Initial value:
= {0x44,
0x2C,
0x18,
0x14,
0x10,
0x0C
,
0x40,
0x3C,
0x38,
0x34,
0x20,
0x1C,
0x08,
0x04
,
0x48,
0x28,
0x24,
0x00
}

Definition at line 41 of file iocon_8xx.c.