2017 hongo b team
Fork of Alpha_Apper by
Diff: ApprI2CMaster.cpp
- Revision:
- 1:16f3ffabd868
- Parent:
- 0:11209e14c06c
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