三浦 颯太 / Mbed 2 deprecated MB2019_main_ver3

Dependencies:   mbed

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     
00009     #define SW_ON   0
00010     #define SW_OFF  1
00011 
00012     //DipSwitch
00013     #define DIP0_PIN    PA_4
00014     #define DIP1_PIN    PA_6
00015     #define DIP2_PIN    PA_7
00016     #define DIP3_PIN    PC_7
00017     
00018     #define DIP0    dipSw[0]
00019     #define DIP1    dipSw[1]
00020     #define DIP2    dipSw[2]
00021     #define DIP3    dipSw[3]
00022     
00023     //DigitalInput
00024     #define INPUT0_PIN  PB_9     // INPUT18
00025     #define INPUT1_PIN  PC_9     // INPUT0
00026     #define INPUT2_PIN  PC_6     // INPUT2
00027     #define INPUT3_PIN  PA_12    // INPUT4
00028     #define INPUT4_PIN  PB_12    // INPUT6
00029     #define INPUT5_PIN  PB_1     // INPUT8
00030     #define INPUT6_PIN  PB_14    // INPUT10
00031     #define INPUT7_PIN  PC_4     // INPUT12
00032     #define INPUT8_PIN  PB_4     // INPUT14
00033     #define INPUT9_PIN  PA_8     // INPUT16
00034     #define INPUT10_PIN PB_6     // INPUT19
00035     #define INPUT11_PIN PB_8     // INPUT1
00036     #define INPUT12_PIN PC_8     // INPIT3
00037     #define INPUT13_PIN PC_5     // INPUT5
00038     #define INPUT14_PIN PA_11    // INPUT7
00039     #define INPUT15_PIN PB_2     // INPUT9
00040     #define INPUT16_PIN PB_15    // INPUT11
00041     #define INPUT17_PIN PB_13    // INPUT13
00042     #define INPUT18_PIN PB_5     // INPUT15
00043     #define INPUT19_PIN PB_10    // INPUT17
00044     
00045     #define INPUT_NUM 20
00046     
00047     class DipSw {
00048         public:
00049         static void Initialize();
00050         static uint8_t GetStatus();
00051     };
00052     
00053     class LimitSw {
00054         public:
00055         static void Initialize();
00056         static bool IsPressed(uint8_t index);
00057     };
00058 }
00059 
00060 #endif