add LPC4337

Fork of FastIO by Erik -

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FastIO_KLXX.h Source File

FastIO_KLXX.h

00001 #ifdef TARGET_KLXX
00002 
00003 #include "mbed.h"
00004 #include "pinmap.h"
00005 
00006 typedef struct {
00007     uint32_t mask;
00008 } fastio_vars;
00009 
00010 #define PORT_BASE       ((FGPIO_Type *)(FPTA_BASE + ((unsigned int)pin >> PORT_SHIFT) * 0x40))
00011 #define PINMASK         (1 << ((pin & 0x7F) >> 2))
00012 #define PCR             ((__IO uint32_t*)(PORTA_BASE + pin))
00013 
00014 #define INIT_PIN        container.mask = PINMASK; pin_function(pin, 1)
00015 #define DESTROY_PIN     
00016 
00017 #define SET_DIR_INPUT   (PORT_BASE->PDDR &= ~PINMASK)
00018 #define SET_DIR_OUTPUT  (PORT_BASE->PDDR |= PINMASK)
00019 #define SET_MODE(pull)  (*PCR = (*PCR & ~0x3) | pull)
00020 
00021 #define WRITE_PIN_SET   (PORT_BASE->PSOR |= PINMASK)
00022 #define WRITE_PIN_CLR   (PORT_BASE->PCOR |= PINMASK)
00023 
00024 #define READ_PIN        ((PORT_BASE->PDIR & container.mask) ? 1 : 0)
00025 
00026 #endif