Dead by Daylight

Dependencies:   mbed Servo

Files at this revision

API Documentation at this revision

Comitter:
t_yamamoto
Date:
Sat Feb 24 07:32:11 2018 +0000
Parent:
7:f4252ddc480d
Child:
9:49e851ad441e
Commit message:
Sensor

Changed in this revision

Output/Motor/Motor.cpp Show annotated file Show diff for this revision Revisions of this file
Output/Motor/Motor.h Show annotated file Show diff for this revision Revisions of this file
Output/Servo.lib 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/Output/Motor/Motor.cpp	Sat Jan 27 05:29:03 2018 +0000
+++ b/Output/Motor/Motor.cpp	Sat Feb 24 07:32:11 2018 +0000
@@ -33,12 +33,12 @@
 
     void Motor::Initialize(void) {
         //Port Initialize
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM * 2; i++) {
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM * 2; i++) {
             directions[i] = 0;
         }
 
         //Pwm Initialize
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) {
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) {
             pwms[i].period_us(50);  //20kHz
             pwms[i] = 0.0;
         }
@@ -47,20 +47,20 @@
     }
 
     void Motor::SetDefault(void) {
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) {
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) {
             motor[i].dir = FREE;
             motor[i].pwm = 0;
         }
     }
 
     void Motor::Update(MotorStatus *status) {
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) motor[i] = status[i];
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) motor[i] = status[i];
 
         //PWM Update
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) pwms[i] = percentage_to_ratio(motor[i].pwm);
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) pwms[i] = percentage_to_ratio(motor[i].pwm);
 
         //Port Update
-        for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) {
+        for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) {
             directions[i * 2]       = motor[i].d1;
             directions[i * 2 + 1]   = motor[i].d2;
         }
--- a/Output/Motor/Motor.h	Sat Jan 27 05:29:03 2018 +0000
+++ b/Output/Motor/Motor.h	Sat Feb 24 07:32:11 2018 +0000
@@ -3,6 +3,7 @@
 
 #include <stdint.h>
 
+//#define USE_MOTOR0_SENSOR
 namespace MOTOR
 {
     #define FREE    0
@@ -39,6 +40,12 @@
     #define MOTOR2_PWM_PIN D10
     #define MOTOR3_PWM_PIN D11
     #define MOTOR4_PWM_PIN A2
+    
+    #ifdef USE_MOTOR0_SENSOR
+        #define MOTOR_START_NUM 1
+    #else 
+        #define MOTOR_START_NUM 0
+    #endif
 
     typedef struct
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Output/Servo.lib	Sat Feb 24 07:32:11 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- a/System/Process/Process.cpp	Sat Jan 27 05:29:03 2018 +0000
+++ b/System/Process/Process.cpp	Sat Feb 24 07:32:11 2018 +0000
@@ -1,4 +1,4 @@
-//2018/01/26のやつ
+//2018/02/24のやつ
 
 #include "Process.h"
 
@@ -6,6 +6,8 @@
 #include "../../Communication/XBee/XBee.h"
 #include "../../Input/Switch/Switch.h"
 #include "../../Output/Motor/Motor.h"
+#include "../../Output/Servo/Servo.h"
+
 //_____________________
 /*---------------- HOW TO WRITE ----------------/
 
@@ -24,13 +26,10 @@
 
 
 
-
-
-
 //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 //_____________________
 
-// #define USE_USB_SERIAL
+//#define USE_USB_SERIAL
 #ifdef USE_USB_SERIAL
 Serial pc(SERIAL_TX, SERIAL_RX);
 #endif
@@ -39,7 +38,7 @@
 
 using namespace SWITCH;
 
-void SystemProcess(void) {    
+void SystemProcess(void) {  
     while(true) {
         controller = XBEE::Controller::GetData();
 //____________________________
@@ -99,9 +98,6 @@
 
 
 
-
-
-
 //↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
 //____________________________