Replacement for regular GPIO (DigitalIn, DigitalOut, DigitalInOut) classes which has superior speed.
Fork of FastIO by
Revision 11:327ae1d5fecb, committed 2014-12-23
- Comitter:
- Sissors
- Date:
- Tue Dec 23 11:47:08 2014 +0000
- Parent:
- 10:bb22a3dbedb4
- Child:
- 12:973e253323c9
- Commit message:
- Added F411 (identical to F401)
Changed in this revision
--- a/Devices/FastIO_NUCLEO_F401.h Sat Sep 20 13:04:45 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#ifdef TARGET_NUCLEO_F401RE - -#include "mbed.h" -#include "pinmap.h" - -typedef struct { - uint32_t mask; -} fastio_vars; - -#define PINMASK (1 << STM_PIN(pin)) -#define PORT ((GPIO_TypeDef *)(GPIOA_BASE + 0x0400 * STM_PORT(pin))) - -#define INIT_PIN RCC->AHB1ENR |= (1 << STM_PORT(pin)); (PORT->MODER &= ~(GPIO_MODER_MODER0_1 << (STM_PIN(pin) * 2))); container.mask = PINMASK -#define DESTROY_PIN - -#define SET_DIR_INPUT (PORT->MODER &= ~(GPIO_MODER_MODER0_0 << (STM_PIN(pin) * 2))) -#define SET_DIR_OUTPUT (PORT->MODER |= (GPIO_MODER_MODER0_0 << (STM_PIN(pin) * 2))) -#define SET_MODE(pull) pin_mode(pin, pull); - -#define WRITE_PIN_SET (PORT->BSRRL = PINMASK) -#define WRITE_PIN_CLR (PORT->BSRRH = PINMASK) - -#define READ_PIN ((PORT->IDR & container.mask) ? 1 : 0) - -#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Devices/FastIO_NUCLEO_F4X1.h Tue Dec 23 11:47:08 2014 +0000 @@ -0,0 +1,25 @@ +#if defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE) + +#include "mbed.h" +#include "pinmap.h" + +typedef struct { + uint32_t mask; +} fastio_vars; + +#define PINMASK (1 << STM_PIN(pin)) +#define PORT ((GPIO_TypeDef *)(GPIOA_BASE + 0x0400 * STM_PORT(pin))) + +#define INIT_PIN RCC->AHB1ENR |= (1 << STM_PORT(pin)); (PORT->MODER &= ~(GPIO_MODER_MODER0_1 << (STM_PIN(pin) * 2))); container.mask = PINMASK +#define DESTROY_PIN + +#define SET_DIR_INPUT (PORT->MODER &= ~(GPIO_MODER_MODER0_0 << (STM_PIN(pin) * 2))) +#define SET_DIR_OUTPUT (PORT->MODER |= (GPIO_MODER_MODER0_0 << (STM_PIN(pin) * 2))) +#define SET_MODE(pull) pin_mode(pin, pull); + +#define WRITE_PIN_SET (PORT->BSRRL = PINMASK) +#define WRITE_PIN_CLR (PORT->BSRRH = PINMASK) + +#define READ_PIN ((PORT->IDR & container.mask) ? 1 : 0) + +#endif
--- a/FastIO.h Sat Sep 20 13:04:45 2014 +0000 +++ b/FastIO.h Tue Dec 23 11:47:08 2014 +0000 @@ -6,7 +6,7 @@ #include "FastIO_LPC81X.h" #include "FastIO_KLXX.h" #include "FastIO_K20D50M_KPSDK.h" -#include "FastIO_NUCLEO_F401.h" +#include "FastIO_NUCLEO_F4X1.h" #include "FastIO_NUCLEO_F030.h" #include "FastIO_LPC11XX.h"