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: HbUserOpe.cpp
- Revision:
- 33:eb260dbfc22a
- Parent:
- 31:56c554c560c1
- Child:
- 34:234b87f3e6ce
--- a/HbUserOpe.cpp Thu Dec 20 11:38:09 2018 +0000
+++ b/HbUserOpe.cpp Fri Dec 21 12:31:17 2018 +0000
@@ -19,6 +19,28 @@
curOpe.w = fpgaGetUserSw();
return curOpe;
}
+INT16 HbUserOpe::GetAinAccel()
+{
+ // max rpm 8500 ユーザー使用分として7000をマックスとする
+ // 0 ~ 1.00 -> 0.05 ~ 0.95を使用する(遊び分として)
+ INT16 ret = 0;
+ float anaval = AinAxl.read();
+ if(0.01 > anaval){
+ ret = 0;
+ } else if(anaval >= 0.01 && anaval <= 0.97){
+ ret = 5500 * (anaval - 0.01) / 0.96 + 1500;
+ } else if(anaval > 0.97){
+ ret = 7000;
+ }else{
+ ret = 0;
+ }
+ if(gf_DbgPrint.bf.ana1 == true){
+ sp.printf("Axl Rpm=%d val=%f\r\n",ret,anaval);
+ gf_DbgPrint.bf.ana1 = false;
+ }
+ //sp.printf("Axl Rpm=%d val=%f\r\n",ret,anaval);
+ return ret;
+}
// bool HbUserOpe::ChkCtrlSW(SW_TYPE styp)
// {
// if(styp == ACCEL_R){return curOpe.bf.brk_l;}