alpha_datapool
AlphaTransporter.cpp@0:2c82568e1790, 2017-08-30 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Wed Aug 30 05:14:05 2017 +0000
- Revision:
- 0:2c82568e1790
- Child:
- 1:51a5a9f66f61
alpha_pool
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Komazawa_sun | 0:2c82568e1790 | 1 | #include "AlphaTransporter.h" |
Komazawa_sun | 0:2c82568e1790 | 2 | |
Komazawa_sun | 0:2c82568e1790 | 3 | AlphaTransporter::AlphaTransporter() |
Komazawa_sun | 0:2c82568e1790 | 4 | : pool(), |
Komazawa_sun | 0:2c82568e1790 | 5 | i2c(SDA,SCL) |
Komazawa_sun | 0:2c82568e1790 | 6 | { |
Komazawa_sun | 0:2c82568e1790 | 7 | |
Komazawa_sun | 0:2c82568e1790 | 8 | } |
Komazawa_sun | 0:2c82568e1790 | 9 | |
Komazawa_sun | 0:2c82568e1790 | 10 | bool AlphaTransporter::set() |
Komazawa_sun | 0:2c82568e1790 | 11 | { |
Komazawa_sun | 0:2c82568e1790 | 12 | bool no_error = true; |
Komazawa_sun | 0:2c82568e1790 | 13 | |
Komazawa_sun | 0:2c82568e1790 | 14 | i2c.transport_begin(JUSHINKUN_ADDR, pool.ctrl.all_data, 10); |
Komazawa_sun | 0:2c82568e1790 | 15 | no_error = no_error & i2c.read(); |
Komazawa_sun | 0:2c82568e1790 | 16 | i2c.transport_end(); |
Komazawa_sun | 0:2c82568e1790 | 17 | |
Komazawa_sun | 0:2c82568e1790 | 18 | i2c.transport_begin(APPER_BODY_ADDR, pool.a.all_data, 1); |
Komazawa_sun | 0:2c82568e1790 | 19 | no_error = no_error & i2c.write(); |
Komazawa_sun | 0:2c82568e1790 | 20 | i2c.transport_end(); |
Komazawa_sun | 0:2c82568e1790 | 21 | |
Komazawa_sun | 0:2c82568e1790 | 22 | i2c.transport_begin(APPER_BODY_ADDR, pool.ar.all_data, 1); |
Komazawa_sun | 0:2c82568e1790 | 23 | no_error = no_error & i2c.read(); |
Komazawa_sun | 0:2c82568e1790 | 24 | i2c.transport_end(); |
Komazawa_sun | 0:2c82568e1790 | 25 | |
Komazawa_sun | 0:2c82568e1790 | 26 | pool.up_load(); |
Komazawa_sun | 0:2c82568e1790 | 27 | |
Komazawa_sun | 0:2c82568e1790 | 28 | return no_error; |
Komazawa_sun | 0:2c82568e1790 | 29 | } |
Komazawa_sun | 0:2c82568e1790 | 30 | |
Komazawa_sun | 0:2c82568e1790 | 31 | void AlphaTransporter::write(int index_num, int data) |
Komazawa_sun | 0:2c82568e1790 | 32 | { |
Komazawa_sun | 0:2c82568e1790 | 33 | pool.data_index[index_num] = data; |
Komazawa_sun | 0:2c82568e1790 | 34 | } |
Komazawa_sun | 0:2c82568e1790 | 35 | |
Komazawa_sun | 0:2c82568e1790 | 36 | int AlphaTransporter::read(int index_num) |
Komazawa_sun | 0:2c82568e1790 | 37 | { |
Komazawa_sun | 0:2c82568e1790 | 38 | return pool.data_index[index_num]; |
Komazawa_sun | 0:2c82568e1790 | 39 | } |
Komazawa_sun | 0:2c82568e1790 | 40 | |
Komazawa_sun | 0:2c82568e1790 | 41 | void AlphaTransporter::reset() |
Komazawa_sun | 0:2c82568e1790 | 42 | { |
Komazawa_sun | 0:2c82568e1790 | 43 | pool.reset(); |
Komazawa_sun | 0:2c82568e1790 | 44 | } |
Komazawa_sun | 0:2c82568e1790 | 45 |