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@39:1b76f7df8804, 2019-01-19 (annotated)
- Committer:
- MasashiNomura
- Date:
- Sat Jan 19 12:35:23 2019 +0000
- Revision:
- 39:1b76f7df8804
- Parent:
- 38:24ee50452755
20190119 Modify for 45inc; Checking User SW and sequence
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takeru0x1103 | 17:f9610f3cfa1b | 1 | #include "HbEngine.h" |
takeru0x1103 | 17:f9610f3cfa1b | 2 | #include "fpga.h" |
MasashiNomura | 39:1b76f7df8804 | 3 | #include "globalFlags.h" |
takeru0x1103 | 17:f9610f3cfa1b | 4 | //====================================================== |
takeru0x1103 | 17:f9610f3cfa1b | 5 | //コンストラクタ |
takeru0x1103 | 17:f9610f3cfa1b | 6 | //====================================================== |
takeru0x1103 | 17:f9610f3cfa1b | 7 | HbEngine::HbEngine(UCHAR iID){ |
takeru0x1103 | 17:f9610f3cfa1b | 8 | id = iID; |
MasashiNomura | 39:1b76f7df8804 | 9 | accel = 0; |
MasashiNomura | 39:1b76f7df8804 | 10 | hvAxl = 3600; |
MasashiNomura | 39:1b76f7df8804 | 11 | bSetHvAxl = false; |
takeru0x1103 | 17:f9610f3cfa1b | 12 | } |
takeru0x1103 | 17:f9610f3cfa1b | 13 | |
takeru0x1103 | 17:f9610f3cfa1b | 14 | |
takeru0x1103 | 17:f9610f3cfa1b | 15 | UINT16 HbEngine::getRpm(){ |
takeru0x1103 | 17:f9610f3cfa1b | 16 | UINT16 rpm; |
takeru0x1103 | 17:f9610f3cfa1b | 17 | //エンジン回転数読み出し |
MasashiNomura | 38:24ee50452755 | 18 | //if(id<0||id>1)return 0;//現在の使用状況では不要 |
MasashiNomura | 38:24ee50452755 | 19 | if(id == 0){ |
MasashiNomura | 38:24ee50452755 | 20 | rpm = fpgaGetRpm(true);//前 |
MasashiNomura | 38:24ee50452755 | 21 | }else/*if(id == 1)*/{ |
MasashiNomura | 38:24ee50452755 | 22 | rpm = fpgaGetRpm(false);//後 |
MasashiNomura | 38:24ee50452755 | 23 | } |
takeru0x1103 | 17:f9610f3cfa1b | 24 | return rpm; |
takeru0x1103 | 17:f9610f3cfa1b | 25 | } |
takeru0x1103 | 17:f9610f3cfa1b | 26 | |
takeru0x1103 | 17:f9610f3cfa1b | 27 | //アクセル設定 |
MasashiNomura | 35:3779201b4c73 | 28 | void HbEngine::setAccel(UINT16 iVal){ |
MasashiNomura | 39:1b76f7df8804 | 29 | accel = iVal > MAX_VAL_12BIT ? MAX_VAL_12BIT : iVal; |
MasashiNomura | 39:1b76f7df8804 | 30 | fpgaEngine(id,accel); |
MasashiNomura | 39:1b76f7df8804 | 31 | } |
MasashiNomura | 39:1b76f7df8804 | 32 | |
MasashiNomura | 39:1b76f7df8804 | 33 | INT16 HbEngine::getAccel(){ |
MasashiNomura | 39:1b76f7df8804 | 34 | INT16 ret; |
MasashiNomura | 39:1b76f7df8804 | 35 | if(accel < 0){ |
MasashiNomura | 39:1b76f7df8804 | 36 | ret = 0; |
MasashiNomura | 39:1b76f7df8804 | 37 | }else if(accel > MAX_VAL_12BIT){ |
MasashiNomura | 39:1b76f7df8804 | 38 | ret = MAX_VAL_12BIT; |
MasashiNomura | 39:1b76f7df8804 | 39 | } else { |
MasashiNomura | 39:1b76f7df8804 | 40 | ret = accel; |
MasashiNomura | 39:1b76f7df8804 | 41 | } |
MasashiNomura | 39:1b76f7df8804 | 42 | return ret; |
MasashiNomura | 23:79e20be4bc5b | 43 | } |
MasashiNomura | 23:79e20be4bc5b | 44 | |
MasashiNomura | 36:2cc739c7e4cb | 45 | void HbEngine::setHoverAccel(INT16 val){ |
MasashiNomura | 36:2cc739c7e4cb | 46 | hvAxl = val; |
MasashiNomura | 36:2cc739c7e4cb | 47 | bSetHvAxl = true; |
MasashiNomura | 36:2cc739c7e4cb | 48 | } |
MasashiNomura | 36:2cc739c7e4cb | 49 | |
MasashiNomura | 36:2cc739c7e4cb | 50 | void HbEngine::clearHoverAccel(){ |
MasashiNomura | 36:2cc739c7e4cb | 51 | hvAxl = 0; |
MasashiNomura | 36:2cc739c7e4cb | 52 | bSetHvAxl = false; |
MasashiNomura | 36:2cc739c7e4cb | 53 | } |
MasashiNomura | 36:2cc739c7e4cb | 54 | |
MasashiNomura | 38:24ee50452755 | 55 | INT16 HbEngine::getHoverAccelVal(){ |
MasashiNomura | 38:24ee50452755 | 56 | return hvAxl; |
MasashiNomura | 38:24ee50452755 | 57 | } |
MasashiNomura | 38:24ee50452755 | 58 | |
MasashiNomura | 36:2cc739c7e4cb | 59 | bool HbEngine::chkSetHoverAccel(){ |
MasashiNomura | 36:2cc739c7e4cb | 60 | return bSetHvAxl; |
MasashiNomura | 36:2cc739c7e4cb | 61 | } |
MasashiNomura | 36:2cc739c7e4cb | 62 | |
MasashiNomura | 23:79e20be4bc5b | 63 | bool HbEngine::chkOverIDLECycle(){ |
MasashiNomura | 23:79e20be4bc5b | 64 | return rpm > IDLE_HI; |
MasashiNomura | 23:79e20be4bc5b | 65 | } |
MasashiNomura | 23:79e20be4bc5b | 66 | |
MasashiNomura | 23:79e20be4bc5b | 67 | bool HbEngine::chkInRangeIDLE(){ |
MasashiNomura | 23:79e20be4bc5b | 68 | return rpm > IDLE_LOW && rpm < IDLE_HI; |
MasashiNomura | 23:79e20be4bc5b | 69 | } |