add LPC4337
Fork of FastIO by
Embed:
(wiki syntax)
Show/hide line numbers
FastIO_LPC43XX.h
00001 #ifdef TARGET_LPC43XX 00002 00003 #include "mbed.h" 00004 #include "pinmap.h" 00005 00006 typedef struct { 00007 uint32_t mask; 00008 } fastio_vars; 00009 00010 #define PORT (((unsigned int)pin >> PORT_SHIFT) & 0x0000000F) 00011 #define PINMASK (1 << ((int)pin & 0x1F)) 00012 static inline void initpin(PinName pin); 00013 00014 #define INIT_PIN container.mask = PINMASK; initpin(pin) 00015 #define DESTROY_PIN 00016 00017 #define SET_DIR_INPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] &= ~PINMASK ) 00018 #define SET_DIR_OUTPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] |= PINMASK ) 00019 #define SET_MODE(pull) (pin_mode(pin, pull)) 00020 00021 #define WRITE_PIN_SET ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->SET[PORT] = PINMASK ) 00022 #define WRITE_PIN_CLR ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->CLR[PORT] = PINMASK ) 00023 00024 #define READ_PIN ( (((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->PIN[PORT] & container.mask) ? 1 : 0 ) 00025 00026 static inline void initpin(PinName pin) { 00027 unsigned int port = (unsigned int)MBED_GPIO_PORT(pin); 00028 int f = SCU_PINIO_FAST | ((port > 4) ? (4) : (0)); 00029 pin_function(pin, f); 00030 } 00031 00032 #endif
Generated on Tue Jul 12 2022 22:57:17 by
