Fixed constructor for latest mbed library.

Dependents:   Pinscape_Controller_v1 Pinscape_Controller Pinscape_Controller_V2_arnoz Pinscape_Controller_V2

Fork of FastIO by Erik -

Committer:
mjr
Date:
Fri Sep 25 18:49:20 2015 +0000
Revision:
12:199aca52ac42
Parent:
4:6ebbf25b9167
Fixed constructor for mbed library update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 0:d394ebd01052 1 #ifdef TARGET_LPC1768
Sissors 0:d394ebd01052 2
Sissors 0:d394ebd01052 3 #include "mbed.h"
Sissors 0:d394ebd01052 4 #include "pinmap.h"
Sissors 0:d394ebd01052 5
Sissors 0:d394ebd01052 6 typedef struct {
Sissors 0:d394ebd01052 7 uint32_t mask;
Sissors 0:d394ebd01052 8 } fastio_vars;
Sissors 0:d394ebd01052 9
Sissors 0:d394ebd01052 10 #define LPC_GPIO ((LPC_GPIO_TypeDef*)(pin & ~0x1F))
Sissors 0:d394ebd01052 11 #define PINMASK (1UL << (((pin) - P0_0)%32))
Sissors 0:d394ebd01052 12
Sissors 0:d394ebd01052 13 #define PINSELREG (*(volatile uint32_t*)(LPC_PINCON_BASE + 4*(((pin) - P0_0)/16)))
Sissors 0:d394ebd01052 14 #define PINSELMASK (0x03 << (((pin - P0_0)%16)*2) )
Sissors 0:d394ebd01052 15
Sissors 0:d394ebd01052 16 #define INIT_PIN container.mask = PINMASK; (PINSELREG &= ~PINSELMASK)
Sissors 2:1a6ed4b84590 17 #define DESTROY_PIN
Sissors 0:d394ebd01052 18
Sissors 0:d394ebd01052 19 #define SET_DIR_INPUT (LPC_GPIO->FIODIR &= ~PINMASK)
Sissors 0:d394ebd01052 20 #define SET_DIR_OUTPUT (LPC_GPIO->FIODIR |= PINMASK)
Sissors 0:d394ebd01052 21 #define SET_MODE(pull) (pin_mode(pin, pull))
Sissors 0:d394ebd01052 22
Sissors 0:d394ebd01052 23 #define WRITE_PIN_SET (LPC_GPIO->FIOSET = PINMASK)
Sissors 0:d394ebd01052 24 #define WRITE_PIN_CLR (LPC_GPIO->FIOCLR = PINMASK)
Sissors 0:d394ebd01052 25
Sissors 0:d394ebd01052 26 #define READ_PIN ((LPC_GPIO->FIOPIN & container.mask) ? 1 : 0)
Sissors 0:d394ebd01052 27
Sissors 0:d394ebd01052 28 #endif