taiyou komazawa / Beta

Dependents:   DataPool

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BetaTransporter.cpp Source File

BetaTransporter.cpp

00001 #include "BetaTransporter.h"
00002 
00003 BetaTransporter::BetaTransporter()
00004 :   pool(),
00005     i2c(SDA,SCL)
00006 {
00007     
00008 }
00009 
00010 bool BetaTransporter::set()
00011 {
00012     bool no_error = true;
00013     
00014     i2c.transport_begin(JUSHINKUN_ADDR, pool.ctrl.all_data, 10);
00015     no_error = no_error & i2c.read();
00016     i2c.transport_end();
00017     
00018     /*i2c.transport_begin(APPER_BODY_ADDR, pool.a.all_data, 4);
00019     no_error = no_error & i2c.write();
00020     i2c.transport_end();
00021     
00022     i2c.transport_begin(APPER_BODY_ADDR, pool.ar.all_data, 1);
00023     no_error = no_error & i2c.read();
00024     i2c.transport_end();
00025     */
00026     
00027     pool.up_load();
00028     
00029     return no_error;
00030 }
00031 
00032 void BetaTransporter::write(int index_num, int data)
00033 {
00034     pool.data_index[index_num] = data;
00035 }
00036 
00037 
00038 int BetaTransporter::read(int index_num)
00039 {
00040     return pool.data_index[index_num];
00041 }
00042 
00043 void BetaTransporter::reset()
00044 {
00045     pool.reset();
00046 }
00047