for_gamma
GammaTransporter.cpp@3:8487ffc7b69c, 2017-08-22 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Tue Aug 22 04:39:31 2017 +0000
- Revision:
- 3:8487ffc7b69c
- Parent:
- 0:519ec302e9b8
year
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 | 3:8487ffc7b69c | 31 | void GammaTransporter::write(int index_num, int data) |
Komazawa_sun | 3:8487ffc7b69c | 32 | { |
Komazawa_sun | 3:8487ffc7b69c | 33 | pool.data_index[index_num] = data; |
Komazawa_sun | 3:8487ffc7b69c | 34 | } |
Komazawa_sun | 3:8487ffc7b69c | 35 | |
Komazawa_sun | 0:519ec302e9b8 | 36 | int GammaTransporter::read(int index_num) |
Komazawa_sun | 0:519ec302e9b8 | 37 | { |
Komazawa_sun | 0:519ec302e9b8 | 38 | return pool.data_index[index_num]; |
Komazawa_sun | 0:519ec302e9b8 | 39 | } |
Komazawa_sun | 0:519ec302e9b8 | 40 | |
Komazawa_sun | 0:519ec302e9b8 | 41 | void GammaTransporter::reset() |
Komazawa_sun | 0:519ec302e9b8 | 42 | { |
Komazawa_sun | 0:519ec302e9b8 | 43 | pool.reset(); |
Komazawa_sun | 0:519ec302e9b8 | 44 | } |
Komazawa_sun | 0:519ec302e9b8 | 45 |