Dependents:   RobotBase

Files at this revision

API Documentation at this revision

Comitter:
inst
Date:
Fri Nov 13 08:16:04 2015 +0000
Parent:
2:0d9bb8e1876b
Commit message:

Changed in this revision

Robot.cpp Show annotated file Show diff for this revision Revisions of this file
Robot.h Show annotated file Show diff for this revision Revisions of this file
diff -r 0d9bb8e1876b -r 4dbbd511a49d Robot.cpp
--- a/Robot.cpp	Wed Oct 14 03:50:52 2015 +0000
+++ b/Robot.cpp	Fri Nov 13 08:16:04 2015 +0000
@@ -5,15 +5,15 @@
 // XBee :                       ----  1
 // Steering {
 //  I2CMotor * 3, I2CServo * 3  ----  6
-//  ShootingSystem :
 //  I2CServo * 1                ----  1
 // }
 // ShootingSystem {
 //  Shooter:                    ----  1
 //  AmmoPusher:                 ----  1
 //  AmmoSupplier:               ----  1
+//  I2CServo:                   ----  1
 // }
-const int Robot::mNumOfI2CDevice = 12;
+const uint32_t Robot::mNumOfI2CDevices = 12;
 
 void Robot::update(){
     readI2CDevice();
@@ -22,13 +22,13 @@
 }
 
 void Robot::writeI2CDevice(){
-    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
+    for ( int i = 0; i < mNumOfI2CDevices; ++i ){
         mI2CDevice[ i ]->writeI2C();
     }
 }
 
 void Robot::readI2CDevice(){
-    for ( int i = 0; i < mNumOfI2CDevice; ++i ){
+    for ( int i = 0; i < mNumOfI2CDevices; ++i ){
         mI2CDevice[ i ]->readI2C();
     }
 }
diff -r 0d9bb8e1876b -r 4dbbd511a49d Robot.h
--- a/Robot.h	Wed Oct 14 03:50:52 2015 +0000
+++ b/Robot.h	Fri Nov 13 08:16:04 2015 +0000
@@ -6,18 +6,20 @@
 
 class Robot{
 public:
+    static uint32_t getNumOfI2CDevices(){
+        return mNumOfI2CDevices;
+    }
     void update();
     
-    static const int mNumOfI2CDevice;
-    
 protected:
+    static const uint32_t mNumOfI2CDevices;
     I2CDevice** mI2CDevice;
     
 private:
     virtual void updateAction() = 0;
-    
     void readI2CDevice();
     void writeI2CDevice();
+    
 };
 
 #endif