大季 矢花 / Mbed 2 deprecated 2019_Master_9_2

Dependencies:   mbed TrapezoidControl 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     class DipSw {
00032         public:
00033         static void Initialize();
00034         static uint8_t GetStatus();
00035     };
00036     
00037     class LimitSw {
00038         public:
00039         static void Initialize();
00040         static bool IsPressed(int index);
00041     };
00042 
00043     typedef union {
00044         struct {
00045             int s0 : 1;
00046             int s1 : 1;
00047             int s2 : 1;
00048             int s3 : 1;
00049             int : 4;
00050         };
00051         uint8_t all;
00052     } MP_Channel;
00053 }
00054 
00055 #endif