lknds
Dependencies: mbed TrapezoidControl Pulse QEI
Input/Switch/Switch.h@16:3f2c2d89372b, 2019-07-01 (annotated)
- Committer:
- kishibekairohan
- Date:
- Mon Jul 01 13:00:20 2019 +0000
- Revision:
- 16:3f2c2d89372b
- Parent:
- 1:b1219d8ca117
- Child:
- 22:7d93f79a3686
aaa;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
t_yamamoto | 0:669ef71cba68 | 1 | #ifndef SWITCH_H_ |
t_yamamoto | 0:669ef71cba68 | 2 | #define SWITCH_H_ |
t_yamamoto | 0:669ef71cba68 | 3 | |
t_yamamoto | 0:669ef71cba68 | 4 | #include "mbed.h" |
t_yamamoto | 0:669ef71cba68 | 5 | #include <stdint.h> |
t_yamamoto | 0:669ef71cba68 | 6 | |
t_yamamoto | 0:669ef71cba68 | 7 | namespace SWITCH { |
t_yamamoto | 0:669ef71cba68 | 8 | #define SW_ON 0 |
t_yamamoto | 0:669ef71cba68 | 9 | #define SW_OFF 1 |
t_yamamoto | 0:669ef71cba68 | 10 | |
kishibekairohan | 16:3f2c2d89372b | 11 | //DipSwitch |
kishibekairohan | 16:3f2c2d89372b | 12 | #define DIP0_PIN PA_4 |
kishibekairohan | 16:3f2c2d89372b | 13 | #define DIP1_PIN PA_6 |
kishibekairohan | 16:3f2c2d89372b | 14 | #define DIP2_PIN PA_7 |
kishibekairohan | 16:3f2c2d89372b | 15 | #define DIP3_PIN PC_7 |
kishibekairohan | 16:3f2c2d89372b | 16 | |
t_yamamoto | 0:669ef71cba68 | 17 | |
kishibekairohan | 16:3f2c2d89372b | 18 | //Multiplexer |
kishibekairohan | 16:3f2c2d89372b | 19 | #define LS_PIN PD_2 |
kishibekairohan | 16:3f2c2d89372b | 20 | #define SELECT0_PIN PC_12 |
kishibekairohan | 16:3f2c2d89372b | 21 | #define SELECT1_PIN PA_15 |
kishibekairohan | 16:3f2c2d89372b | 22 | #define SELECT2_PIN PC_13 |
kishibekairohan | 16:3f2c2d89372b | 23 | #define SELECT3_PIN PB_7 |
kishibekairohan | 16:3f2c2d89372b | 24 | |
kishibekairohan | 16:3f2c2d89372b | 25 | |
t_yamamoto | 0:669ef71cba68 | 26 | #define DIP0 dipSw[0] |
t_yamamoto | 0:669ef71cba68 | 27 | #define DIP1 dipSw[1] |
t_yamamoto | 0:669ef71cba68 | 28 | #define DIP2 dipSw[2] |
t_yamamoto | 0:669ef71cba68 | 29 | #define DIP3 dipSw[3] |
t_yamamoto | 0:669ef71cba68 | 30 | |
t_yamamoto | 0:669ef71cba68 | 31 | class DipSw { |
t_yamamoto | 0:669ef71cba68 | 32 | public: |
t_yamamoto | 0:669ef71cba68 | 33 | static void Initialize(); |
t_yamamoto | 0:669ef71cba68 | 34 | static uint8_t GetStatus(); |
t_yamamoto | 0:669ef71cba68 | 35 | }; |
t_yamamoto | 0:669ef71cba68 | 36 | |
t_yamamoto | 0:669ef71cba68 | 37 | class LimitSw { |
t_yamamoto | 0:669ef71cba68 | 38 | public: |
t_yamamoto | 0:669ef71cba68 | 39 | static void Initialize(); |
t_yamamoto | 0:669ef71cba68 | 40 | static bool IsPressed(int index); |
t_yamamoto | 0:669ef71cba68 | 41 | }; |
t_yamamoto | 0:669ef71cba68 | 42 | |
t_yamamoto | 0:669ef71cba68 | 43 | typedef union { |
t_yamamoto | 0:669ef71cba68 | 44 | struct { |
t_yamamoto | 0:669ef71cba68 | 45 | int s0 : 1; |
t_yamamoto | 0:669ef71cba68 | 46 | int s1 : 1; |
t_yamamoto | 0:669ef71cba68 | 47 | int s2 : 1; |
t_yamamoto | 0:669ef71cba68 | 48 | int s3 : 1; |
t_yamamoto | 0:669ef71cba68 | 49 | int : 4; |
t_yamamoto | 0:669ef71cba68 | 50 | }; |
t_yamamoto | 0:669ef71cba68 | 51 | uint8_t all; |
t_yamamoto | 0:669ef71cba68 | 52 | } MP_Channel; |
t_yamamoto | 0:669ef71cba68 | 53 | } |
t_yamamoto | 0:669ef71cba68 | 54 | |
t_yamamoto | 0:669ef71cba68 | 55 | #endif |