Hi i’m a relative newbie here. is there a way to vary the timeout of timer class programmatically.
Timeout timer;
timer.attach(callback(this,&axis::timerInterr), 10ms);
Hi i’m a relative newbie here. is there a way to vary the timeout of timer class programmatically.
Timeout timer;
timer.attach(callback(this,&axis::timerInterr), 10ms);
Hello,
you can use detach() method of the Timeout class and re-attach your object with new parametr.
timer.detach();
timer.attach(callback(this,&axis::timerInterr), 5ms);
BR, Jan
hi JohnnyK,
i think i wasn’t clear in my question. i needed to calculate a time at run time and you need to pass a “duration”
i ended up doing the following:
std::chrono::microseconds t(int timerPeriod);
timer.attach(callback(this,&axis::timerInterr), t);
where i calculate the “timerPeriod” variable elsewhere.
thanks again
Loay
I had started a thread about callback performance here and I’ve just added a link to may sources:
If you’re using a STM32 MCU, then the HWTimer class may work for you. It isn’t heavily tested, I’ve used it with F407 and F411.
You want to use it also for a stepper driver, there the overhead of the Mbed Timer is significant. I will improve it further, also the CThunk costs a lot of cycles.
My StepperController has some fixed settings and needs also some more work. But acceleration and deceleration works fine, I have used the ramp function from the Arduino AccelStepper Lib. The calculation is using float math, so a MCU with FPU should be used.