Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HbMotor.cpp
- Committer:
- MasashiNomura
- Date:
- 2018-12-14
- Revision:
- 27:ff63c23bc689
- Parent:
- 25:f3a6e7eec9c3
- Child:
- 28:fdb3b144e342
File content as of revision 27:ff63c23bc689:
#include "HbMotor.h" #include "fpga.h" //========================================= //コンストラクタ //========================================= HbMotor::HbMotor(UCHAR iID ){ id =iID; ofs =0;// limitH =2000; limitL =-2000; curVal = 0; } //----------------------------------------- //モーター設定 //----------------------------------------- void HbMotor::setValue(INT16 iVal){ UINT16 val; //入力リミット if( iVal > limitH ){ val = limitH; }else if( iVal < limitL ){ val = limitL; }else{ val = iVal; } //オフセット重畳 curVal = val = val + ofs; //sp.printf("MOT [%d]",curVal);//Test Code //PWM幅設定 fpgaSubProp(id,val); } void HbMotor::setOfs(INT16 iVal){ ofs = iVal; } INT16 HbMotor::getOfs(){ return ofs; } void HbMotor::setLimit(INT16 low, INT16 hi){ limitL = low; limitH = hi; } INT16 HbMotor::getCurrentValue(){ return curVal; } void HbMotor::setValueDirect(INT16 iVal){ //PWM幅設定 //sp.printf("MOT [%d]",iVal);//Test Code fpgaSubProp(id,iVal); } void HbMotor::setValueFPGA(UCHAR iID, INT16 iVal){ UCHAR tmp = id * 2 + iID; fpgaMotor(tmp,iVal); }