lknds

Dependencies:   mbed TrapezoidControl Pulse QEI

Committer:
Ryosei
Date:
Fri Sep 27 05:19:58 2019 +0000
Revision:
25:d367d1e7a153
Parent:
22:7d93f79a3686
dskb

Who changed what in which revision?

UserRevisionLine numberNew 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]
M_souta 22:7d93f79a3686 30
M_souta 22:7d93f79a3686 31 //Normal
M_souta 22:7d93f79a3686 32 #define LS_16 PB_6
M_souta 22:7d93f79a3686 33 #define LS_17 PB_9
M_souta 22:7d93f79a3686 34 #define LS_18 PB_8
M_souta 22:7d93f79a3686 35 #define LS_19 PC_9
M_souta 22:7d93f79a3686 36 #define LS_20 PC_8
t_yamamoto 0:669ef71cba68 37
t_yamamoto 0:669ef71cba68 38 class DipSw {
t_yamamoto 0:669ef71cba68 39 public:
t_yamamoto 0:669ef71cba68 40 static void Initialize();
t_yamamoto 0:669ef71cba68 41 static uint8_t GetStatus();
t_yamamoto 0:669ef71cba68 42 };
t_yamamoto 0:669ef71cba68 43
t_yamamoto 0:669ef71cba68 44 class LimitSw {
t_yamamoto 0:669ef71cba68 45 public:
t_yamamoto 0:669ef71cba68 46 static void Initialize();
t_yamamoto 0:669ef71cba68 47 static bool IsPressed(int index);
t_yamamoto 0:669ef71cba68 48 };
t_yamamoto 0:669ef71cba68 49
t_yamamoto 0:669ef71cba68 50 typedef union {
t_yamamoto 0:669ef71cba68 51 struct {
t_yamamoto 0:669ef71cba68 52 int s0 : 1;
t_yamamoto 0:669ef71cba68 53 int s1 : 1;
t_yamamoto 0:669ef71cba68 54 int s2 : 1;
t_yamamoto 0:669ef71cba68 55 int s3 : 1;
t_yamamoto 0:669ef71cba68 56 int : 4;
t_yamamoto 0:669ef71cba68 57 };
t_yamamoto 0:669ef71cba68 58 uint8_t all;
t_yamamoto 0:669ef71cba68 59 } MP_Channel;
t_yamamoto 0:669ef71cba68 60 }
t_yamamoto 0:669ef71cba68 61
t_yamamoto 0:669ef71cba68 62 #endif