2017 hongo b team

Fork of Alpha_Apper by taiyou komazawa

Files at this revision

API Documentation at this revision

Comitter:
Komazawa_sun
Date:
Mon Sep 11 04:55:39 2017 +0000
Parent:
0:11209e14c06c
Commit message:
????;

Changed in this revision

Alpha_ApprI2C_ID.h Show diff for this revision Revisions of this file
ApprI2CMaster.cpp Show annotated file Show diff for this revision Revisions of this file
ApprI2CMaster.h Show annotated file Show diff for this revision Revisions of this file
Beta_ApprI2C_ID.h Show annotated file Show diff for this revision Revisions of this file
diff -r 11209e14c06c -r 16f3ffabd868 Alpha_ApprI2C_ID.h
--- a/Alpha_ApprI2C_ID.h	Fri Sep 08 03:27:32 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#ifndef ALPHA_APPR_I2C_ID_H
-#define ALPHA_APPR_I2C_ID_H
-
-namespace alpha_a
-{
-    const int s1_addr = 0x0b;
-    const int s2_addr = 0x0c;
-    
-    enum ID
-    {
-        sht_pwr   = 0x00,
-        sht_ang   = 0x01,
-        rld_belt  = 0x02,
-        rld_disk  = 0x03,
-        
-        r_panta   = 0x04,
-        l_panta   = 0x05,
-        
-        rld_t_lim = 0x06
-    };
-    
-    enum f_type
-    {
-        sig,unsig
-    };
-}
-
-#endif
\ No newline at end of file
diff -r 11209e14c06c -r 16f3ffabd868 ApprI2CMaster.cpp
--- a/ApprI2CMaster.cpp	Fri Sep 08 03:27:32 2017 +0000
+++ b/ApprI2CMaster.cpp	Mon Sep 11 04:55:39 2017 +0000
@@ -1,11 +1,12 @@
 #include "ApprI2CMaster.h"
 
-ApprI2CMaster::ApprI2CMaster(alpha_a::ID my_id_, alpha_a::f_type my_type_, int addr_, I2C *master_)
+ApprI2CMaster::ApprI2CMaster(beta_a::ID my_id_, beta_a::f_type my_type_, int addr_, I2C *master_)
 {
     _my_id = my_id_;
     _my_type = my_type_;
     _master = master_;
     _addr = addr_;
+    res_data = 0;
 }
 
 void ApprI2CMaster::write(uint8_t data)
@@ -22,26 +23,22 @@
 int ApprI2CMaster::read()
 {
     char buffer[3] = {};
-    int res_data = 0;
     
     _master->read(_addr, buffer, 3);
     
-    if((alpha_a::ID)buffer[0] == _my_id)
+    if((beta_a::ID)buffer[0] == _my_id)
     {
-        switch((alpha_a::f_type)buffer[1])
+        switch((beta_a::f_type)buffer[1])
         {
-            case alpha_a::sig:
+            case beta_a::sig:
                 res_data = (signed int)buffer[2];
                 break;
-            case alpha_a::unsig:
+            case beta_a::unsig:
                 res_data = (unsigned int)buffer[2];
                 break;
         };
         
-        return res_data;
     }
-    else
-    {
-        return res_data;
-    }
+    
+    return res_data;
 }
\ No newline at end of file
diff -r 11209e14c06c -r 16f3ffabd868 ApprI2CMaster.h
--- a/ApprI2CMaster.h	Fri Sep 08 03:27:32 2017 +0000
+++ b/ApprI2CMaster.h	Mon Sep 11 04:55:39 2017 +0000
@@ -1,23 +1,23 @@
 #ifndef APPR_I2C_MASTER_H
 #define APPR_I2C_MASTER_H
 
-#include "Alpha_ApprI2C_ID.h"
+#include "Beta_ApprI2C_ID.h"
 #include "I2CTransporter.h"
 
 
 class ApprI2CMaster
 {
     public:
-        ApprI2CMaster(alpha_a::ID my_id_, alpha_a::f_type my_type_, int addr_, I2C *master_);
+        ApprI2CMaster(beta_a::ID my_id_, beta_a::f_type my_type_, int addr_, I2C *master_);
         void write(uint8_t data);
         int read();
         
     private:
-        alpha_a::ID _my_id;
-        alpha_a::f_type _my_type;
+        beta_a::ID _my_id;
+        beta_a::f_type _my_type;
         I2C *_master;
         int _addr; 
-        
+        int res_data;
         
 };
 
diff -r 11209e14c06c -r 16f3ffabd868 Beta_ApprI2C_ID.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Beta_ApprI2C_ID.h	Mon Sep 11 04:55:39 2017 +0000
@@ -0,0 +1,22 @@
+#ifndef BETA_APPR_I2C_ID_H
+#define BETA_APPR_I2C_ID_H
+
+namespace beta_a
+{
+    const int s1_addr = 0x0b;
+    
+    enum ID
+    {
+        stmby_valb1     = 0x00,
+        stmby_valb2     = 0x01,
+        stoper_valb     = 0x02,
+        beak_pwr        = 0x03
+    };
+    
+    enum f_type
+    {
+        sig,unsig
+    };
+}
+
+#endif
\ No newline at end of file