GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

Timer interrupts? #17

Closed laterrps closed 6 years ago

laterrps commented 7 years ago

does exist any way for using timer interrrupts?

GrumpyOldPizza commented 7 years ago

Not as of right now.

What are you trying to do ?

On Mon, Aug 21, 2017 at 11:27 AM, laterrps notifications@github.com wrote:

does exist any way for using timer interrrupts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfCSIW1FhGhttFtnWuZz6iTtG3ep0ks5sab4RgaJpZM4O9n9B .

laterrps commented 7 years ago

i would like to supervise certain tasks not using if(millis()%x==0) i would like to use timer interrupts.

laterrps commented 7 years ago

I have been watchin your code and i find out that you are using timers interrupts for dac converters and pwm , is it too dificult to implement just timmer interrupts?

GrumpyOldPizza commented 7 years ago

My question was really more like what granularity you need.

The core itself uses internally 1ms timeouts, which you could use.

A Class API does not exist for that yet.

armv7m_timer_t myTimer;

armv7m_timer_create(&myTimer, (armv7m_timer_callback_t)myTimerCallback);

armv7m_timer_start(&myTimer, timeout);

armv7m_timer_stop(&myTimer);

N.b. those timers are one-shot, meaning you need to start the timer again in "myTimerCallback". Ah, "timeout" is in milliseconds.

Hope that helps.

On Mon, Aug 21, 2017 at 12:20 PM, laterrps notifications@github.com wrote:

I have been watchin your code and i find out that you are using timers interrupts for dac converters and pwm , is it too dificult to implement just timmer interrupst?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/17#issuecomment-323816098, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfLnsMHkNXqXNAIhZVmtrdkbn8__Wks5sacpxgaJpZM4O9n9B .

kriswiner commented 7 years ago

Or you could use RTC.Alarm but this would be for a 1 Hz or lower frequency timer.

On Mon, Aug 21, 2017 at 11:26 AM, Thomas Roell notifications@github.com wrote:

My question was really more like what granularity you need.

The core itself uses internally 1ms timeouts, which you could use.

A Class API does not exist for that yet.

armv7m_timer_t myTimer;

armv7m_timer_create(&myTimer, (armv7m_timer_callback_t)myTimerCallback);

armv7m_timer_start(&myTimer, timeout);

armv7m_timer_stop(&myTimer);

N.b. those timers are one-shot, meaning you need to start the timer again in "myTimerCallback". Ah, "timeout" is in milliseconds.

Hope that helps.

  • Thomas

On Mon, Aug 21, 2017 at 12:20 PM, laterrps notifications@github.com wrote:

I have been watchin your code and i find out that you are using timers interrupts for dac converters and pwm , is it too dificult to implement just timmer interrupst?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/17# issuecomment-323816098, or mute the thread https://github.com/notifications/unsubscribe-auth/ AG4QfLnsMHkNXqXNAIhZVmtrdkbn8__Wks5sacpxgaJpZM4O9n9B .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/17#issuecomment-323817231, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qiQwJC3IZwk5PFspV4T4d-JWpxnBks5sacvRgaJpZM4O9n9B .

laterrps commented 7 years ago

Thank you very much i'll see it! best regards!!

laterrps commented 7 years ago

Thank you very much!!! it works!!!

armv7m_timer_t myTimer;

armv7m_timer_create(&myTimer, (armv7m_timer_callback_t)myTimerCallback);

armv7m_timer_start(&myTimer, timeout);

armv7m_timer_stop(&myTimer);