2017_hongo_Bteam

Dependents:   DataPool

Committer:
Komazawa_sun
Date:
Fri Aug 25 07:37:05 2017 +0000
Revision:
1:a2572a29fe59
Parent:
0:31116bc8d4a7
Child:
2:503337abcb4a
hoge; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Komazawa_sun 0:31116bc8d4a7 1 #include "BetaTransporter.h"
Komazawa_sun 0:31116bc8d4a7 2
Komazawa_sun 0:31116bc8d4a7 3 BetaTransporter::BetaTransporter()
Komazawa_sun 0:31116bc8d4a7 4 : pool(),
Komazawa_sun 0:31116bc8d4a7 5 i2c(SDA,SCL)
Komazawa_sun 0:31116bc8d4a7 6 {
Komazawa_sun 0:31116bc8d4a7 7
Komazawa_sun 0:31116bc8d4a7 8 }
Komazawa_sun 0:31116bc8d4a7 9
Komazawa_sun 0:31116bc8d4a7 10 bool BetaTransporter::set()
Komazawa_sun 0:31116bc8d4a7 11 {
Komazawa_sun 0:31116bc8d4a7 12 bool no_error = true;
Komazawa_sun 0:31116bc8d4a7 13
Komazawa_sun 0:31116bc8d4a7 14 i2c.transport_begin(JUSHINKUN_ADDR, pool.ctrl.all_data, 9);
Komazawa_sun 0:31116bc8d4a7 15 no_error = no_error & i2c.read();
Komazawa_sun 0:31116bc8d4a7 16 i2c.transport_end();
Komazawa_sun 0:31116bc8d4a7 17
Komazawa_sun 0:31116bc8d4a7 18 /*i2c.transport_begin(APPER_BODY_ADDR, pool.a.all_data, 4);
Komazawa_sun 0:31116bc8d4a7 19 no_error = no_error & i2c.write();
Komazawa_sun 0:31116bc8d4a7 20 i2c.transport_end();
Komazawa_sun 0:31116bc8d4a7 21
Komazawa_sun 0:31116bc8d4a7 22 i2c.transport_begin(APPER_BODY_ADDR, pool.ar.all_data, 1);
Komazawa_sun 0:31116bc8d4a7 23 no_error = no_error & i2c.read();
Komazawa_sun 0:31116bc8d4a7 24 i2c.transport_end();
Komazawa_sun 0:31116bc8d4a7 25 */
Komazawa_sun 0:31116bc8d4a7 26
Komazawa_sun 0:31116bc8d4a7 27 pool.up_load();
Komazawa_sun 0:31116bc8d4a7 28
Komazawa_sun 0:31116bc8d4a7 29 return no_error;
Komazawa_sun 0:31116bc8d4a7 30 }
Komazawa_sun 0:31116bc8d4a7 31
Komazawa_sun 1:a2572a29fe59 32 void BetaTransporter::write(int index_num, int data)
Komazawa_sun 1:a2572a29fe59 33 {
Komazawa_sun 1:a2572a29fe59 34 pool.data_index[index_num] = data;
Komazawa_sun 1:a2572a29fe59 35 }
Komazawa_sun 1:a2572a29fe59 36
Komazawa_sun 1:a2572a29fe59 37
Komazawa_sun 0:31116bc8d4a7 38 int BetaTransporter::read(int index_num)
Komazawa_sun 0:31116bc8d4a7 39 {
Komazawa_sun 0:31116bc8d4a7 40 return pool.data_index[index_num];
Komazawa_sun 0:31116bc8d4a7 41 }
Komazawa_sun 0:31116bc8d4a7 42
Komazawa_sun 0:31116bc8d4a7 43 void BetaTransporter::reset()
Komazawa_sun 0:31116bc8d4a7 44 {
Komazawa_sun 0:31116bc8d4a7 45 pool.reset();
Komazawa_sun 0:31116bc8d4a7 46 }
Komazawa_sun 0:31116bc8d4a7 47