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.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
StateMachine/StateManager.h@84:2c22d01e8ae9, 2017-04-18 (annotated)
- Committer:
- hazheng
- Date:
- Tue Apr 18 22:10:17 2017 +0000
- Branch:
- Drift
- Revision:
- 84:2c22d01e8ae9
- Parent:
- 82:992ba6f31e24
- Child:
- 95:676d829a0e3f
Finished a little doc. need to debug.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hazheng | 84:2c22d01e8ae9 | 1 | /** |
| hazheng | 84:2c22d01e8ae9 | 2 | * @file StateManager.h |
| hazheng | 84:2c22d01e8ae9 | 3 | * @brief The header file for the state manager. |
| hazheng | 84:2c22d01e8ae9 | 4 | * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu> |
| hazheng | 84:2c22d01e8ae9 | 5 | * |
| hazheng | 84:2c22d01e8ae9 | 6 | */ |
| hazheng | 80:c85cb93713b3 | 7 | #pragma once |
| hazheng | 80:c85cb93713b3 | 8 | #ifndef STATE_MANAGER_H |
| hazheng | 80:c85cb93713b3 | 9 | #define STATE_MANAGER_H |
| hazheng | 80:c85cb93713b3 | 10 | |
| hazheng | 80:c85cb93713b3 | 11 | #include <mbed.h> |
| hazheng | 80:c85cb93713b3 | 12 | |
| hazheng | 80:c85cb93713b3 | 13 | class States; |
| hazheng | 80:c85cb93713b3 | 14 | |
| hazheng | 82:992ba6f31e24 | 15 | #define STANDBY_STATE 0 |
| hazheng | 82:992ba6f31e24 | 16 | #define RUNNING_STATE 1 |
| hazheng | 82:992ba6f31e24 | 17 | #define TESTING_STATE 2 |
| hazheng | 80:c85cb93713b3 | 18 | |
| hazheng | 84:2c22d01e8ae9 | 19 | /** |
| hazheng | 84:2c22d01e8ae9 | 20 | * @brief This function will be called on each tick in order to tick the current state. |
| hazheng | 84:2c22d01e8ae9 | 21 | * @param deltaTime The time interval between last tick and current tick. |
| hazheng | 84:2c22d01e8ae9 | 22 | */ |
| hazheng | 80:c85cb93713b3 | 23 | void state_manager_update(float deltaTime); |
| hazheng | 80:c85cb93713b3 | 24 | |
| hazheng | 84:2c22d01e8ae9 | 25 | /** |
| hazheng | 84:2c22d01e8ae9 | 26 | * @brief Switch the current state to a specific state. If the input is not valid, it will be switched to NULL state, which will do nothing. |
| hazheng | 84:2c22d01e8ae9 | 27 | * @param state The defined number that representing different states. |
| hazheng | 84:2c22d01e8ae9 | 28 | */ |
| hazheng | 82:992ba6f31e24 | 29 | void state_manager_switch_state(uint8_t state); |
| hazheng | 82:992ba6f31e24 | 30 | |
| hazheng | 80:c85cb93713b3 | 31 | #endif //STATE_MANAGER_H |
