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.
HbEngine.cpp
- Committer:
- MasashiNomura
- Date:
- 2019-01-19
- Revision:
- 39:1b76f7df8804
- Parent:
- 38:24ee50452755
File content as of revision 39:1b76f7df8804:
#include "HbEngine.h"
#include "fpga.h"
#include "globalFlags.h"
//======================================================
//コンストラクタ
//======================================================
HbEngine::HbEngine(UCHAR iID){
id = iID;
accel = 0;
hvAxl = 3600;
bSetHvAxl = false;
}
UINT16 HbEngine::getRpm(){
UINT16 rpm;
//エンジン回転数読み出し
//if(id<0||id>1)return 0;//現在の使用状況では不要
if(id == 0){
rpm = fpgaGetRpm(true);//前
}else/*if(id == 1)*/{
rpm = fpgaGetRpm(false);//後
}
return rpm;
}
//アクセル設定
void HbEngine::setAccel(UINT16 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){
hvAxl = val;
bSetHvAxl = true;
}
void HbEngine::clearHoverAccel(){
hvAxl = 0;
bSetHvAxl = false;
}
INT16 HbEngine::getHoverAccelVal(){
return hvAxl;
}
bool HbEngine::chkSetHoverAccel(){
return bSetHvAxl;
}
bool HbEngine::chkOverIDLECycle(){
return rpm > IDLE_HI;
}
bool HbEngine::chkInRangeIDLE(){
return rpm > IDLE_LOW && rpm < IDLE_HI;
}