daad

Dependencies:   mbed TrapezoidControl QEI

Revision:
0:669ef71cba68
Child:
1:b1219d8ca117
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Switch/Switch.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,51 @@
+#ifndef SWITCH_H_
+#define SWITCH_H_
+
+#include "mbed.h"
+#include <stdint.h>
+
+namespace SWITCH {
+    #define SW_ON   0
+    #define SW_OFF  1
+
+    #define DIP0_PIN    PB_0
+    #define DIP1_PIN    PA_4
+    #define DIP2_PIN    PA_1
+    #define DIP3_PIN    PA_0
+
+    #define LS_PIN      PB_6
+    #define SELECT0_PIN PC_8
+    #define SELECT1_PIN PC_9
+    #define SELECT2_PIN PB_9
+    #define SELECT3_PIN PB_8
+
+    #define DIP0    dipSw[0]
+    #define DIP1    dipSw[1]
+    #define DIP2    dipSw[2]
+    #define DIP3    dipSw[3]
+
+    class DipSw {
+        public:
+        static void Initialize();
+        static uint8_t GetStatus();
+    };
+    
+    class LimitSw {
+        public:
+        static void Initialize();
+        static bool IsPressed(int index);
+    };
+
+    typedef union {
+        struct {
+            int s0 : 1;
+            int s1 : 1;
+            int s2 : 1;
+            int s3 : 1;
+            int : 4;
+        };
+        uint8_t all;
+    } MP_Channel;
+}
+
+#endif