SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
StateMachine/StandbyState.cpp@82:992ba6f31e24, 2017-04-18 (annotated)
- Committer:
- hazheng
- Date:
- Tue Apr 18 20:51:06 2017 +0000
- Branch:
- Drift
- Revision:
- 82:992ba6f31e24
- Parent:
- 80:c85cb93713b3
- Child:
- 86:51048c1f132f
Finished state switching.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 80:c85cb93713b3 | 1 | #include "StandbyState.h" |
hazheng | 80:c85cb93713b3 | 2 | |
hazheng | 82:992ba6f31e24 | 3 | #include "ArduUTFT.h" |
hazheng | 82:992ba6f31e24 | 4 | |
hazheng | 82:992ba6f31e24 | 5 | #include "StateManager.h" |
hazheng | 82:992ba6f31e24 | 6 | |
hazheng | 80:c85cb93713b3 | 7 | StandbyState::StandbyState() |
hazheng | 80:c85cb93713b3 | 8 | {} |
hazheng | 80:c85cb93713b3 | 9 | |
hazheng | 80:c85cb93713b3 | 10 | StandbyState::~StandbyState() |
hazheng | 82:992ba6f31e24 | 11 | { |
hazheng | 82:992ba6f31e24 | 12 | ardu_utft_print("X", 10, 10); |
hazheng | 82:992ba6f31e24 | 13 | } |
hazheng | 80:c85cb93713b3 | 14 | |
hazheng | 80:c85cb93713b3 | 15 | void StandbyState::DrawUserInterface() |
hazheng | 80:c85cb93713b3 | 16 | { |
hazheng | 82:992ba6f31e24 | 17 | ardu_utft_clr_scr(); |
hazheng | 80:c85cb93713b3 | 18 | |
hazheng | 82:992ba6f31e24 | 19 | ardu_utft_set_color(0, 0, 255); |
hazheng | 82:992ba6f31e24 | 20 | ardu_utft_fill_rect(10, 10, 310, 110); |
hazheng | 82:992ba6f31e24 | 21 | ardu_utft_set_color(255, 255, 255); |
hazheng | 82:992ba6f31e24 | 22 | ardu_utft_print("Run", 170, 50); |
hazheng | 82:992ba6f31e24 | 23 | |
hazheng | 82:992ba6f31e24 | 24 | ardu_utft_set_color(255, 255, 0); |
hazheng | 82:992ba6f31e24 | 25 | ardu_utft_fill_rect(10, 130, 310, 230); |
hazheng | 82:992ba6f31e24 | 26 | ardu_utft_set_color(255, 255, 255); |
hazheng | 82:992ba6f31e24 | 27 | ardu_utft_print("Test system", 200, 180); |
hazheng | 80:c85cb93713b3 | 28 | } |
hazheng | 80:c85cb93713b3 | 29 | |
hazheng | 80:c85cb93713b3 | 30 | void StandbyState::Update(float deltaTime) |
hazheng | 80:c85cb93713b3 | 31 | { |
hazheng | 80:c85cb93713b3 | 32 | |
hazheng | 80:c85cb93713b3 | 33 | } |
hazheng | 80:c85cb93713b3 | 34 | |
hazheng | 80:c85cb93713b3 | 35 | uint8_t StandbyState::HasTouchPosFunction() const |
hazheng | 80:c85cb93713b3 | 36 | { |
hazheng | 82:992ba6f31e24 | 37 | return 1; |
hazheng | 80:c85cb93713b3 | 38 | } |
hazheng | 80:c85cb93713b3 | 39 | |
hazheng | 80:c85cb93713b3 | 40 | uint8_t StandbyState::HasTouchIrqFunction() const |
hazheng | 80:c85cb93713b3 | 41 | { |
hazheng | 82:992ba6f31e24 | 42 | return 0; |
hazheng | 80:c85cb93713b3 | 43 | } |
hazheng | 80:c85cb93713b3 | 44 | |
hazheng | 80:c85cb93713b3 | 45 | void StandbyState::TouchPosCallback(int16_t x, int16_t y) |
hazheng | 80:c85cb93713b3 | 46 | { |
hazheng | 82:992ba6f31e24 | 47 | if(y <= 110) |
hazheng | 82:992ba6f31e24 | 48 | { |
hazheng | 82:992ba6f31e24 | 49 | ardu_utft_print("X", x, y); |
hazheng | 82:992ba6f31e24 | 50 | state_manager_switch_state(RUNNING_STATE); |
hazheng | 82:992ba6f31e24 | 51 | |
hazheng | 82:992ba6f31e24 | 52 | } |
hazheng | 82:992ba6f31e24 | 53 | else if(y >= 130) |
hazheng | 82:992ba6f31e24 | 54 | { |
hazheng | 82:992ba6f31e24 | 55 | |
hazheng | 82:992ba6f31e24 | 56 | } |
hazheng | 80:c85cb93713b3 | 57 | } |
hazheng | 80:c85cb93713b3 | 58 | |
hazheng | 80:c85cb93713b3 | 59 | void StandbyState::TouchIrqCallback() |
hazheng | 80:c85cb93713b3 | 60 | { |
hazheng | 80:c85cb93713b3 | 61 | |
hazheng | 80:c85cb93713b3 | 62 | } |