alpha_datapool

Dependents:   DataPool ctrl

Committer:
Komazawa_sun
Date:
Fri Sep 08 03:27:55 2017 +0000
Revision:
1:51a5a9f66f61
Parent:
0:2c82568e1790
????; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Komazawa_sun 0:2c82568e1790 1 #include "AlphaTransporter.h"
Komazawa_sun 0:2c82568e1790 2
Komazawa_sun 1:51a5a9f66f61 3 AlphaTransporter::AlphaTransporter(I2C *master)
Komazawa_sun 0:2c82568e1790 4 : pool(),
Komazawa_sun 1:51a5a9f66f61 5 i2c(master)
Komazawa_sun 0:2c82568e1790 6 {
Komazawa_sun 0:2c82568e1790 7 }
Komazawa_sun 0:2c82568e1790 8
Komazawa_sun 0:2c82568e1790 9 bool AlphaTransporter::set()
Komazawa_sun 0:2c82568e1790 10 {
Komazawa_sun 0:2c82568e1790 11 bool no_error = true;
Komazawa_sun 0:2c82568e1790 12
Komazawa_sun 0:2c82568e1790 13 i2c.transport_begin(JUSHINKUN_ADDR, pool.ctrl.all_data, 10);
Komazawa_sun 0:2c82568e1790 14 no_error = no_error & i2c.read();
Komazawa_sun 0:2c82568e1790 15 i2c.transport_end();
Komazawa_sun 1:51a5a9f66f61 16
Komazawa_sun 0:2c82568e1790 17 pool.up_load();
Komazawa_sun 0:2c82568e1790 18
Komazawa_sun 0:2c82568e1790 19 return no_error;
Komazawa_sun 0:2c82568e1790 20 }
Komazawa_sun 0:2c82568e1790 21
Komazawa_sun 0:2c82568e1790 22 void AlphaTransporter::write(int index_num, int data)
Komazawa_sun 0:2c82568e1790 23 {
Komazawa_sun 0:2c82568e1790 24 pool.data_index[index_num] = data;
Komazawa_sun 0:2c82568e1790 25 }
Komazawa_sun 0:2c82568e1790 26
Komazawa_sun 0:2c82568e1790 27 int AlphaTransporter::read(int index_num)
Komazawa_sun 0:2c82568e1790 28 {
Komazawa_sun 0:2c82568e1790 29 return pool.data_index[index_num];
Komazawa_sun 0:2c82568e1790 30 }
Komazawa_sun 0:2c82568e1790 31
Komazawa_sun 0:2c82568e1790 32 void AlphaTransporter::reset()
Komazawa_sun 0:2c82568e1790 33 {
Komazawa_sun 0:2c82568e1790 34 pool.reset();
Komazawa_sun 0:2c82568e1790 35 }
Komazawa_sun 0:2c82568e1790 36