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.
HbUserOpe.cpp@23:79e20be4bc5b, 2018-12-08 (annotated)
- Committer:
- MasashiNomura
- Date:
- Sat Dec 08 12:08:25 2018 +0000
- Revision:
- 23:79e20be4bc5b
- Parent:
- 22:24c9c2dedca9
- Child:
- 26:732bc37fbefd
2018/12/08 Add State Trans etc
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MasashiNomura | 22:24c9c2dedca9 | 1 | #include "HbUserOpe.h" |
| MasashiNomura | 22:24c9c2dedca9 | 2 | #include "fpga.h" |
| MasashiNomura | 22:24c9c2dedca9 | 3 | //========================================= |
| MasashiNomura | 22:24c9c2dedca9 | 4 | //コンストラクタ |
| MasashiNomura | 22:24c9c2dedca9 | 5 | //========================================= |
| MasashiNomura | 22:24c9c2dedca9 | 6 | HbUserOpe::HbUserOpe(){ |
| MasashiNomura | 22:24c9c2dedca9 | 7 | oldOpe.w = curOpe.w = 0; |
| MasashiNomura | 22:24c9c2dedca9 | 8 | } |
| MasashiNomura | 22:24c9c2dedca9 | 9 | |
| MasashiNomura | 22:24c9c2dedca9 | 10 | //========================================= |
| MasashiNomura | 22:24c9c2dedca9 | 11 | //デストラクタ |
| MasashiNomura | 22:24c9c2dedca9 | 12 | //========================================= |
| MasashiNomura | 22:24c9c2dedca9 | 13 | HbUserOpe::~HbUserOpe(){ |
| MasashiNomura | 22:24c9c2dedca9 | 14 | } |
| MasashiNomura | 22:24c9c2dedca9 | 15 | |
| MasashiNomura | 22:24c9c2dedca9 | 16 | typUserSw HbUserOpe::GetUserOpe() |
| MasashiNomura | 22:24c9c2dedca9 | 17 | { |
| MasashiNomura | 22:24c9c2dedca9 | 18 | oldOpe = curOpe; |
| MasashiNomura | 22:24c9c2dedca9 | 19 | curOpe.w = fpgaGetUserSw(); |
| MasashiNomura | 22:24c9c2dedca9 | 20 | return curOpe; |
| MasashiNomura | 23:79e20be4bc5b | 21 | } |
| MasashiNomura | 23:79e20be4bc5b | 22 | bool HbUserOpe::ChkCtrlSW(SW_TYPE styp) |
| MasashiNomura | 23:79e20be4bc5b | 23 | { |
| MasashiNomura | 23:79e20be4bc5b | 24 | if(styp == ACCEL_R){return curOpe.bf.axl_r;} |
| MasashiNomura | 23:79e20be4bc5b | 25 | else if(styp == ACCEL_L){return curOpe.bf.axl_l;} |
| MasashiNomura | 23:79e20be4bc5b | 26 | else if(styp == STOP){return curOpe.bf.stop;} |
| MasashiNomura | 23:79e20be4bc5b | 27 | else if(styp == YAW_CTRL){return curOpe.bf.y_ctrl;} |
| MasashiNomura | 23:79e20be4bc5b | 28 | else/*if(styp == ENG_STOP)*/{return curOpe.bf.eng_stop;} |
| MasashiNomura | 23:79e20be4bc5b | 29 | // UINT16 mask = 0x1 << styp; |
| MasashiNomura | 23:79e20be4bc5b | 30 | // return curOpe.w & mask; |
| MasashiNomura | 23:79e20be4bc5b | 31 | } |
| MasashiNomura | 23:79e20be4bc5b | 32 | bool HbUserOpe::ChkCtrlSwAny() |
| MasashiNomura | 23:79e20be4bc5b | 33 | { |
| MasashiNomura | 23:79e20be4bc5b | 34 | UINT16 mask = 0x1; |
| MasashiNomura | 23:79e20be4bc5b | 35 | for(int i = 0; i < 5; ++i){ |
| MasashiNomura | 23:79e20be4bc5b | 36 | if(curOpe.w & mask){ |
| MasashiNomura | 23:79e20be4bc5b | 37 | return true; |
| MasashiNomura | 23:79e20be4bc5b | 38 | } |
| MasashiNomura | 23:79e20be4bc5b | 39 | mask = mask << 1; |
| MasashiNomura | 23:79e20be4bc5b | 40 | } |
| MasashiNomura | 23:79e20be4bc5b | 41 | return false; |
| MasashiNomura | 23:79e20be4bc5b | 42 | } |