Replacement for regular GPIO (DigitalIn, DigitalOut, DigitalInOut) classes which has superior speed.
Fork of FastIO by
Revision 21:a1dfa6c65400, committed 2016-09-20
- Comitter:
- viquiram
- Date:
- Tue Sep 20 09:28:40 2016 +0000
- Parent:
- 20:ed72895a2402
- Child:
- 22:45b32f07e790
- Commit message:
- Add support to Nucleo L073RZ platform.
Changed in this revision
Devices/FastIO_STM32L073XX.h | Show annotated file Show diff for this revision Revisions of this file |
FastIO.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Devices/FastIO_STM32L073XX.h Tue Sep 20 09:28:40 2016 +0000 @@ -0,0 +1,25 @@ +#if defined(STM32L073xx) + +#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->IOPENR |= (1 << STM_PORT(pin)); (PORT->MODER &= ~(GPIO_MODER_MODE0_1 << (STM_PIN(pin) * 2))); container.mask = PINMASK +#define DESTROY_PIN + +#define SET_DIR_INPUT (PORT->MODER &= ~(GPIO_MODER_MODE0_0 << (STM_PIN(pin) * 2))) +#define SET_DIR_OUTPUT (PORT->MODER |= (GPIO_MODER_MODE0_0 << (STM_PIN(pin) * 2))) +#define SET_MODE(pull) pin_mode(pin, pull); + +#define WRITE_PIN_SET (PORT->BSRR = PINMASK) +#define WRITE_PIN_CLR (PORT->BRR = PINMASK) + +#define READ_PIN ((PORT->IDR & container.mask) ? 1 : 0) + +#endif \ No newline at end of file
--- a/FastIO.h Tue May 17 20:06:23 2016 +0000 +++ b/FastIO.h Tue Sep 20 09:28:40 2016 +0000 @@ -8,6 +8,7 @@ #include "FastIO_KLXX.h" #include "FastIO_K20D50M_KPSDK.h" #include "FastIO_STM32F4.h" +#include "FastIO_STM32L073XX.h" #include "FastIO_NUCLEO_F030.h" #include "FastIO_LPC11XX.h" #include "FastIO_EFM32.h"