Nagano kosen robocon

Dependencies:   mbed 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     #define DIP0_PIN    PA_15
00012     #define DIP1_PIN    PB_7
00013     #define DIP2_PIN    PC_13
00014     #define DIP3_PIN    PH_1
00015 
00016     #define LS_PIN      PA_6
00017     #define SELECT0_PIN PC_8
00018     #define SELECT1_PIN PC_9
00019     #define SELECT2_PIN PB_8
00020     #define SELECT3_PIN PB_9
00021 
00022     #define DIP0    dipSw[0]
00023     #define DIP1    dipSw[1]
00024     #define DIP2    dipSw[2]
00025     #define DIP3    dipSw[3]
00026     
00027     #define SW0_PIN PB_15
00028     #define SW1_PIN PB_2
00029     #define SW2_PIN PB_3
00030     #define SW3_PIN PB_1
00031     #define SW4_PIN PB_5
00032     
00033     class DipSw {
00034         public:
00035         static void Initialize();
00036         static uint8_t GetStatus();
00037     };
00038     
00039     class LimitSw {
00040         public:
00041         static void Initialize();
00042         static bool IsPressed(uint8_t index);
00043     };
00044     
00045     class PushSw {
00046         public:
00047         static void Initialize();
00048         static bool IsPressed(uint8_t index);
00049     };
00050 
00051     typedef union {
00052         struct {
00053             int s0 : 1;
00054             int s1 : 1;
00055             int s2 : 1;
00056             int s3 : 1;
00057             int : 4;
00058         };
00059         uint8_t all;
00060     } MP_Channel;
00061 }
00062 
00063 #endif
00064