| 123456789101112131415161718192021222324252627282930 |
- #include "app_api.h"
- foc_fault_t api_set_ready(bool ready) {
- if (ready == foc_is_ready()) {
- return foc_success;
- }
- normal_task_enable(false);
- if (foc_stm_nextstate(ready?START:ANY_STOP) == NoError) {
- foc_set_ready(ready);
- normal_task_enable(true);
- return foc_success;
- }
- normal_task_enable(true);
- return foc_not_allowed;
- }
- foc_fault_t api_set_speed(u16 rpm) {
- normal_task_enable(false);
- FOCState focs = foc_stm_state();
- if (focs == IDLE || focs == ANY_STOP) {
- normal_task_enable(true);
- return foc_not_allowed;
- }
- foc_set_ref_speed(rpm);
- normal_task_enable(true);
- return foc_success;
- }
|