STM32F411: implement PULLUP_ON() and PULLUP_OFF().

This commit is contained in:
Nico Tonnhofer 2015-11-10 18:07:37 +01:00
parent 313e37c0b2
commit 73df1be2d2
1 changed files with 12 additions and 0 deletions

12
pinio.h
View File

@ -157,6 +157,18 @@
IO ## _PORT->OSPEEDR |= (3 << ((IO ## _PIN) << 1)); \
} while (0)
/// Enable pullup resistor.
#define _PULLUP_ON(IO) \
do { \
IO ## _PORT->PUPDR &= ~(3 << ((IO ## _PIN) << 1)); \
IO ## _PORT->PUPDR |= (1 << ((IO ## _PIN) << 1)) * 0x1; \
} while (0)
/// Disable pullup resistor.
#define _PULLUP_OFF(IO) \
do { \
IO ## _PORT->PUPDR &= ~(1 << ((IO ## _PIN) << 1)) * 0x1; \
} while (0)
#elif defined SIMULATOR
#include "simulator.h"