2017 hongo b alpha
ShooterAngle.cpp@1:402a36cb88ce, 2017-09-25 (annotated)
- Committer:
- Komazawa_sun
- Date:
- Mon Sep 25 00:14:24 2017 +0000
- Revision:
- 1:402a36cb88ce
- Parent:
- 0:3e9f5fcfc775
fix;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Komazawa_sun | 0:3e9f5fcfc775 | 1 | #include "ShooterAngle.h" |
Komazawa_sun | 0:3e9f5fcfc775 | 2 | |
Komazawa_sun | 0:3e9f5fcfc775 | 3 | ShooterAngle::ShooterAngle(I2C *master, const unsigned int angle_max_, const unsigned int angle_min_): |
Komazawa_sun | 0:3e9f5fcfc775 | 4 | to_slave(alpha_a::angle, alpha_a::unsig, alpha_a::s3_addr, master), |
Komazawa_sun | 0:3e9f5fcfc775 | 5 | _angle_max(angle_max_), |
Komazawa_sun | 0:3e9f5fcfc775 | 6 | _angle_min(angle_min_) |
Komazawa_sun | 0:3e9f5fcfc775 | 7 | { |
Komazawa_sun | 0:3e9f5fcfc775 | 8 | |
Komazawa_sun | 0:3e9f5fcfc775 | 9 | } |
Komazawa_sun | 0:3e9f5fcfc775 | 10 | |
Komazawa_sun | 0:3e9f5fcfc775 | 11 | void ShooterAngle::setAngle(unsigned int angle) |
Komazawa_sun | 0:3e9f5fcfc775 | 12 | { |
Komazawa_sun | 1:402a36cb88ce | 13 | uint8_t send_data = 0; |
Komazawa_sun | 0:3e9f5fcfc775 | 14 | if(_angle_max < angle) |
Komazawa_sun | 1:402a36cb88ce | 15 | send_data = (uint8_t)_angle_max; |
Komazawa_sun | 1:402a36cb88ce | 16 | else if(_angle_min > angle) |
Komazawa_sun | 1:402a36cb88ce | 17 | send_data = (uint8_t)_angle_min; |
Komazawa_sun | 0:3e9f5fcfc775 | 18 | else |
Komazawa_sun | 1:402a36cb88ce | 19 | send_data = (uint8_t)angle; |
Komazawa_sun | 1:402a36cb88ce | 20 | printf("%d\r\n",send_data); |
Komazawa_sun | 1:402a36cb88ce | 21 | to_slave.write(send_data); |
Komazawa_sun | 0:3e9f5fcfc775 | 22 | } |