Fixed constructor for latest mbed library.

Dependents:   Pinscape_Controller_v1 Pinscape_Controller Pinscape_Controller_V2_arnoz Pinscape_Controller_V2

Fork of FastIO by Erik -

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FastIO_LPC1768.h Source File

FastIO_LPC1768.h

00001 #ifdef TARGET_LPC1768
00002 
00003 #include "mbed.h"
00004 #include "pinmap.h"
00005 
00006 typedef struct {
00007     uint32_t mask;
00008 } fastio_vars;
00009 
00010 #define LPC_GPIO            ((LPC_GPIO_TypeDef*)(pin & ~0x1F))
00011 #define PINMASK             (1UL << (((pin) - P0_0)%32))
00012 
00013 #define PINSELREG           (*(volatile uint32_t*)(LPC_PINCON_BASE + 4*(((pin) - P0_0)/16)))
00014 #define PINSELMASK          (0x03 << (((pin - P0_0)%16)*2) )
00015 
00016 #define INIT_PIN            container.mask = PINMASK; (PINSELREG &= ~PINSELMASK)
00017 #define DESTROY_PIN     
00018 
00019 #define SET_DIR_INPUT       (LPC_GPIO->FIODIR &= ~PINMASK)
00020 #define SET_DIR_OUTPUT      (LPC_GPIO->FIODIR |= PINMASK)
00021 #define SET_MODE(pull)      (pin_mode(pin, pull))
00022 
00023 #define WRITE_PIN_SET       (LPC_GPIO->FIOSET = PINMASK)
00024 #define WRITE_PIN_CLR       (LPC_GPIO->FIOCLR = PINMASK)
00025 
00026 #define READ_PIN            ((LPC_GPIO->FIOPIN & container.mask) ? 1 : 0)
00027 
00028 #endif