2017 hongo b alpha

ShooterAngle.cpp

Committer:
Komazawa_sun
Date:
2017-09-22
Revision:
0:3e9f5fcfc775
Child:
1:402a36cb88ce

File content as of revision 0:3e9f5fcfc775:

#include "ShooterAngle.h"

ShooterAngle::ShooterAngle(I2C *master, const unsigned int angle_max_, const unsigned int angle_min_):
    to_slave(alpha_a::angle, alpha_a::unsig, alpha_a::s3_addr, master),
    _angle_max(angle_max_),
    _angle_min(angle_min_)
{
    
}

void ShooterAngle::setAngle(unsigned int angle)
{
    if(_angle_max < angle)
        to_slave.write((uint8_t)_angle_max);
    if(_angle_min > angle)
        to_slave.write((uint8_t)_angle_min);
    else
        to_slave.write((uint8_t)angle);
}