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