The last version programs

Dependencies:   mbed TrapezoidControl Pulse QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Switch.h Source File

Switch.h

00001 #ifndef SWITCH_H_
00002 #define SWITCH_H_
00003 
00004 #include "mbed.h"
00005 #include <stdint.h>
00006 
00007 namespace SWITCH {
00008     #define SW_ON   0
00009     #define SW_OFF  1
00010 
00011     //DipSwitch
00012     #define DIP0_PIN    PA_4
00013     #define DIP1_PIN    PA_6
00014     #define DIP2_PIN    PA_7
00015     #define DIP3_PIN    PC_7
00016                         
00017 
00018     //Multiplexer
00019     #define LS_PIN      PD_2
00020     #define SELECT0_PIN PC_12
00021     #define SELECT1_PIN PA_15
00022     #define SELECT2_PIN PC_13
00023     #define SELECT3_PIN PB_7
00024     
00025     
00026     #define DIP0    dipSw[0]
00027     #define DIP1    dipSw[1]
00028     #define DIP2    dipSw[2]
00029     #define DIP3    dipSw[3]
00030     
00031     //Normal
00032     #define LS_16  PB_6
00033     #define LS_17  PB_9
00034     #define LS_18  PB_8
00035     #define LS_19  PC_9
00036     #define LS_20  PC_8
00037 
00038     class DipSw {
00039         public:
00040         static void Initialize();
00041         static uint8_t GetStatus();
00042     };
00043     
00044     class LimitSw {
00045         public:
00046         static void Initialize();
00047         static bool IsPressed(int index);
00048     };
00049 
00050     typedef union {
00051         struct {
00052             int s0 : 1;
00053             int s1 : 1;
00054             int s2 : 1;
00055             int s3 : 1;
00056             int : 4;
00057         };
00058         uint8_t all;
00059     } MP_Channel;
00060 }
00061 
00062 #endif