Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Eavesdropper BitstreamGenerator SimpleDecimationFilter 11U68_MP3Player with TFTLCD ... more
Devices/FastIO_LPC43XX.h@22:45b32f07e790, 2016-09-20 (annotated)
- Committer:
- Sissors
- Date:
- Tue Sep 20 20:41:42 2016 +0000
- Revision:
- 22:45b32f07e790
- Parent:
- 19:89d6ae484a35
Fixed bug in enabling of port hardware of the F030 (via: https://developer.mbed.org/users/viquiram/)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nameless129 | 19:89d6ae484a35 | 1 | #ifdef TARGET_LPC43XX |
| nameless129 | 19:89d6ae484a35 | 2 | |
| nameless129 | 19:89d6ae484a35 | 3 | #include "mbed.h" |
| nameless129 | 19:89d6ae484a35 | 4 | #include "pinmap.h" |
| nameless129 | 19:89d6ae484a35 | 5 | |
| nameless129 | 19:89d6ae484a35 | 6 | typedef struct { |
| nameless129 | 19:89d6ae484a35 | 7 | uint32_t mask; |
| nameless129 | 19:89d6ae484a35 | 8 | } fastio_vars; |
| nameless129 | 19:89d6ae484a35 | 9 | |
| nameless129 | 19:89d6ae484a35 | 10 | #define PORT (((unsigned int)pin >> PORT_SHIFT) & 0x0000000F) |
| nameless129 | 19:89d6ae484a35 | 11 | #define PINMASK (1 << ((int)pin & 0x1F)) |
| nameless129 | 19:89d6ae484a35 | 12 | static inline void initpin(PinName pin); |
| nameless129 | 19:89d6ae484a35 | 13 | |
| nameless129 | 19:89d6ae484a35 | 14 | #define INIT_PIN container.mask = PINMASK; initpin(pin) |
| nameless129 | 19:89d6ae484a35 | 15 | #define DESTROY_PIN |
| nameless129 | 19:89d6ae484a35 | 16 | |
| nameless129 | 19:89d6ae484a35 | 17 | #define SET_DIR_INPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] &= ~PINMASK ) |
| nameless129 | 19:89d6ae484a35 | 18 | #define SET_DIR_OUTPUT ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->DIR[PORT] |= PINMASK ) |
| nameless129 | 19:89d6ae484a35 | 19 | #define SET_MODE(pull) (pin_mode(pin, pull)) |
| nameless129 | 19:89d6ae484a35 | 20 | |
| nameless129 | 19:89d6ae484a35 | 21 | #define WRITE_PIN_SET ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->SET[PORT] = PINMASK ) |
| nameless129 | 19:89d6ae484a35 | 22 | #define WRITE_PIN_CLR ( ((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->CLR[PORT] = PINMASK ) |
| nameless129 | 19:89d6ae484a35 | 23 | |
| nameless129 | 19:89d6ae484a35 | 24 | #define READ_PIN ( (((LPC_GPIO_T *)(LPC_GPIO_PORT_BASE))->PIN[PORT] & container.mask) ? 1 : 0 ) |
| nameless129 | 19:89d6ae484a35 | 25 | |
| nameless129 | 19:89d6ae484a35 | 26 | static inline void initpin(PinName pin) { |
| nameless129 | 19:89d6ae484a35 | 27 | unsigned int port = (unsigned int)MBED_GPIO_PORT(pin); |
| nameless129 | 19:89d6ae484a35 | 28 | int f = SCU_PINIO_FAST | ((port > 4) ? (4) : (0)); |
| nameless129 | 19:89d6ae484a35 | 29 | pin_function(pin, f); |
| nameless129 | 19:89d6ae484a35 | 30 | } |
| nameless129 | 19:89d6ae484a35 | 31 | |
| nameless129 | 19:89d6ae484a35 | 32 | #endif |
