add LPC4337
Fork of FastIO by
Revision 19:89d6ae484a35, committed 2016-02-05
- Comitter:
- nameless129
- Date:
- Fri Feb 05 14:47:23 2016 +0000
- Parent:
- 18:c95920122b2e
- Commit message:
- Added LPC43XX(4337)
Changed in this revision
Devices/FastIO_LPC43XX.h | Show annotated file Show diff for this revision Revisions of this file |
FastIO.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r c95920122b2e -r 89d6ae484a35 Devices/FastIO_LPC43XX.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Devices/FastIO_LPC43XX.h Fri Feb 05 14:47:23 2016 +0000 @@ -0,0 +1,32 @@ +#ifdef TARGET_LPC43XX + +#include "mbed.h" +#include "pinmap.h" + +typedef struct { + uint32_t mask; +} fastio_vars; + +#define PORT (((unsigned int)pin >> PORT_SHIFT) & 0x0000000F) +#define PINMASK (1 << ((int)pin & 0x1F)) +static inline void initpin(PinName pin); + +#define INIT_PIN container.mask = PINMASK; initpin(pin) +#define DESTROY_PIN + +#define SET_DIR_INPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] &= ~PINMASK ) +#define SET_DIR_OUTPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] |= PINMASK ) +#define SET_MODE(pull) (pin_mode(pin, pull)) + +#define WRITE_PIN_SET ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->SET[PORT] = PINMASK ) +#define WRITE_PIN_CLR ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->CLR[PORT] = PINMASK ) + +#define READ_PIN ( (((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->PIN[PORT] & container.mask) ? 1 : 0 ) + +static inline void initpin(PinName pin) { + unsigned int port = (unsigned int)MBED_GPIO_PORT(pin); + int f = SCU_PINIO_FAST | ((port > 4) ? (4) : (0)); + pin_function(pin, f); +} + +#endif \ No newline at end of file
diff -r c95920122b2e -r 89d6ae484a35 FastIO.h --- a/FastIO.h Wed Jul 29 10:40:07 2015 +0000 +++ b/FastIO.h Fri Feb 05 14:47:23 2016 +0000 @@ -11,6 +11,7 @@ #include "FastIO_NUCLEO_F030.h" #include "FastIO_LPC11XX.h" #include "FastIO_EFM32.h" +#include "FastIO_LPC43XX.h" #ifndef INIT_PIN #warning Target is not supported by FastIO