From c3d8f5876d6c1016e60a6a1dd33272dc8950163f Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 4 Dec 2011 02:04:14 +0100 Subject: Fixed Pin class. --- pin.h | 83 ------------------------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 pin.h (limited to 'pin.h') diff --git a/pin.h b/pin.h deleted file mode 100644 index cbace79..0000000 --- a/pin.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef PIN_H -#define PIN_H - -#include "gpio.h" - -class GPIO { - private: - GPIO_t& g; - int n; - - public: - GPIO(GPIO_t& gpio, int pin) : g(gpio), n(pin) {} - - void on() { - g.BSRR = 1 << n; - } - - void off() { - g.BSRR = 1 << 16 << n; - } - - void toggle() { - if(g.ODR & (1 << n)) { - off(); - } else { - on(); - } - } -}; - -template -class Pin : public Ts... { - public: - Pin(GPIO_t& gpio, int pin) : Ts(gpio, pin)... {} -}; -/* -template -struct U { - struct RX; - struct TX; -}; - -typedef U<1> U1; -typedef U<2> U2; -typedef U<3> U3; - -template -class AF { - public: - AF(GPIO_t& gpio, int pin) {} -}; - -template -class Remap : public AF { - public: - Remap(GPIO_t& gpio, int pin) : AF(gpio, pin) {} -}; - -class Kake { - public: - template - Kake(AF rxpin, AF txpin) {} - - template - Kake(const U&&, AF rxpin, AF txpin) {} -}; - -static Pin> PB6(GPIOB, 6); -static Pin> PB7(GPIOB, 7); - -static Pin, AF> PB8(GPIOB, 8); -static Pin, AF> PB9(GPIOB, 9); -*/ - -static Pin PD12(GPIOD, 12); -static Pin PD13(GPIOD, 13); -static Pin PD14(GPIOD, 14); -static Pin PD15(GPIOD, 15); -/* -Kake f1(PB6, PB7); -Kake f2(PB8, PB9); -*/ -#endif -- cgit v1.2.3