LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CHIP: LPC18xx/43xx SCU Driver (configures pin functions)

Data Structures

struct  LPC_SCU_Type
 System Control Unit register block. More...
 

Macros

#define PORT_OFFSET   0x80
 
#define PIN_OFFSET   0x04
 
#define MD_PUP   (0x0 << 3)
 
#define MD_BUK   (0x1 << 3)
 
#define MD_PLN   (0x2 << 3)
 
#define MD_PDN   (0x3 << 3)
 
#define MD_EHS   (0x1 << 5)
 
#define MD_EZI   (0x1 << 6)
 
#define MD_ZI   (0x1 << 7)
 
#define MD_EHD0   (0x1 << 8)
 
#define MD_EHD1   (0x1 << 8)
 
#define MD_PLN_FAST   (MD_PLN | MD_EZI | MD_ZI | MD_EHS)
 
#define I2C0_STANDARD_FAST_MODE   (1 << 3 | 1 << 11)
 
#define I2C0_FAST_MODE_PLUS   (2 << 1 | 1 << 3 | 1 << 7 | 1 << 10 | 1 << 11)
 
#define FUNC0   0x0 /** Pin function 0 */
 
#define FUNC1   0x1 /** Pin function 1 */
 
#define FUNC2   0x2 /** Pin function 2 */
 
#define FUNC3   0x3 /** Pin function 3 */
 
#define FUNC4   0x4 /** Pin function 4 */
 
#define FUNC5   0x5 /** Pin function 5 */
 
#define FUNC6   0x6 /** Pin function 6 */
 
#define FUNC7   0x7 /** Pin function 7 */
 
#define LPC_SCU_PIN(LPC_SCU_BASE, po, pi)   (*(volatile int *) ((LPC_SCU_BASE) + ((po) * 0x80) + ((pi) * 0x4))
 
#define LPC_SCU_CLK(LPC_SCU_BASE, c)   (*(volatile int *) ((LPC_SCU_BASE) +0xC00 + ((c) * 0x4)))
 
#define PINMUX_CLK   0xFF
 

Functions

void Chip_SCU_PinMux (uint8_t port, uint8_t pin, uint8_t mode, uint8_t func)
 Configure pin function.
 
void Chip_SCU_GPIOIntPinSel (uint8_t PortSel, uint8_t PortNum, uint8_t PinNum)
 GPIO Interrupt Pin Select.
 
STATIC INLINE void Chip_SCU_I2C0PinConfig (uint32_t I2C0Mode)
 I2C Pin Configuration.
 
STATIC INLINE void Chip_SCU_ADC_Channel_Config (uint32_t ADC_ID, uint8_t channel)
 ADC Pin Configuration.
 

Detailed Description

Macro Definition Documentation

#define FUNC0   0x0 /** Pin function 0 */

Definition at line 100 of file scu_18xx_43xx.h.

#define FUNC1   0x1 /** Pin function 1 */

Definition at line 101 of file scu_18xx_43xx.h.

#define FUNC2   0x2 /** Pin function 2 */

Definition at line 102 of file scu_18xx_43xx.h.

#define FUNC3   0x3 /** Pin function 3 */

Definition at line 103 of file scu_18xx_43xx.h.

#define FUNC4   0x4 /** Pin function 4 */

Definition at line 104 of file scu_18xx_43xx.h.

#define FUNC5   0x5 /** Pin function 5 */

Definition at line 105 of file scu_18xx_43xx.h.

#define FUNC6   0x6 /** Pin function 6 */

Definition at line 106 of file scu_18xx_43xx.h.

#define FUNC7   0x7 /** Pin function 7 */

Definition at line 107 of file scu_18xx_43xx.h.

#define I2C0_FAST_MODE_PLUS   (2 << 1 | 1 << 3 | 1 << 7 | 1 << 10 | 1 << 11)

Pin configuration for Fast-mode Plus I2C

Definition at line 98 of file scu_18xx_43xx.h.

#define I2C0_STANDARD_FAST_MODE   (1 << 3 | 1 << 11)

Pin configuration for STANDARD/FAST mode I2C

Definition at line 95 of file scu_18xx_43xx.h.

#define LPC_SCU_CLK (   LPC_SCU_BASE,
 
)    (*(volatile int *) ((LPC_SCU_BASE) +0xC00 + ((c) * 0x4)))

Returns the address in the SCU for a SFSCLK clock register

Definition at line 113 of file scu_18xx_43xx.h.

#define LPC_SCU_PIN (   LPC_SCU_BASE,
  po,
  pi 
)    (*(volatile int *) ((LPC_SCU_BASE) + ((po) * 0x80) + ((pi) * 0x4))

Returns the SFSP register address in the SCU for a pin and port

Definition at line 110 of file scu_18xx_43xx.h.

#define MD_BUK   (0x1 << 3)

Enable pull-down resistor at pad

Definition at line 69 of file scu_18xx_43xx.h.

#define MD_EHD0   (0x1 << 8)

EHD driver strength low bit

Definition at line 87 of file scu_18xx_43xx.h.

#define MD_EHD1   (0x1 << 8)

EHD driver strength high bit

Definition at line 90 of file scu_18xx_43xx.h.

#define MD_EHS   (0x1 << 5)

Enable fast slew rate

Definition at line 78 of file scu_18xx_43xx.h.

#define MD_EZI   (0x1 << 6)

Input buffer enable

Definition at line 81 of file scu_18xx_43xx.h.

#define MD_PDN   (0x3 << 3)

Enable pull-down and pull-up resistor at resistor at pad (repeater mode)

Definition at line 75 of file scu_18xx_43xx.h.

#define MD_PLN   (0x2 << 3)

Enable pull-up resistor at pad

Definition at line 72 of file scu_18xx_43xx.h.

#define MD_PLN_FAST   (MD_PLN | MD_EZI | MD_ZI | MD_EHS)

Definition at line 92 of file scu_18xx_43xx.h.

#define MD_PUP   (0x0 << 3)

Disable pull-down and pull-up resistor at resistor at pad

Definition at line 66 of file scu_18xx_43xx.h.

#define MD_ZI   (0x1 << 7)

Disable input glitch filter

Definition at line 84 of file scu_18xx_43xx.h.

#define PIN_OFFSET   0x04

Pin offset definition

Definition at line 63 of file scu_18xx_43xx.h.

#define PINMUX_CLK   0xFF

Definition at line 115 of file scu_18xx_43xx.h.

#define PORT_OFFSET   0x80

Port offset definition

Definition at line 60 of file scu_18xx_43xx.h.

Function Documentation

STATIC INLINE void Chip_SCU_ADC_Channel_Config ( uint32_t  ADC_ID,
uint8_t  channel 
)

ADC Pin Configuration.

Parameters
ADC_ID: ADC number
channel: ADC channel
Returns
None

Definition at line 158 of file scu_18xx_43xx.h.

void Chip_SCU_GPIOIntPinSel ( uint8_t  PortSel,
uint8_t  PortNum,
uint8_t  PinNum 
)

GPIO Interrupt Pin Select.

Parameters
PortSel: GPIO PINTSEL interrupt, should be: 0 to 7
PortNum: GPIO port number interrupt, should be: 0 to 7
PinNum: GPIO pin number Interrupt , should be: 0 to 31
Returns
None

Definition at line 62 of file scu_18xx_43xx.c.

STATIC INLINE void Chip_SCU_I2C0PinConfig ( uint32_t  I2C0Mode)

I2C Pin Configuration.

Parameters
I2C0Mode: I2C0 mode, should be:
  • I2C0_STANDARD_FAST_MODE: Standard/Fast mode transmit
  • I2C0_FAST_MODE_PLUS: Fast-mode Plus transmit
Returns
None

Definition at line 147 of file scu_18xx_43xx.h.

void Chip_SCU_PinMux ( uint8_t  port,
uint8_t  pin,
uint8_t  mode,
uint8_t  func 
)

Configure pin function.

Parameters
port: Port number, should be: 0..15
pin: Pin number, should be: 0..31
mode: Pin mode, should be:
  • MD_PUP :Pull-up enabled
  • MD_BUK :Plain input
  • MD_PLN :Repeater mode
  • MD_PDN :Pull-down enabled
func: Function mode, should be: FUNC0 to FUNC7
Returns
None

Definition at line 51 of file scu_18xx_43xx.c.