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_LPC11XX.h@22:45b32f07e790, 2016-09-20 (annotated)
- Committer:
- Sissors
- Date:
- Tue Sep 20 20:41:42 2016 +0000
- Revision:
- 22:45b32f07e790
- Parent:
- 7:1e784ae11fba
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 |
|---|---|---|---|
| Sissors | 7:1e784ae11fba | 1 | #ifdef TARGET_LPC11XX_11CXX |
| Sissors | 7:1e784ae11fba | 2 | |
| Sissors | 7:1e784ae11fba | 3 | #include "mbed.h" |
| Sissors | 7:1e784ae11fba | 4 | #include "pinmap.h" |
| Sissors | 7:1e784ae11fba | 5 | #include "reserved_pins.h" |
| Sissors | 7:1e784ae11fba | 6 | |
| Sissors | 7:1e784ae11fba | 7 | typedef struct { |
| Sissors | 7:1e784ae11fba | 8 | } fastio_vars; |
| Sissors | 7:1e784ae11fba | 9 | |
| Sissors | 7:1e784ae11fba | 10 | #define PORT ((LPC_GPIO_TypeDef *) (LPC_GPIO0_BASE + (((pin & 0xF000) >> PORT_SHIFT) * 0x10000))) |
| Sissors | 7:1e784ae11fba | 11 | #define PIN ((pin & 0x0F00) >> 8 ) |
| Sissors | 7:1e784ae11fba | 12 | #define MASKDATA (*((volatile uint32_t*) ((uint32_t)PORT + (1 << (PIN + 2))))) |
| Sissors | 7:1e784ae11fba | 13 | static inline void initpin(PinName pin); |
| Sissors | 7:1e784ae11fba | 14 | static const PinName reserved_pins[] = TARGET_RESERVED_PINS; |
| Sissors | 7:1e784ae11fba | 15 | |
| Sissors | 7:1e784ae11fba | 16 | #define INIT_PIN initpin(pin) |
| Sissors | 7:1e784ae11fba | 17 | #define DESTROY_PIN |
| Sissors | 7:1e784ae11fba | 18 | |
| Sissors | 7:1e784ae11fba | 19 | #define SET_DIR_INPUT (PORT->DIR &= ~(1 << PIN)) |
| Sissors | 7:1e784ae11fba | 20 | #define SET_DIR_OUTPUT (PORT->DIR |= (1<<PIN)) |
| Sissors | 7:1e784ae11fba | 21 | #define SET_MODE(pull) (pin_mode(pin, pull)) |
| Sissors | 7:1e784ae11fba | 22 | |
| Sissors | 7:1e784ae11fba | 23 | #define WRITE_PIN_SET (MASKDATA = 0xFFFF) |
| Sissors | 7:1e784ae11fba | 24 | #define WRITE_PIN_CLR (MASKDATA = 0) |
| Sissors | 7:1e784ae11fba | 25 | |
| Sissors | 7:1e784ae11fba | 26 | #define READ_PIN ((MASKDATA == 0) ? 0 : 1) |
| Sissors | 7:1e784ae11fba | 27 | |
| Sissors | 7:1e784ae11fba | 28 | static inline void initpin(PinName pin) { |
| Sissors | 7:1e784ae11fba | 29 | unsigned i; |
| Sissors | 7:1e784ae11fba | 30 | int f = 0; |
| Sissors | 7:1e784ae11fba | 31 | |
| Sissors | 7:1e784ae11fba | 32 | for (i = 0; i < sizeof(reserved_pins) / sizeof(PinName); i ++) { |
| Sissors | 7:1e784ae11fba | 33 | if (pin == reserved_pins[i]) { |
| Sissors | 7:1e784ae11fba | 34 | f = 1; |
| Sissors | 7:1e784ae11fba | 35 | break; |
| Sissors | 7:1e784ae11fba | 36 | } |
| Sissors | 7:1e784ae11fba | 37 | } |
| Sissors | 7:1e784ae11fba | 38 | pin_function(pin, f); |
| Sissors | 7:1e784ae11fba | 39 | } |
| Sissors | 7:1e784ae11fba | 40 | |
| Sissors | 7:1e784ae11fba | 41 | #endif |
