From 73df1be2d2f0c7932dafe833c72b4d2c54d16166 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Tue, 10 Nov 2015 18:07:37 +0100 Subject: [PATCH] STM32F411: implement PULLUP_ON() and PULLUP_OFF(). --- pinio.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pinio.h b/pinio.h index 93ab237..389c6b8 100644 --- a/pinio.h +++ b/pinio.h @@ -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"