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.
Diff: HbEngine.cpp
- Revision:
- 39:1b76f7df8804
- Parent:
- 38:24ee50452755
--- a/HbEngine.cpp Fri Jan 18 11:52:00 2019 +0000
+++ b/HbEngine.cpp Sat Jan 19 12:35:23 2019 +0000
@@ -1,12 +1,14 @@
#include "HbEngine.h"
#include "fpga.h"
+#include "globalFlags.h"
//======================================================
//コンストラクタ
//======================================================
HbEngine::HbEngine(UCHAR iID){
id = iID;
- hvAxl = 0;
- bSetHvAxl = 0;
+ accel = 0;
+ hvAxl = 3600;
+ bSetHvAxl = false;
}
@@ -24,7 +26,20 @@
//アクセル設定
void HbEngine::setAccel(UINT16 iVal){
- fpgaEngine(id,iVal);
+ accel = iVal > MAX_VAL_12BIT ? MAX_VAL_12BIT : iVal;
+ fpgaEngine(id,accel);
+}
+
+INT16 HbEngine::getAccel(){
+ INT16 ret;
+ if(accel < 0){
+ ret = 0;
+ }else if(accel > MAX_VAL_12BIT){
+ ret = MAX_VAL_12BIT;
+ } else {
+ ret = accel;
+ }
+ return ret;
}
void HbEngine::setHoverAccel(INT16 val){