for_gamma
Diff: GammaTransporter.cpp
- Revision:
- 0:519ec302e9b8
- Child:
- 3:8487ffc7b69c
diff -r 000000000000 -r 519ec302e9b8 GammaTransporter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GammaTransporter.cpp Fri Aug 18 03:12:18 2017 +0000 @@ -0,0 +1,40 @@ +#include "GammaTransporter.h" + +GammaTransporter::GammaTransporter() +: pool(), + i2c(SDA,SCL) +{ + +} + +bool GammaTransporter::set() +{ + bool no_error = true; + + i2c.transport_begin(JUSHINKUN_ADDR, pool.ctrl.all_data, 10); + no_error = no_error & i2c.read(); + i2c.transport_end(); + + i2c.transport_begin(APPER_BODY_ADDR, pool.a.all_data, 4); + no_error = no_error & i2c.write(); + i2c.transport_end(); + + i2c.transport_begin(APPER_BODY_ADDR, pool.ar.all_data, 1); + no_error = no_error & i2c.read(); + i2c.transport_end(); + + pool.up_load(); + + return no_error; +} + +int GammaTransporter::read(int index_num) +{ + return pool.data_index[index_num]; +} + +void GammaTransporter::reset() +{ + pool.reset(); +} + \ No newline at end of file