/* * toggle.cpp * * Created on: Nov 10, 2023 * Author: Dario */ #include #include #include namespace demo { Toggle::Toggle() : sta::tacos::TacosThread{ "Toggle", osPriorityNormal } { } void Toggle::init() { } void Toggle::func() { osDelay(5000); // Have we been requested to terminate while waiting? if (isTerminationRequested()) return; // Do some important stuff... uint16_t state = sta::tacos::Statemachine::instance()->getCurrentState(); uint16_t next; if (state != 2) { next = 1 - state; STA_DEBUG_PRINTLN("Toggle!"); sta::tacos::Statemachine::instance()->requestStateTransition(state, next, 0); } } }