teamALI / Mbed 2 deprecated HB2018

Dependencies:   mbed FreeRTOS

HbMotor.cpp

Committer:
takeru0x1103
Date:
2018-12-05
Revision:
19:4b0fe9a5ec38
Parent:
18:5aa48aec9cae
Child:
24:c5945aaae777

File content as of revision 19:4b0fe9a5ec38:

#include "HbMotor.h"
#include "fpga.h"

//=========================================
//コンストラクタ
//=========================================
HbMotor::HbMotor(UCHAR iID ){
    id      =iID;
    ofs     =0;//
    limitH  =500;
    limitL  =-500;
}

//-----------------------------------------
//モーター設定
//-----------------------------------------
void HbMotor::setValue(INT16 iVal){
    UINT16  val;
    
    //入力リミット
    if( iVal > limitH ){
        val = limitH;
    }else if( iVal < limitL ){
        val = limitL;
    }else{
        val = iVal;
    }
    
    //オフセット重畳
    val = val + ofs;
    
    //PWM幅設定
    fpgaSubProp(id,val);
}