aa

Dependencies:   mbed TrapezoidControl QEI

Files at this revision

API Documentation at this revision

Comitter:
t_yamamoto
Date:
Sat Sep 08 06:05:22 2018 +0000
Child:
1:b1219d8ca117
Commit message:
???????

Changed in this revision

CommonLibraries/RingBuffer/RingBuffer.cpp Show annotated file Show diff for this revision Revisions of this file
CommonLibraries/RingBuffer/RingBuffer.h Show annotated file Show diff for this revision Revisions of this file
Communication/Controller/Controller.cpp Show annotated file Show diff for this revision Revisions of this file
Communication/Controller/Controller.h Show annotated file Show diff for this revision Revisions of this file
Communication/Controller/Mu/Mu.cpp Show annotated file Show diff for this revision Revisions of this file
Communication/Controller/Mu/Mu.h Show annotated file Show diff for this revision Revisions of this file
Communication/RS485/ActuatorHub/ActuatorHub.cpp Show annotated file Show diff for this revision Revisions of this file
Communication/RS485/ActuatorHub/ActuatorHub.h Show annotated file Show diff for this revision Revisions of this file
Communication/RS485/RS485.cpp Show annotated file Show diff for this revision Revisions of this file
Communication/RS485/RS485.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/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
LED/LED.cpp Show annotated file Show diff for this revision Revisions of this file
LED/LED.h Show annotated file Show diff for this revision Revisions of this file
Safty/Safty.cpp Show annotated file Show diff for this revision Revisions of this file
Safty/Safty.h Show annotated file Show diff for this revision Revisions of this file
System/Initialize/Initialize.cpp Show annotated file Show diff for this revision Revisions of this file
System/Initialize/Initialize.h Show annotated file Show diff for this revision Revisions of this file
System/Process/InterruptProcess.cpp Show annotated file Show diff for this revision Revisions of this file
System/Process/InterruptProcess.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
System/Process/Process.h Show annotated file Show diff for this revision Revisions of this file
System/Using.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CommonLibraries/RingBuffer/RingBuffer.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,103 @@
+/*
+* RingBuffer.cpp
+*
+* Created: 2016/08/10 12:14:47
+*  Author: masuk
+*/
+
+#include "mbed.h"
+#include "RingBuffer.h"
+
+namespace RINGBUFFER
+{
+
+	RingBuffer::RingBuffer(char *bufPtr, int size)
+	{
+		Buffer.data = bufPtr;
+		Buffer.size = size;
+		Buffer.top = 0;
+		Buffer.bottom = 0;
+		Buffer.fullup = false;
+	}
+
+	void RingBuffer::PutData(char data, bool ASCIItoNum /* = false */)
+	{
+		__disable_irq();
+		if(!Buffer.fullup)
+		{
+			if(ASCIItoNum) Buffer.data[Buffer.top] = data+48;
+			else		   Buffer.data[Buffer.top] = data;
+			Buffer.length++;
+			Buffer.top++;
+			Buffer.top %= Buffer.size;
+			Buffer.fullup = false;
+			if(Buffer.length>=Buffer.size) Buffer.fullup = true;
+		}
+		__enable_irq();
+	}
+
+	void RingBuffer::PutData(char *data, int length)
+	{
+		__disable_irq();
+		for(int i=0; i<length; i++)
+		{
+			if(!Buffer.fullup)
+			{
+				Buffer.data[Buffer.top] = data[i];
+				Buffer.length++;
+				Buffer.top++;
+				Buffer.top %= Buffer.size;
+				Buffer.fullup = false;
+				if(Buffer.length>=Buffer.size) Buffer.fullup = true;
+			}
+		}
+		__enable_irq();
+	}
+
+	void RingBuffer::PutData(const char *str)
+	{
+		__disable_irq();
+		for( ; *str!='\0'; str++)
+		{
+			if(!Buffer.fullup)
+			{
+				Buffer.data[Buffer.top] = *str;
+				Buffer.length++;
+				Buffer.top++;
+				Buffer.top %= Buffer.size;
+				if(Buffer.length>=Buffer.size) Buffer.fullup = true;
+				else						   Buffer.fullup = false;
+			}
+		}
+		__enable_irq();
+	}
+
+	char RingBuffer::GetData()
+	{
+		__disable_irq();
+		char data;
+		if(Buffer.length > 0)
+		{
+			data = Buffer.data[Buffer.bottom];
+			Buffer.length--;
+			Buffer.bottom++;
+			Buffer.bottom %= Buffer.size;
+			if(Buffer.length<Buffer.size) Buffer.fullup = false;
+		}
+		else data = '\0';
+		__enable_irq();
+		return data;
+	}
+
+	bool RingBuffer::IsFullup()
+	{
+		return Buffer.fullup;
+	}
+
+	bool RingBuffer::InAnyData()
+	{
+		if(Buffer.length > 0) return true;
+		else return false;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CommonLibraries/RingBuffer/RingBuffer.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,49 @@
+/*
+ * RingBuffer.h
+ *
+ * Created: 2016/08/10 12:15:08
+ *  Author: masuk
+ */ 
+
+
+#ifndef RINGBUFFER_H_
+#define RINGBUFFER_H_
+
+#include <stdint.h>
+
+namespace RINGBUFFER
+{
+	//循環型バッファ 使用するバッファの配列と大きさを指定してください
+	class RingBuffer
+	{
+		struct
+		{
+			char *data;
+			int size;
+			uint8_t top;
+			uint8_t bottom;
+			uint8_t length;
+			bool fullup;
+		}Buffer;
+		
+		public:
+		RingBuffer(char *bufPtr, int size);
+		
+		//バッファにデータを追加
+		void PutData(char data, bool ASCIItoNum = false);
+		void PutData(char *data, int length);
+		void PutData(const char *str);
+		
+		//バッファからデータを1byte読み出し
+		char GetData();	
+		
+		//バッファが飽和しているか確認
+		bool IsFullup();
+		//バッファにデータが存在するか確認
+		bool InAnyData();
+	};
+}
+
+
+
+#endif /* RINGBUFFER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/Controller/Controller.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,100 @@
+#include "Controller.h"
+
+#include "Mu/Mu.h"
+#include "../../../LED/LED.h"
+
+using namespace MU;
+
+namespace CONTROLLER {
+    Ticker MuTimer;
+
+    void UartUpdate();
+    void LostCheck();
+
+    namespace {
+        ControllerData ctrData;
+        ControllerData keepCtrData;
+        const uint8_t defaultData[4] = CTR_DEFAULT_DATA;
+        const char check[] = "DR=";
+        volatile char packet[24];
+
+        bool controllerLost = false;
+
+        uint8_t timerCount = 0;
+    }
+
+    void Controller::Initialize() {
+        MuUart.attach(UartUpdate, Serial::RxIrq);
+        MuTimer.attach(LostCheck, 0.025);
+        DataReset();
+    }
+
+    ControllerData* Controller::GetData() {
+        __disable_irq();
+        for(uint8_t i=0; i<CTR_DATA_LENGTH; i++) keepCtrData.buf[i] = ctrData.buf[i];
+        __enable_irq();
+        return &keepCtrData;
+    }
+
+    void Controller::DataReset() {
+        // __disable_irq();
+        for(uint8_t i=0; i<CTR_DATA_LENGTH; i++) ctrData.buf[i] = defaultData[i];
+        // __enable_irq();
+    }
+
+    bool Controller::CheckControllerLost() {
+        return controllerLost;
+    }
+
+    void UartUpdate() {
+        static bool phase = false;
+        static uint8_t count = 0;
+        static uint8_t ledCount = 0;
+
+        char data = MuUart.getc();
+
+        if(phase) {
+            packet[count] = data;
+            if(count < 2) {
+                if(data != check[count]) {
+                    phase = false;
+                    // controllerLost = true;
+                    LED_MU = LED_OFF;
+                }
+            }
+            else if(count == 9) {
+                if(data != '\r') {
+                    phase = false;
+                    count = 0;
+                } else {
+                    ctrData.buf[0] = packet[5];
+                    ctrData.buf[1] = packet[6];
+                    ctrData.buf[2] = packet[7];
+                    ctrData.buf[3] = packet[8];
+                    phase = false;
+                    timerCount = 0;
+                    controllerLost = false;
+                    LED_MU = LED_ON;
+                }
+            }
+            count++;
+        }
+        else {
+            if(data == '*') {
+                count = 0;
+                phase = true;
+            }
+        }
+    }
+
+    void LostCheck() {
+        timerCount++;
+        if(timerCount == 2) LED_MU = LED_OFF;
+        if(timerCount >= 20) {
+            controllerLost = true;
+            Controller::DataReset();
+            timerCount = 0;
+            LED_MU = LED_OFF;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/Controller/Controller.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,56 @@
+#ifndef CONTROLLER_H_
+#define CONTROLLER_H_
+
+#include <stdint.h>
+
+namespace CONTROLLER {
+    #define MU_TX PC_6
+    #define MU_RX PC_7
+    
+    #define CTR_DATA_LENGTH 4
+    #define CTR_DEFAULT_DATA {0x00, 0x00, 0x77, 0x77}
+
+	typedef union 
+	{
+		struct {
+			struct {
+				unsigned int X:1;
+				unsigned int A:1;
+				unsigned int B:1;
+				unsigned int Y:1;
+				unsigned int UP:1;
+				unsigned int RIGHT:1;
+				unsigned int DOWN:1;
+				unsigned int LEFT:1;
+				unsigned int SELECT:1;
+				unsigned int HOME:1;
+				unsigned int START:1;
+				unsigned int ZL:1;
+				unsigned int ZR:1;
+				unsigned int L:1;
+				unsigned int R:1;
+				unsigned int :1;
+			} __attribute__ ((packed)) Button;
+			struct {
+				unsigned int Y:4;
+				unsigned int X:4;
+			} __attribute__ ((packed)) AnalogL;
+			struct {
+				unsigned int Y:4;
+				unsigned int X:4;
+			} __attribute__ ((packed)) AnalogR;
+		} __attribute__ ((packed)) ;
+		uint8_t buf[CTR_DATA_LENGTH];		
+	}ControllerData;
+    
+    class Controller
+    {
+        public:
+            static void Initialize(void);
+            static ControllerData* GetData(void);
+            static void DataReset(void);
+            static bool CheckControllerLost(void);
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/Controller/Mu/Mu.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,33 @@
+#include "Mu.h"
+
+namespace MU {
+    Serial MuUart(MU_TX, MU_RX);
+
+    namespace {
+		char Group[][4]		= {"01", "02", "03", "04"};
+		char Channel[][4]	= {"08", "14", "1F", "2E"};
+		char DI[][4]		= {"10", "20", "40", "80"};
+		char EI[][4]		= {"01", "02", "04", "08"};
+    }
+
+	void Mu::SendCommand(char *command, char *value, uint8_t valueLength) {
+        MuUart.putc('@');
+        MuUart.putc(command[0]);
+        MuUart.putc(command[1]);
+        while(valueLength--) {
+            MuUart.putc(*value);
+            value++;
+        }
+        MuUart.putc('\r');
+        MuUart.putc('\n');
+    }
+
+    void Mu::Initialize(uint8_t select) {
+        MuUart.baud(19200);
+
+		Mu::SendCommand("GI",Group[select],2);
+		Mu::SendCommand("CH",Channel[select],2);
+		Mu::SendCommand("DI",DI[select],2);
+		Mu::SendCommand("EI",EI[select],2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/Controller/Mu/Mu.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,20 @@
+#ifndef MU_H_
+#define MU_H_
+
+#include <stdint.h>
+#include "mbed.h"
+
+namespace MU {
+    #define MU_TX PC_6
+    #define MU_RX PC_7
+
+    class Mu {
+        public:
+        static void Initialize(uint8_t select);
+        static void SendCommand(char *command, char *data, uint8_t dataLength);
+    };
+
+    extern Serial MuUart;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/RS485/ActuatorHub/ActuatorHub.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,186 @@
+#include "ActuatorHub.h"
+#include "mbed.h"
+
+#include "../../../CommonLibraries/RingBuffer/RingBuffer.h"
+#include "../../../System/Using.h"
+
+static char RS485Send[RS485_BUFFER_SIZE];
+static char BluetoothSend[BLUETOOTH_BUFFER_SIZE];
+
+RINGBUFFER::RingBuffer RS485SendBuffer = RINGBUFFER::RingBuffer(RS485Send, RS485_BUFFER_SIZE);
+RINGBUFFER::RingBuffer BluetoothSendBuffer = RINGBUFFER::RingBuffer(BluetoothSend, BLUETOOTH_BUFFER_SIZE);
+
+namespace ACTUATORHUB {
+    namespace MOTOR {
+        AllMotorData sendMotorData[(MOUNTING_MOTOR_NUM+12) / 13];
+
+        namespace {
+            MotorStatus motor[MOUNTING_MOTOR_NUM];
+        }
+
+        void Motor::Initialize() {
+            #if MOUNTING_MOTOR_NUM > 0
+            sendMotorData[0].direction0to3.all = 0;
+            sendMotorData[0].direction4to7.all = 0;
+            sendMotorData[0].direction8to9.all = 0;
+            #endif
+            #if MOUNTING_MOTOR_NUM > 13
+            sendMotorData[1].direction0to3.all = 0;
+            sendMotorData[1].direction4to7.all = 0;
+            sendMotorData[1].direction8to9.all = 0;
+            #endif
+            #if MOUNTING_MOTOR_NUM > 26
+            sendMotorData[2].direction0to3.all = 0;
+            sendMotorData[2].direction4to7.all = 0;
+            sendMotorData[2].direction8to9.all = 0;
+            #endif
+
+            uint8_t* pwmPo = &sendMotorData[0].pwm0;
+            for(uint8_t i=0; i<MOUNTING_MOTOR_NUM; i++) {
+                *pwmPo = 0;
+                pwmPo++;
+            }
+
+            SetDefault();
+        }
+
+        void Motor::Update(MotorStatus *status) {
+            for(uint8_t i=0; i<MOUNTING_MOTOR_NUM; i++) motor[i] = status[i];
+
+			#if MOUNTING_MOTOR_NUM > 0
+            sendMotorData[0].direction0to3.data0 = motor[0].dir;
+			sendMotorData[0].direction0to3.data1 = motor[1].dir;
+			sendMotorData[0].direction0to3.data2 = motor[2].dir;
+			sendMotorData[0].direction0to3.data3 = motor[3].dir;
+			sendMotorData[0].direction4to7.data0 = motor[4].dir;
+			sendMotorData[0].direction4to7.data1 = motor[5].dir;
+			sendMotorData[0].direction4to7.data2 = motor[6].dir;
+			sendMotorData[0].direction4to7.data3 = motor[7].dir;
+			sendMotorData[0].direction8to9.data0 = motor[8].dir;
+			sendMotorData[0].direction8to9.data1 = motor[9].dir;
+            #endif
+            #if MOUNTING_MOTOR_NUM > 13
+			sendMotorData[1].direction0to3.data0 = motor[13].dir;
+			sendMotorData[1].direction0to3.data1 = motor[14].dir;
+			sendMotorData[1].direction0to3.data2 = motor[15].dir;
+			sendMotorData[1].direction0to3.data3 = motor[16].dir;
+			sendMotorData[1].direction4to7.data0 = motor[17].dir;
+			sendMotorData[1].direction4to7.data1 = motor[18].dir;
+			sendMotorData[1].direction4to7.data2 = motor[19].dir;
+			sendMotorData[1].direction4to7.data3 = motor[20].dir;
+			sendMotorData[1].direction8to9.data0 = motor[21].dir;
+			sendMotorData[1].direction8to9.data1 = motor[22].dir;
+            #endif
+            #if MOUNTING_MOTOR_NUM > 26
+			sendMotorData[2].direction0to3.data0 = motor[26].dir;
+			sendMotorData[2].direction0to3.data1 = motor[27].dir;
+			sendMotorData[2].direction0to3.data2 = motor[28].dir;
+			sendMotorData[2].direction0to3.data3 = motor[29].dir;
+			sendMotorData[2].direction4to7.data0 = motor[30].dir;
+			sendMotorData[2].direction4to7.data1 = motor[31].dir;
+			sendMotorData[2].direction4to7.data2 = motor[32].dir;
+			sendMotorData[2].direction4to7.data3 = motor[33].dir;
+			sendMotorData[2].direction8to9.data0 = motor[34].dir;
+			sendMotorData[2].direction8to9.data1 = motor[35].dir;
+            #endif
+            
+			uint8_t* pwmPo = &sendMotorData[0].pwm0;
+			for (uint8_t i = 0;i < MOUNTING_MOTOR_NUM;i++)
+			{
+				*pwmPo = motor[i].pwm;
+				pwmPo++;
+			}
+        }
+
+        void Motor::SetDefault() {
+            for(uint8_t i=0; i<MOUNTING_MOTOR_NUM; i++) {
+                motor[i].dir = FREE;
+                motor[i].pwm = 0;
+            }
+        }
+    }
+
+    namespace SOLENOID {
+        SolenoidStatus sendSolenoidData;
+
+        void Solenoid::Initialize() {
+            sendSolenoidData.all = ALL_SOLENOID_OFF;
+        }
+
+        void Solenoid::Update(SolenoidStatus status) {
+            sendSolenoidData.all = status.all;
+        }
+    }
+
+    void ActuatorHub::Update() {
+        if(!RS485SendBuffer.InAnyData()) {
+            // __disable_irq();
+
+            #ifdef USE_MOTOR
+            #if MOUNTING_MOTOR_NUM > 0
+            RS485SendBuffer.PutData('*');
+            RS485SendBuffer.PutData(MOTOR_ADDR);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[0].direction0to3.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[0].direction4to7.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[0].direction8to9.all);
+            uint8_t* pwmPo = &MOTOR::sendMotorData[0].pwm0;
+            for(uint8_t i=0; i<13; i++) {
+                RS485SendBuffer.PutData(*pwmPo);
+                pwmPo++;
+            }
+            RS485SendBuffer.PutData('\r');
+            #endif
+
+            #if MOUNTING_MOTOR_NUM > 13
+            RS485SendBuffer.PutData('*');
+            RS485SendBuffer.PutData(MOTOR2_ADDR);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[1].direction0to3.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[1].direction4to7.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[1].direction8to9.all);
+            pwmPo = &MOTOR::sendMotorData[1].pwm0;
+            for(uint8_t i=0; i<13; i++) {
+                RS485SendBuffer.PutData(*pwmPo);
+                pwmPo++;
+            }
+            RS485SendBuffer.PutData('\r');
+            #endif
+
+            #if MOUNTING_MOTOR_NUM > 26
+            RS485SendBuffer.PutData('*');
+            RS485SendBuffer.PutData(MOTOR3_ADDR);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[2].direction0to3.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[2].direction4to7.all);
+            RS485SendBuffer.PutData(MOTOR::sendMotorData[2].direction8to9.all);
+            pwmPo = &MOTOR::sendMotorData[2].pwm0;
+            for(uint8_t i=0; i<(MOUNTING_MOTOR_NUM-26); i++) {
+                RS485SendBuffer.PutData(*pwmPo);
+                pwmPo++;
+            }
+            RS485SendBuffer.PutData('\r');
+            #endif
+            #endif
+
+            #ifdef USE_SOLENOID
+            RS485SendBuffer.PutData('*');
+            RS485SendBuffer.PutData(SOLENOID_ADDR);
+            RS485SendBuffer.PutData((SOLENOID::sendSolenoidData.all & 0xff00) >> 8);
+            RS485SendBuffer.PutData(SOLENOID::sendSolenoidData.all & 0x00ff);
+            RS485SendBuffer.PutData('\r');
+            #endif
+
+            #ifdef USE_BLUETOOTH
+            if(BluetoothSendBuffer.InAnyData()) {
+                RS485SendBuffer.PutData('*');
+                RS485SendBuffer.PutData(BLUETOOTH_ADDR);
+                while(BluetoothSendBuffer.InAnyData()) {
+                    RS485SendBuffer.PutData(BluetoothSendBuffer.GetData());
+                }
+                RS485SendBuffer.PutData(disconnect);
+            }
+            #endif
+
+            // __enable_irq();
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/RS485/ActuatorHub/ActuatorHub.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,104 @@
+#ifndef ACTUATORHUB_H_
+#define ACTUATORHUB_H_
+
+#include "../../../CommonLibraries/RingBuffer/RingBuffer.h"
+
+extern RINGBUFFER::RingBuffer RS485SendBuffer;
+extern RINGBUFFER::RingBuffer BluetoothSendBuffer;
+
+namespace ACTUATORHUB {
+    #define MOTOR_ADDR      'M'
+    #define MOTOR2_ADDR     'N'
+    #define MOTOR3_ADDR     'O'
+    #define SOLENOID_ADDR   'S'
+    #define BLUETOOTH_ADDR  'B'
+
+    namespace MOTOR {
+        #define FREE    0
+        #define BACK    1
+        #define FOR     2
+        #define BRAKE   3
+
+        typedef struct {
+            uint8_t dir;
+            uint8_t pwm;
+        }MotorStatus;
+
+        typedef union {
+            struct {
+                int data3 : 2;
+                int data2 : 2;
+                int data1 : 2;
+                int data0 : 2;
+            };
+            uint8_t all;
+        }MotorDirectionData;
+
+        typedef struct {
+            MotorDirectionData direction0to3;
+            MotorDirectionData direction4to7;
+            MotorDirectionData direction8to9;
+
+            uint8_t pwm0;
+            uint8_t pwm1;
+            uint8_t pwm2;
+            uint8_t pwm3;
+            uint8_t pwm4;
+            uint8_t pwm5;
+            uint8_t pwm6;
+            uint8_t pwm7;
+            uint8_t pwm8;
+            uint8_t pwm9;
+            uint8_t pwm10;
+            uint8_t pwm11;
+            uint8_t pwm12;
+        }AllMotorData;
+
+        class Motor {
+            public:
+            static void Initialize();
+            static void Update(MotorStatus *status);
+            static void SetDefault();
+        };
+    }
+
+    namespace SOLENOID {
+        #define SOLENOID_ON     1
+        #define SOLENOID_OFF    0
+
+        #define ALL_SOLENOID_ON     0xffff
+        #define ALL_SOLENOID_OFF    0
+
+        typedef union {
+            struct {
+                int : 4;
+                int solenoid11 : 1;
+                int solenoid10 : 1;
+                int solenoid9 : 1;
+                int solenoid8 : 1;
+                int solenoid7 : 1;
+                int solenoid6 : 1;
+                int solenoid5 : 1;
+                int solenoid4 : 1;
+                int solenoid3 : 1;
+                int solenoid2 : 1;
+                int solenoid1 : 1;
+                int solenoid0 : 1;
+            };
+            uint16_t all;
+        }SolenoidStatus;
+
+        class Solenoid {
+            public:
+            static void Initialize();
+            static void Update(SolenoidStatus status);
+        };
+    }
+
+    class ActuatorHub {
+        public:
+        static void Update();
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/RS485/RS485.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,32 @@
+#include "RS485.h"
+#include "mbed.h"
+#include "ActuatorHub/ActuatorHub.h"
+#include "../../LED/LED.h"
+#include "../../System/Using.h"
+
+namespace RS485 {
+    DigitalOut selectBit(SELECTBIT_PIN);
+    Serial RS485Uart(RS485UART_TX, RS485UART_RX);
+
+    void Transmit();
+
+    void RS485::Initialize() {
+        selectBit = 1;  //送信固定
+        RS485Uart.baud(38400);
+        RS485Uart.attach(Transmit, Serial::TxIrq);
+    }
+
+    void Transmit() {
+        static uint8_t count = 0;
+        __disable_irq();
+        RS485Uart.putc(RS485SendBuffer.GetData());
+        if(count >= 200) {
+            #ifdef USE_MOTOR
+            LED_DEBUG2 = !LED_DEBUG2;
+            #endif
+
+            count = 0;
+        } else count++;
+        __enable_irq();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/RS485/RS485.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,16 @@
+#ifndef RS485_H_
+#define RS485_H_
+
+namespace RS485 {
+    #define SELECTBIT_PIN PB_7
+
+    #define RS485UART_TX PA_9
+    #define RS485UART_RX PA_10
+    
+    class RS485 {
+        public:
+        static void Initialize();
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/ExternalInt/ExternalInt.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,58 @@
+#include "ExternalInt.h"
+#include "mbed.h"
+
+#include "../../System/Process/InterruptProcess.h"
+
+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);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/ExternalInt/ExternalInt.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,27 @@
+#ifndef EXTERNALINT_H_
+#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
+
+    class Int {
+        public:
+        static void Initialize();
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Potentiometer/Potentiometer.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,11 @@
+#include "Potentiometer.h"
+#include "mbed.h"
+
+namespace POTENTIOMETER {
+    AnalogIn adc[] = {
+        AnalogIn(ADC0_PIN),
+        AnalogIn(ADC1_PIN),
+        AnalogIn(ADC2_PIN),
+        AnalogIn(ADC3_PIN),
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Potentiometer/Potentiometer.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,15 @@
+#ifndef POTENTIOMETER_H_
+#define POTENTIOMETER_H_
+
+#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
+
+    extern AnalogIn adc[];
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Switch/Switch.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,59 @@
+#include "Switch.h"
+
+#include <stdint.h>
+#include "mbed.h"
+
+namespace SWITCH {
+    DigitalIn dipSw[] = {
+        DigitalIn(DIP0_PIN),
+        DigitalIn(DIP1_PIN),
+        DigitalIn(DIP2_PIN),
+        DigitalIn(DIP3_PIN),
+    };
+
+    DigitalIn limitSw(LS_PIN);
+    DigitalOut selectPin[] = {
+        DigitalOut(SELECT0_PIN),
+        DigitalOut(SELECT1_PIN),
+        DigitalOut(SELECT2_PIN),
+        DigitalOut(SELECT3_PIN),
+    };
+
+    void DipSw::Initialize() {
+        for(uint8_t i=0; i < sizeof(dipSw)/sizeof(dipSw[0]); i++) {
+            dipSw[i].mode(PullUp);
+        }
+    }
+
+    uint8_t DipSw::GetStatus() {
+        if(DIP0 == SW_ON)       return 0;
+        else if(DIP1 == SW_ON)  return 1;
+        else if(DIP2 == SW_ON)  return 2;
+        else if(DIP3 == SW_ON)  return 3;
+
+        return 0;
+    }
+
+    void LimitSw::Initialize() {
+        for(uint8_t i=0; i<4; i++) selectPin[i] = 0;
+        limitSw.mode(PullUp);
+    }
+
+    bool LimitSw::IsPressed(int index) {
+        // if(index > 0x0f) return false;
+
+        printf("%d\n", index);
+
+        MP_Channel ch;
+        ch.all = index;
+
+        selectPin[0] = ch.s0;
+        selectPin[1] = ch.s1;
+        selectPin[2] = ch.s2;
+        selectPin[3] = ch.s3;
+
+        while(1);
+
+        return limitSw ? false : true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Input/Switch/Switch.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,51 @@
+#ifndef SWITCH_H_
+#define SWITCH_H_
+
+#include "mbed.h"
+#include <stdint.h>
+
+namespace SWITCH {
+    #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 LS_PIN      PB_6
+    #define SELECT0_PIN PC_8
+    #define SELECT1_PIN PC_9
+    #define SELECT2_PIN PB_9
+    #define SELECT3_PIN PB_8
+
+    #define DIP0    dipSw[0]
+    #define DIP1    dipSw[1]
+    #define DIP2    dipSw[2]
+    #define DIP3    dipSw[3]
+
+    class DipSw {
+        public:
+        static void Initialize();
+        static uint8_t GetStatus();
+    };
+    
+    class LimitSw {
+        public:
+        static void Initialize();
+        static bool IsPressed(int index);
+    };
+
+    typedef union {
+        struct {
+            int s0 : 1;
+            int s1 : 1;
+            int s2 : 1;
+            int s3 : 1;
+            int : 4;
+        };
+        uint8_t all;
+    } MP_Channel;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LED/LED.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,20 @@
+#include "LED.h"
+
+#include "../System/Using.h"
+#include "mbed.h"
+#include <stdint.h>
+
+namespace LED {
+    DigitalOut boardLED[USE_LED_NUM] = {
+        DigitalOut(LED_DEBUG0_PIN),
+        DigitalOut(LED_DEBUG1_PIN),
+        DigitalOut(LED_DEBUG2_PIN),
+        DigitalOut(LED_MU_PIN),
+    };
+
+    void LED::Initialize() {
+        for(uint8_t i=0; i < USE_LED_NUM; i++) {
+            boardLED[i] = LED_OFF;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LED/LED.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,29 @@
+#ifndef LED_H_
+#define LED_H_
+
+#include "mbed.h"
+#include <stdint.h>
+
+namespace LED {
+    extern DigitalOut boardLED[];
+
+    #define LED_ON  0
+    #define LED_OFF 1
+
+    #define LED_DEBUG0_PIN  PC_11
+    #define LED_DEBUG1_PIN  PC_10
+    #define LED_DEBUG2_PIN  PC_12
+    #define LED_MU_PIN      PC_13
+
+    #define LED_DEBUG0  LED::boardLED[0]
+    #define LED_DEBUG1  LED::boardLED[1]
+    #define LED_DEBUG2  LED::boardLED[2]
+    #define LED_MU      LED::boardLED[3]
+    
+    class LED {
+        public:
+        static void Initialize();
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Safty/Safty.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,18 @@
+#include "Safty.h"
+
+#include "../Communication/Controller/Controller.h"
+#include "../Input/Switch/Switch.h"
+
+using namespace SWITCH;
+
+
+namespace SAFTY {
+    ErrorStatus ErrorCheck::Check() {
+        ErrorStatus error = 0;
+        CONTROLLER::Controller::CheckControllerLost() ? error |= Error::ControllerLost : error &=~ Error::ControllerLost;
+        // #ifdef USE_DRIVECHECK
+        (DRIVECHECK_LIMITSW == SW_OFF) ? error |= Error::DrivePowerLost : error &=~ Error::DrivePowerLost;
+        // #endif
+        return error;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Safty/Safty.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,27 @@
+#ifndef SAFTY_H_
+#define SAFTY_H_
+
+#include <stdint.h>
+#include "Input/Switch/Switch.h"
+
+namespace SAFTY {
+    #define DRIVECHECK_LIMITSW SWITCH::LimitSw::IsPressed(11)
+
+	typedef struct
+	{
+		enum Elem
+		{
+			None = 0x00,
+			DrivePowerLost = 0x01,
+			ControllerLost = 0x02,
+		};
+	}Error;
+    typedef uint8_t ErrorStatus;
+
+    class ErrorCheck {
+        public:
+        static ErrorStatus Check();
+    };
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Initialize/Initialize.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,45 @@
+#include "Initialize.h"
+#include "../Using.h"
+
+#include "../../Input/Switch/Switch.h"
+#include "../../Communication/Controller/Mu/Mu.h"
+#include "../../Communication/Controller/Controller.h"
+#include "../../Communication/RS485/ActuatorHub/ActuatorHub.h"
+#include "../../Communication/RS485/RS485.h"
+#include "../../Input/ExternalInt/ExternalInt.h"
+#include "../../Input/Switch/Switch.h"
+#include "../../LED/LED.h"
+
+void SystemInitialize() {
+    #ifdef USE_SWITCH
+    SWITCH::DipSw::Initialize();
+    SWITCH::LimitSw::Initialize();
+    #endif
+
+    #ifdef USE_MU
+    MU::Mu::Initialize(SWITCH::DipSw::GetStatus());
+    CONTROLLER::Controller::Initialize();
+    #endif
+
+    #ifdef USE_INT
+    EXTERNALINT::Int::Initialize();
+    #endif
+
+    #ifdef USE_LED
+    LED::LED::Initialize();
+    #endif
+
+    #ifdef USE_RS485
+    RS485::RS485::Initialize();
+    #endif
+
+    #ifdef USE_MOTOR
+    ACTUATORHUB::MOTOR::Motor::Initialize();
+    #endif
+
+    #ifdef USE_SOLENOID
+    ACTUATORHUB::SOLENOID::Solenoid::Initialize();
+    #endif
+
+    __enable_irq();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Initialize/Initialize.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,6 @@
+#ifndef INITIALIZE_H_
+#define INITIALIZE_H_
+
+void SystemInitialize();
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Process/InterruptProcess.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,82 @@
+#include "InterruptProcess.h"
+
+#include "../../LED/LED.h"
+#include "Process.h"
+
+#pragma region INT_PROCESS
+void int0()//
+{
+
+}
+
+void int1()//
+{
+
+}
+
+void int2()
+{
+
+}
+
+void int3()
+{
+    
+}
+
+void int4()
+{
+    
+}
+
+void int5()
+{
+    
+}
+
+void int6()
+{
+    
+}
+
+void int7()
+{
+    
+}
+
+void int8()
+{
+    
+}
+
+void int9()//
+{
+    
+}
+
+void int10()
+{
+    
+}
+
+void int11()
+{
+    
+}
+
+void int12()
+{
+    
+}
+
+void int13()
+{
+    
+}
+
+void int14()
+{
+    
+}
+
+#pragma endregion INT_PROCESS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Process/InterruptProcess.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,20 @@
+#ifndef INTERRUPTPROCESS_H_
+#define INTERRUPTPROCESS_H_
+
+void int0();
+void int1();
+void int2();
+void int3();
+void int4();
+void int5();
+void int6();
+void int7();
+void int8();
+void int9();
+void int10();
+void int11();
+void int12();
+void int13();
+void int14();
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Process/Process.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,277 @@
+#include "mbed.h"
+#include "Process.h"
+
+#include "../../Communication/RS485/ActuatorHub/ActuatorHub.h"
+#include "../../Communication/Controller/Controller.h"
+#include "../../Input/ExternalInt/ExternalInt.h"
+#include "../../Input/Switch/Switch.h"
+#include "../../Input/Potentiometer/Potentiometer.h"
+#include "../../LED/LED.h"
+#include "../../Safty/Safty.h"
+#include "../Using.h"
+
+using namespace SWITCH;
+
+static CONTROLLER::ControllerData *controller;
+ACTUATORHUB::MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
+ACTUATORHUB::SOLENOID::SolenoidStatus solenoid;
+
+static bool lock;
+static bool processChangeComp;
+static int current;
+
+static void AllActuatorReset();
+
+#ifdef USE_SUBPROCESS
+static void (*Process[USE_PROCESS_NUM])(void);
+#endif
+
+#pragma region USER-DEFINED_VARIABLES_AND_PROTOTYPE
+
+/*Replace here with the definition code of your variables.*/
+
+#pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE
+
+#ifdef USE_SUBPROCESS
+#if USE_PROCESS_NUM>0
+static void Process0(void);
+#endif
+#if USE_PROCESS_NUM>1
+static void Process1(void);
+#endif
+#if USE_PROCESS_NUM>2
+static void Process2(void);
+#endif
+#if USE_PROCESS_NUM>3
+static void Process3(void);
+#endif
+#if USE_PROCESS_NUM>4
+static void Process4(void);
+#endif
+#if USE_PROCESS_NUM>5
+static void Process5(void);
+#endif
+#if USE_PROCESS_NUM>6
+static void Process6(void);
+#endif
+#if USE_PROCESS_NUM>7
+static void Process7(void);
+#endif
+#if USE_PROCESS_NUM>8
+static void Process8(void);
+#endif
+#if USE_PROCESS_NUM>9
+static void Process9(void);
+#endif
+#endif
+
+void SystemProcessInitialize()
+{
+	#pragma region USER-DEFINED_VARIABLE_INIT
+	
+	/*Replace here with the initialization code of your variables.*/
+
+	#pragma endregion USER-DEFINED_VARIABLE_INIT
+
+	lock = true;
+	processChangeComp = true;
+	current = DEFAULT_PROCESS;
+
+	#ifdef USE_SUBPROCESS
+	#if USE_PROCESS_NUM>0
+	Process[0] = Process0;
+	#endif
+	#if USE_PROCESS_NUM>1
+	Process[1] = Process1;
+	#endif
+	#if USE_PROCESS_NUM>2
+	Process[2] = Process2;
+	#endif
+	#if USE_PROCESS_NUM>3
+	Process[3] = Process3;
+	#endif
+	#if USE_PROCESS_NUM>4
+	Process[4] = Process4;
+	#endif
+	#if USE_PROCESS_NUM>5
+	Process[5] = Process5;
+	#endif
+	#if USE_PROCESS_NUM>6
+	Process[6] = Process6;
+	#endif
+	#if USE_PROCESS_NUM>7
+	Process[7] = Process7;
+	#endif
+	#if USE_PROCESS_NUM>8
+	Process[8] = Process8;
+	#endif
+	#if USE_PROCESS_NUM>9
+	Process[9] = Process9;
+	#endif
+	#endif
+}
+
+static void SystemProcessUpdate()
+{
+	#ifdef USE_SUBPROCESS
+	if(controller->Button.HOME) lock = false;
+	
+	if(controller->Button.START && processChangeComp)
+	{
+		current++;
+		if (USE_PROCESS_NUM < current) current = USE_PROCESS_NUM;
+		processChangeComp = false;
+	}
+	else if(controller->Button.SELECT && processChangeComp)
+	{
+		current--;
+		if (current < 0) current = 0;
+		processChangeComp = false;
+	}
+	else if(!controller->Button.SELECT && !controller->Button.START) processChangeComp = true;
+	#endif
+	
+	#ifdef USE_MOTOR
+	ACTUATORHUB::MOTOR::Motor::Update(motor);
+	#endif
+	
+	#ifdef USE_SOLENOID
+	ACTUATORHUB::SOLENOID::Solenoid::Update(solenoid);
+	#endif
+
+	#ifdef USE_RS485
+	ACTUATORHUB::ActuatorHub::Update();
+	#endif
+	
+}
+
+void SystemProcess()
+{
+	SystemProcessInitialize();
+
+	while(1)
+	{
+		#ifdef USE_MU
+		controller = CONTROLLER::Controller::GetData();
+		#endif
+
+		#ifdef USE_ERRORCHECK
+		if(SAFTY::ErrorCheck::Check() & SAFTY::Error::ControllerLost)
+		{
+			CONTROLLER::Controller::DataReset();
+			AllActuatorReset();
+			lock = true;
+		}
+		else
+		#endif
+		{
+
+			#ifdef USE_SUBPROCESS
+			if(!lock)
+			{
+				Process[current]();
+			}
+			else
+			#endif
+			{
+				//ロック時の処理
+			}
+		}
+		
+		SystemProcessUpdate();
+	}
+}
+
+#pragma region PROCESS
+#ifdef USE_SUBPROCESS
+#if USE_PROCESS_NUM>0
+static void Process0()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>1
+static void Process1()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>2
+static void Process2()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>3
+static void Process3()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>4
+static void Process4()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>5
+static void Process5()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>6
+static void Process6()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>7
+static void Process7()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>8
+static void Process8()
+{
+
+}
+#endif
+
+#if USE_PROCESS_NUM>9
+static void Process9()
+{
+
+}
+#endif
+#endif
+#pragma endregion PROCESS
+
+static void AllActuatorReset()
+{
+
+	#ifdef USE_SOLENOID
+	solenoid.all = ALL_SOLENOID_OFF;
+	#endif
+
+	#ifdef USE_MOTOR
+	for (uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++)
+	{
+		motor[i].dir = FREE;
+		motor[i].pwm = 0;
+	}
+	#endif
+}
+
+#pragma region USER-DEFINED-FUNCTIONS
+
+#pragma endregion
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Process/Process.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,69 @@
+#ifndef PROCESS_H_
+#define PROCESS_H_
+
+#include "mbed.h"
+
+void SystemProcess();
+
+#define ROLLER_LF motor[ROLLER_LF_NUM]
+#define ROLLER_LL motor[ROLLER_LL_NUM]
+#define ROLLER_LB motor[ROLLER_LB_NUM]
+#define ROLLER_LR motor[ROLLER_LR_NUM]
+#define ROLLER_CF motor[ROLLER_CF_NUM]
+#define ROLLER_CL motor[ROLLER_CL_NUM]
+#define ROLLER_CB motor[ROLLER_CB_NUM]
+#define ROLLER_CR motor[ROLLER_CR_NUM]
+#define ROLLER_RF motor[ROLLER_RF_NUM]
+#define ROLLER_RL motor[ROLLER_RL_NUM]
+#define ROLLER_RB motor[ROLLER_RB_NUM]
+#define ROLLER_RR motor[ROLLER_RR_NUM]
+
+#define ROLLER_LF_NUM 8
+#define ROLLER_LL_NUM 9
+#define ROLLER_LB_NUM 13
+#define ROLLER_LR_NUM 14
+#define ROLLER_CF_NUM 15
+#define ROLLER_CL_NUM 16
+#define ROLLER_CB_NUM 17
+#define ROLLER_CR_NUM 18
+#define ROLLER_RF_NUM 19
+#define ROLLER_RL_NUM 20
+#define ROLLER_RB_NUM 21
+#define ROLLER_RR_NUM 22
+
+#define FRONT_R tire[0]
+#define FRONT_L tire[1]
+#define REAR_L tire[2]
+#define REAR_R tire[3]
+
+#define TIRE_FR motor[0]
+#define TIRE_FL motor[1]
+#define TIRE_RL motor[2]
+#define TIRE_RR motor[3]
+#define STR_FR motor[4]
+#define STR_FL motor[5]
+#define STR_RL motor[6]
+#define STR_RR motor[7]
+
+#define SENSOR_FR POTENTIOMETER::adc[1].read_u16()
+#define SENSOR_FL (POTENTIOMETER::adc[2].read_u16() / 65535.0 * 1024.0)
+#define SENSOR_RL POTENTIOMETER::adc[3]
+#define SENSOR_RR POTENTIOMETER::adc[4]
+
+#define PLUS90_FR 605
+// #define PLUS90_FL 31100
+#define PLUS90_FL 480
+#define PLUS90_RL 505
+#define PLUS90_RR 550
+
+#define ZERO_FR 880
+// #define ZERO_FL 48800
+#define ZERO_FL 760
+#define ZERO_RL 775
+#define ZERO_RR 800
+
+extern Timer rollerTimer[4];
+extern float rollerSpeed[4];
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/System/Using.h	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,63 @@
+#ifndef USING_H_
+#define USING_H_
+
+//Communication
+#define USE_MU
+
+#define USE_BLUETOOTH
+#ifdef USE_BLUETOOTH
+#	define BLUETOOTH_BUFFER_SIZE 64
+const char disconnect = 0x03;
+#else
+#	define BLUETOOTH_BUFFER_SIZE 0
+#endif
+
+#define USE_MOTOR
+#ifdef USE_MOTOR
+#	define MOUNTING_MOTOR_NUM 13
+#else
+#	define MOUNTING_MOTOR_NUM 0
+#endif
+
+#define USE_RS485
+#ifdef USE_RS485
+#	define RS485_BUFFER_SIZE 26 + BLUETOOTH_BUFFER_SIZE + MOUNTING_MOTOR_NUM-13
+#else
+#	define RS485_BUFFER_SIZE 0
+#endif
+
+#define USE_SOLENOID
+
+//Communication
+
+//Output
+#define USE_LED
+#define USE_LED_NUM 4
+//Output
+
+//Input
+
+#define USE_SWITCH
+
+#define USE_POTENTIOMETER
+#ifdef USE_POTENTIOMETER
+#	define USE_POTENTIOMETER_NUM 4
+#else
+#	define USE_POTENTIOMETER_NUM 0
+#endif
+
+#define USE_INT
+
+//Input
+
+#define USE_ERRORCHECK
+#define USE_DRIVECHECK
+
+#define USE_SUBPROCESS
+#ifdef USE_SUBPROCESS
+#	define USE_PROCESS_NUM 10	//0 ~ 10
+#	define DEFAULT_PROCESS 0
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,9 @@
+#include "System/Initialize/Initialize.h"
+#include "System/Process/Process.h"
+
+#include <float.h>
+
+int main(void) {
+    SystemInitialize();
+    SystemProcess();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file