aa

Dependencies:   mbed TrapezoidControl QEI

Files at this revision

API Documentation at this revision

Comitter:
7ka884
Date:
Mon Sep 10 01:39:15 2018 +0000
Parent:
0:669ef71cba68
Child:
2:c015739085d3
Commit message:
A

Changed in this revision

Communication/Controller/Mu/Mu.cpp Show annotated file Show diff for this revision Revisions of this file
Input/AccelerationSensor/AccelerationSensor.cpp Show annotated file Show diff for this revision Revisions of this file
Input/AccelerationSensor/AccelerationSensor.h Show annotated file Show diff for this revision Revisions of this file
Input/ColorSensor/ColorSensor.cpp Show annotated file Show diff for this revision Revisions of this file
Input/ColorSensor/ColorSensor.h Show annotated file Show diff for this revision Revisions of this file
Input/ExternalInt/ExternalInt.cpp Show annotated file Show diff for this revision Revisions of this file
Input/ExternalInt/ExternalInt.h Show annotated file Show diff for this revision Revisions of this file
Input/Potentiometer/Potentiometer.cpp Show annotated file Show diff for this revision Revisions of this file
Input/Potentiometer/Potentiometer.h Show annotated file Show diff for this revision Revisions of this file
Input/Rotaryencoder/Rotaryencoder.cpp Show annotated file Show diff for this revision Revisions of this file
Input/Rotaryencoder/Rotaryencoder.h Show annotated file Show diff for this revision Revisions of this file
Input/Switch/Switch.cpp Show annotated file Show diff for this revision Revisions of this file
Input/Switch/Switch.h Show annotated file Show diff for this revision Revisions of this file
System/Process/Process.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Communication/Controller/Mu/Mu.cpp	Sat Sep 08 06:05:22 2018 +0000
+++ b/Communication/Controller/Mu/Mu.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -1,7 +1,8 @@
 #include "Mu.h"
+#include "mbed.h"
 
 namespace MU {
-    Serial MuUart(MU_TX, MU_RX);
+	Serial MuUart(MU_TX, MU_RX);
 
     namespace {
 		char Group[][4]		= {"01", "02", "03", "04"};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/AccelerationSensor/AccelerationSensor.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,10 @@
+#include "AccelerationSensor.h"
+#include "mbed.h"
+
+namespace ACCELERATIONSENSOR {
+    AnalogIn acc[] = {
+        AnalogIn(ACCX_PIN),
+        AnalogIn(ACCY_PIN),
+        AnalogIn(ACCZ_PIN),
+    };
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/AccelerationSensor/AccelerationSensor.h	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,14 @@
+#ifndef ACCELERATIONSENSOR_H_
+#define ACCELERATIONSENSOR_H_
+
+#include "mbed.h"
+
+namespace ACCELERATIONSENSOR {
+    #define ACCX_PIN PA_0
+    #define ACCY_PIN PA_6
+    #define ACCZ_PIN PA_5
+
+    extern AnalogIn acc[];
+}
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/ColorSensor/ColorSensor.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,20 @@
+#include "ColorSensor.h"
+#include "mbed.h"
+
+namespace COLORSENSOR {
+    AnalogIn aco[] = {
+        AnalogIn(ACO0_PIN),
+        AnalogIn(ACO1_PIN),
+        AnalogIn(ACO2_PIN),
+        AnalogIn(ACO3_PIN),
+    };
+    
+    DigitalOut ColorDoutPin[] = {
+        DigitalOut(CK0_PIN),
+        DigitalOut(CK1_PIN),
+        DigitalOut(CK2_PIN),
+        DigitalOut(CK3_PIN),
+        DigitalOut(RANGE_PIN),
+        DigitalOut(GATE_PIN),
+    };
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/ColorSensor/ColorSensor.h	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,23 @@
+#ifndef COLORSENSOR_H_
+#define COLORSENSOR_H_
+
+#include "mbed.h"
+
+namespace COLORSENSOR {
+    #define ACO0_PIN PB_1
+    #define ACO1_PIN PC_5
+    #define ACO2_PIN PA_7
+    #define ACO3_PIN PC_4
+    
+    extern AnalogIn aco[];
+    
+    #define CK0_PIN PB_12
+    #define CK1_PIN PA_12
+    #define CK2_PIN PB_13
+    #define CK3_PIN PB_14
+    #define RANGE_PIN PA_11
+    #define GATE_PIN PB_15
+
+}
+
+#endif
--- a/Input/ExternalInt/ExternalInt.cpp	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/ExternalInt/ExternalInt.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -6,53 +6,14 @@
 InterruptIn BoardInt[] = {
     InterruptIn(INT0_PIN),
     InterruptIn(INT1_PIN),
-    InterruptIn(INT2_PIN),
-    InterruptIn(INT3_PIN),
-    InterruptIn(INT4_PIN),
-    InterruptIn(INT5_PIN),
-    InterruptIn(INT6_PIN),
-    InterruptIn(INT7_PIN),
-    InterruptIn(INT8_PIN),
-    InterruptIn(INT9_PIN),
-    InterruptIn(INT10_PIN),
-    InterruptIn(INT11_PIN),
-    InterruptIn(INT12_PIN),
-    InterruptIn(INT13_PIN),
-    InterruptIn(INT14_PIN),
 };
 
 namespace EXTERNALINT {
     void Int::Initialize() {
         BoardInt[0].mode(PullUp);
         BoardInt[1].mode(PullUp);
-        BoardInt[2].mode(PullUp);
-        BoardInt[3].mode(PullUp);
-        BoardInt[4].mode(PullUp);
-        BoardInt[5].mode(PullUp);
-        BoardInt[6].mode(PullUp);
-        BoardInt[7].mode(PullUp);
-        BoardInt[8].mode(PullUp);
-        BoardInt[9].mode(PullUp);
-        BoardInt[10].mode(PullUp);
-        BoardInt[11].mode(PullUp);
-        BoardInt[12].mode(PullUp);
-        BoardInt[13].mode(PullUp);
-        BoardInt[14].mode(PullUp);
 
         BoardInt[0].fall(int0);
         BoardInt[1].fall(int1);
-        BoardInt[2].fall(int2);
-        BoardInt[3].fall(int3);
-        BoardInt[4].fall(int4);
-        BoardInt[5].fall(int5);
-        BoardInt[6].fall(int6);
-        BoardInt[7].fall(int7);
-        BoardInt[8].fall(int8);
-        BoardInt[9].fall(int9);
-        BoardInt[10].fall(int10);
-        BoardInt[11].fall(int11);
-        BoardInt[12].fall(int12);
-        BoardInt[13].fall(int13);
-        BoardInt[14].fall(int14);
     }
 }
--- a/Input/ExternalInt/ExternalInt.h	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/ExternalInt/ExternalInt.h	Mon Sep 10 01:39:15 2018 +0000
@@ -2,21 +2,8 @@
 #define EXTERNALINT_H_
 
 namespace EXTERNALINT {
-    #define INT0_PIN    PC_5
-    #define INT1_PIN    PA_12
-    #define INT2_PIN    PA_11
-    #define INT3_PIN    PB_12
-    #define INT4_PIN    PB_2
-    #define INT5_PIN    PB_1
-    #define INT6_PIN    PB_15
-    #define INT7_PIN    PB_14
-    #define INT8_PIN    PB_13
-    #define INT9_PIN    PC_4
-    #define INT10_PIN   PB_3
-    #define INT11_PIN   PB_5
-    #define INT12_PIN   PB_4
-    #define INT13_PIN   PB_10
-    #define INT14_PIN   PA_8
+    #define INT0_PIN    PB_3
+    #define INT1_PIN    PB_2
 
     class Int {
         public:
--- a/Input/Potentiometer/Potentiometer.cpp	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/Potentiometer/Potentiometer.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -6,6 +6,5 @@
         AnalogIn(ADC0_PIN),
         AnalogIn(ADC1_PIN),
         AnalogIn(ADC2_PIN),
-        AnalogIn(ADC3_PIN),
     };
 }
--- a/Input/Potentiometer/Potentiometer.h	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/Potentiometer/Potentiometer.h	Mon Sep 10 01:39:15 2018 +0000
@@ -4,10 +4,9 @@
 #include "mbed.h"
 
 namespace POTENTIOMETER {
-    #define ADC0_PIN PC_2
-    #define ADC1_PIN PC_3
-    #define ADC2_PIN PC_0
-    #define ADC3_PIN PC_1
+    #define ADC0_PIN PC_3
+    #define ADC1_PIN PC_0
+    #define ADC2_PIN PC_1
 
     extern AnalogIn adc[];
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Rotaryencoder/Rotaryencoder.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,26 @@
+#include "Rotaryencoder.h"
+#include "mbed.h"
+
+#include "../../System/Process/InterruptProcess.h"
+
+InterruptIn BoardRtInt[] = {
+    InterruptIn(RT11_PIN),
+    InterruptIn(RT12_PIN),
+    
+    InterruptIn(RT21_PIN),
+    InterruptIn(RT22_PIN),
+};
+
+namespace ROTARYENCODER {
+    void Int::Initialize() {
+        BoardRtInt[0].mode(PullUp);
+        BoardRtInt[1].mode(PullUp);
+        BoardRtInt[2].mode(PullUp);
+        BoardRtInt[3].mode(PullUp);
+
+        BoardRtInt[0].fall(int0);
+        BoardRtInt[1].fall(int1);
+        BoardRtInt[2].fall(int2);
+        BoardRtInt[3].fall(int3);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Rotaryencoder/Rotaryencoder.h	Mon Sep 10 01:39:15 2018 +0000
@@ -0,0 +1,17 @@
+#ifndef ROTARYENCODER_H_
+#define ROTARYENCODER_H_
+
+namespace ROTARYENCODER {
+    #define RT11_PIN    PB_0
+    #define RT12_PIN    PA_4
+    
+    #define RT21_PIN    PC_2
+    #define RT22_PIN    PA_1
+
+    class Int {
+        public:
+        static void Initialize();
+    };
+}
+
+#endif
\ No newline at end of file
--- a/Input/Switch/Switch.cpp	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/Switch/Switch.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -45,14 +45,47 @@
         printf("%d\n", index);
 
         MP_Channel ch;
-        ch.all = index;
+        
+        switch(index){
+            case 0:
+            ch.all = 10;
+            break;
+            case 1:
+            ch.all = 11;
+            break;
+            case 2:
+            ch.all = 8;
+            break;
+            case 3:
+            ch.all = 9;
+            break;
+            case 4:
+            ch.all = 6;
+            break;
+            case 5:
+            ch.all = 7;
+            break;
+            case 6:
+            ch.all = 4;
+            break;
+            case 7:
+            ch.all = 5;
+            break;
+            case 8:
+            ch.all = 2;
+            break;
+            case 9:
+            ch.all = 3;
+            break;
+        }
+        
 
         selectPin[0] = ch.s0;
         selectPin[1] = ch.s1;
         selectPin[2] = ch.s2;
         selectPin[3] = ch.s3;
 
-        while(1);
+        wait_us(1);
 
         return limitSw ? false : true;
     }
--- a/Input/Switch/Switch.h	Sat Sep 08 06:05:22 2018 +0000
+++ b/Input/Switch/Switch.h	Mon Sep 10 01:39:15 2018 +0000
@@ -8,17 +8,20 @@
     #define SW_ON   0
     #define SW_OFF  1
 
-    #define DIP0_PIN    PB_0
-    #define DIP1_PIN    PA_4
-    #define DIP2_PIN    PA_1
-    #define DIP3_PIN    PA_0
+    
+    #define DIP0_PIN    PA_8
+    #define DIP1_PIN    PB_10
+    #define DIP2_PIN    PB_4
+    #define DIP3_PIN    PB_5
 
+    //マルチプレクサ
     #define LS_PIN      PB_6
     #define SELECT0_PIN PC_8
     #define SELECT1_PIN PC_9
     #define SELECT2_PIN PB_9
     #define SELECT3_PIN PB_8
 
+    //Dipsw
     #define DIP0    dipSw[0]
     #define DIP1    dipSw[1]
     #define DIP2    dipSw[2]
--- a/System/Process/Process.cpp	Sat Sep 08 06:05:22 2018 +0000
+++ b/System/Process/Process.cpp	Mon Sep 10 01:39:15 2018 +0000
@@ -5,7 +5,10 @@
 #include "../../Communication/Controller/Controller.h"
 #include "../../Input/ExternalInt/ExternalInt.h"
 #include "../../Input/Switch/Switch.h"
+#include "../../Input/ColorSensor/ColorSensor.h"
+#include "../../Input/AccelerationSensor/AccelerationSensor.h"
 #include "../../Input/Potentiometer/Potentiometer.h"
+#include "../../Input/Rotaryencoder/Rotaryencoder.h"
 #include "../../LED/LED.h"
 #include "../../Safty/Safty.h"
 #include "../Using.h"