lknds
Dependencies: mbed TrapezoidControl Pulse QEI
Input/Switch/Switch.h@0:669ef71cba68, 2018-09-08 (annotated)
- Committer:
- t_yamamoto
- Date:
- Sat Sep 08 06:05:22 2018 +0000
- Revision:
- 0:669ef71cba68
- Child:
- 1:b1219d8ca117
???????
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 | |
t_yamamoto | 0:669ef71cba68 | 11 | #define DIP0_PIN PB_0 |
t_yamamoto | 0:669ef71cba68 | 12 | #define DIP1_PIN PA_4 |
t_yamamoto | 0:669ef71cba68 | 13 | #define DIP2_PIN PA_1 |
t_yamamoto | 0:669ef71cba68 | 14 | #define DIP3_PIN PA_0 |
t_yamamoto | 0:669ef71cba68 | 15 | |
t_yamamoto | 0:669ef71cba68 | 16 | #define LS_PIN PB_6 |
t_yamamoto | 0:669ef71cba68 | 17 | #define SELECT0_PIN PC_8 |
t_yamamoto | 0:669ef71cba68 | 18 | #define SELECT1_PIN PC_9 |
t_yamamoto | 0:669ef71cba68 | 19 | #define SELECT2_PIN PB_9 |
t_yamamoto | 0:669ef71cba68 | 20 | #define SELECT3_PIN PB_8 |
t_yamamoto | 0:669ef71cba68 | 21 | |
t_yamamoto | 0:669ef71cba68 | 22 | #define DIP0 dipSw[0] |
t_yamamoto | 0:669ef71cba68 | 23 | #define DIP1 dipSw[1] |
t_yamamoto | 0:669ef71cba68 | 24 | #define DIP2 dipSw[2] |
t_yamamoto | 0:669ef71cba68 | 25 | #define DIP3 dipSw[3] |
t_yamamoto | 0:669ef71cba68 | 26 | |
t_yamamoto | 0:669ef71cba68 | 27 | class DipSw { |
t_yamamoto | 0:669ef71cba68 | 28 | public: |
t_yamamoto | 0:669ef71cba68 | 29 | static void Initialize(); |
t_yamamoto | 0:669ef71cba68 | 30 | static uint8_t GetStatus(); |
t_yamamoto | 0:669ef71cba68 | 31 | }; |
t_yamamoto | 0:669ef71cba68 | 32 | |
t_yamamoto | 0:669ef71cba68 | 33 | class LimitSw { |
t_yamamoto | 0:669ef71cba68 | 34 | public: |
t_yamamoto | 0:669ef71cba68 | 35 | static void Initialize(); |
t_yamamoto | 0:669ef71cba68 | 36 | static bool IsPressed(int index); |
t_yamamoto | 0:669ef71cba68 | 37 | }; |
t_yamamoto | 0:669ef71cba68 | 38 | |
t_yamamoto | 0:669ef71cba68 | 39 | typedef union { |
t_yamamoto | 0:669ef71cba68 | 40 | struct { |
t_yamamoto | 0:669ef71cba68 | 41 | int s0 : 1; |
t_yamamoto | 0:669ef71cba68 | 42 | int s1 : 1; |
t_yamamoto | 0:669ef71cba68 | 43 | int s2 : 1; |
t_yamamoto | 0:669ef71cba68 | 44 | int s3 : 1; |
t_yamamoto | 0:669ef71cba68 | 45 | int : 4; |
t_yamamoto | 0:669ef71cba68 | 46 | }; |
t_yamamoto | 0:669ef71cba68 | 47 | uint8_t all; |
t_yamamoto | 0:669ef71cba68 | 48 | } MP_Channel; |
t_yamamoto | 0:669ef71cba68 | 49 | } |
t_yamamoto | 0:669ef71cba68 | 50 | |
t_yamamoto | 0:669ef71cba68 | 51 | #endif |