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_NRF51822.h@22:45b32f07e790, 2016-09-20 (annotated)
- Committer:
- Sissors
- Date:
- Tue Sep 20 20:41:42 2016 +0000
- Revision:
- 22:45b32f07e790
- Parent:
- 20:ed72895a2402
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 | 20:ed72895a2402 | 1 | #ifdef TARGET_MCU_NRF51822 |
| Sissors | 20:ed72895a2402 | 2 | |
| Sissors | 20:ed72895a2402 | 3 | #include "mbed.h" |
| Sissors | 20:ed72895a2402 | 4 | #include "gpio_api.h" |
| Sissors | 20:ed72895a2402 | 5 | |
| Sissors | 20:ed72895a2402 | 6 | typedef struct { |
| Sissors | 20:ed72895a2402 | 7 | uint32_t mask; |
| Sissors | 20:ed72895a2402 | 8 | } fastio_vars; |
| Sissors | 20:ed72895a2402 | 9 | |
| Sissors | 20:ed72895a2402 | 10 | #define PINMASK (1 << pin) |
| Sissors | 20:ed72895a2402 | 11 | |
| Sissors | 20:ed72895a2402 | 12 | |
| Sissors | 20:ed72895a2402 | 13 | #define INIT_PIN container.mask = PINMASK; NRF_GPIO->PIN_CNF[pin] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \ |
| Sissors | 20:ed72895a2402 | 14 | | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) \ |
| Sissors | 20:ed72895a2402 | 15 | | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \ |
| Sissors | 20:ed72895a2402 | 16 | | (NRF_GPIO->PIN_CNF[pin] & 0x01); |
| Sissors | 20:ed72895a2402 | 17 | #define DESTROY_PIN |
| Sissors | 20:ed72895a2402 | 18 | |
| Sissors | 20:ed72895a2402 | 19 | #define SET_DIR_INPUT NRF_GPIO->DIRCLR = PINMASK |
| Sissors | 20:ed72895a2402 | 20 | #define SET_DIR_OUTPUT NRF_GPIO->DIRSET = PINMASK |
| Sissors | 20:ed72895a2402 | 21 | #define SET_MODE(pull) NRF_GPIO->PIN_CNF[pin] = (NRF_GPIO->PIN_CNF[pin] & (~GPIO_PIN_CNF_PULL_Msk)) | pull |
| Sissors | 20:ed72895a2402 | 22 | |
| Sissors | 20:ed72895a2402 | 23 | #define WRITE_PIN_SET NRF_GPIO->OUTSET = PINMASK |
| Sissors | 20:ed72895a2402 | 24 | #define WRITE_PIN_CLR NRF_GPIO->OUTCLR = PINMASK |
| Sissors | 20:ed72895a2402 | 25 | |
| Sissors | 20:ed72895a2402 | 26 | #define READ_PIN ((NRF_GPIO->IN & container.mask) ? 1 : 0) |
| Sissors | 20:ed72895a2402 | 27 | |
| Sissors | 20:ed72895a2402 | 28 | #endif |
