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@24:c5945aaae777, 2018-12-10 (annotated)
- Committer:
- MasashiNomura
- Date:
- Mon Dec 10 12:29:37 2018 +0000
- Revision:
- 24:c5945aaae777
- Parent:
- 19:4b0fe9a5ec38
- Child:
- 25:f3a6e7eec9c3
2018/12/10 dbg etc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takeru0x1103 | 18:5aa48aec9cae | 1 | #include "HbMotor.h" |
takeru0x1103 | 18:5aa48aec9cae | 2 | #include "fpga.h" |
takeru0x1103 | 18:5aa48aec9cae | 3 | |
takeru0x1103 | 18:5aa48aec9cae | 4 | //========================================= |
takeru0x1103 | 18:5aa48aec9cae | 5 | //コンストラクタ |
takeru0x1103 | 18:5aa48aec9cae | 6 | //========================================= |
takeru0x1103 | 18:5aa48aec9cae | 7 | HbMotor::HbMotor(UCHAR iID ){ |
takeru0x1103 | 18:5aa48aec9cae | 8 | id =iID; |
takeru0x1103 | 19:4b0fe9a5ec38 | 9 | ofs =0;// |
MasashiNomura | 24:c5945aaae777 | 10 | limitH =800; |
MasashiNomura | 24:c5945aaae777 | 11 | limitL =-800; |
takeru0x1103 | 18:5aa48aec9cae | 12 | } |
takeru0x1103 | 18:5aa48aec9cae | 13 | |
takeru0x1103 | 18:5aa48aec9cae | 14 | //----------------------------------------- |
takeru0x1103 | 18:5aa48aec9cae | 15 | //モーター設定 |
takeru0x1103 | 18:5aa48aec9cae | 16 | //----------------------------------------- |
takeru0x1103 | 18:5aa48aec9cae | 17 | void HbMotor::setValue(INT16 iVal){ |
takeru0x1103 | 18:5aa48aec9cae | 18 | UINT16 val; |
takeru0x1103 | 18:5aa48aec9cae | 19 | |
takeru0x1103 | 18:5aa48aec9cae | 20 | //入力リミット |
takeru0x1103 | 18:5aa48aec9cae | 21 | if( iVal > limitH ){ |
takeru0x1103 | 18:5aa48aec9cae | 22 | val = limitH; |
takeru0x1103 | 18:5aa48aec9cae | 23 | }else if( iVal < limitL ){ |
takeru0x1103 | 18:5aa48aec9cae | 24 | val = limitL; |
takeru0x1103 | 18:5aa48aec9cae | 25 | }else{ |
takeru0x1103 | 18:5aa48aec9cae | 26 | val = iVal; |
takeru0x1103 | 18:5aa48aec9cae | 27 | } |
takeru0x1103 | 18:5aa48aec9cae | 28 | |
takeru0x1103 | 18:5aa48aec9cae | 29 | //オフセット重畳 |
takeru0x1103 | 18:5aa48aec9cae | 30 | val = val + ofs; |
takeru0x1103 | 18:5aa48aec9cae | 31 | |
takeru0x1103 | 19:4b0fe9a5ec38 | 32 | //PWM幅設定 |
takeru0x1103 | 18:5aa48aec9cae | 33 | fpgaSubProp(id,val); |
takeru0x1103 | 18:5aa48aec9cae | 34 | } |
MasashiNomura | 24:c5945aaae777 | 35 | void HbMotor::setOffset(INT16 iVal){ |
MasashiNomura | 24:c5945aaae777 | 36 | ofs = iVal; |
MasashiNomura | 24:c5945aaae777 | 37 | } |
MasashiNomura | 24:c5945aaae777 | 38 | |
MasashiNomura | 24:c5945aaae777 | 39 | void HbMotor::setLimit(INT16 low, INT16 hi){ |
MasashiNomura | 24:c5945aaae777 | 40 | limitL = low; |
MasashiNomura | 24:c5945aaae777 | 41 | limitH = hi; |
MasashiNomura | 24:c5945aaae777 | 42 | } |