add LPC4337
Fork of FastIO by
Diff: Devices/FastIO_STM32F4.h
- Revision:
- 14:f0a48027b2b3
- Parent:
- 13:0e21ffc6cb84
--- a/Devices/FastIO_STM32F4.h Sun May 17 10:48:26 2015 +0000 +++ b/Devices/FastIO_STM32F4.h Sun May 17 20:21:41 2015 +0000 @@ -8,6 +8,7 @@ } fastio_vars; #define PINMASK (1 << STM_PIN(pin)) +#define PINMASK_CLR ((1<<16) << 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 @@ -17,8 +18,8 @@ #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 WRITE_PIN_SET (PORT->BSRR = PINMASK) +#define WRITE_PIN_CLR (PORT->BSRR = PINMASK_CLR) #define READ_PIN ((PORT->IDR & container.mask) ? 1 : 0)