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@19:4b0fe9a5ec38, 2018-12-05 (annotated)
- Committer:
- takeru0x1103
- Date:
- Wed Dec 05 00:12:38 2018 +0000
- Revision:
- 19:4b0fe9a5ec38
- Parent:
- 18:5aa48aec9cae
- Child:
- 24:c5945aaae777
???????
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;// |
takeru0x1103 | 18:5aa48aec9cae | 10 | limitH =500; |
takeru0x1103 | 18:5aa48aec9cae | 11 | limitL =-500; |
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 | } |