Commit Graph

14 Commits (6ee4c7e21963b184b1f93c0bf9375b583dbc9051)

Author SHA1 Message Date
Laurent MEUNIER ea2cc1d0e1 STM32 16bits tickers: consider all corner cases in us_ticker_set_interrupt
The present commit comes from monkiineko mbed contributor.
The comments in code explains in details all the possible case and
how they are handled.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER fbfbb5e982 STM32 16 bits ticker: fix grammar issues in comments 2017-06-05 13:12:20 +02:00
Laurent MEUNIER 572a096c08 STM32 16 bits tickers: save useless instance init
TimMasterHandle.Instance initialization can be removed from here,
because it will either have been already done previously,
or it will be done in the us_ticker_init() call immediately below.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 27be2e1884 STM32 16 bits ticker: don't check FLAG just clear it
Not having the check will make the code more efficient.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 1b684ca4e9 STM32 16 bits tickers, no need to check TIM_FLAG_CC1OF FLAG
Following previous fixes on 16 tickers handling, the overflow flag
condition will not happen anymore, so the work-around in place is
not needed anymore
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 35c68859c0 STM32: 16 bits ticker, fixes in set function and handler
This commit simplifies ticker interrupt set function and handler.

There were issues around the 16 bits timer wrap-around timing as we were
aligning interrupts with wrap-around limits (0xFFFF) and then reading
TIM_MST->CNT again in timer_update_irq_handler which could lead
to crossing case with the wrap-around (TIM_FLAG_UPDATE) case.

Now we're using the 16 lower bits of the timestamp as the reference from
using in set_compare and never changing it. There is also no need to set
comparator again in timer_update_irq_handler. This is more robust and
also more efficient.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER b9b5f0b929 STM32 16bits ticker: rework us_ticker_read()
Move to a single more reliable implementation of us_ticker_read()
There were historically 2 versions of us_ticker_read() implementation.

The one removed here was not reliable because us_ticker_read() can be
called in interrupt context which means that TIM_MST->CNT would have
wrapped around while SlaveCounter is not yet updated. So there is a need
to check the TIM_FLAG_UPDATE inside this function, which was not done in
the implementation that is removed here.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 675d78d180 STM32 remove usage of deprecated MACROs 2017-05-09 16:48:34 +02:00
bcostm da23ef135e Update license + date (same license as in mbed.h file) 2016-11-14 10:01:07 +01:00
bcostm 2006e458fd Typo corrections (functions declaration) 2016-11-14 09:56:54 +01:00
bcostm 777692cc16 Timer 16bit: Remove volatile variables. This solved many fails with MBED_24 test. 2016-11-14 09:31:14 +01:00
bcostm f8e18cdde4 Change TimMasterHandle variable declaration + typo corrections 2016-11-14 09:31:14 +01:00
bcostm cc24e5b7f9 Add initialization of timer instance in all functions 2016-11-14 09:31:14 +01:00
bcostm 6baec10d29 Rename files (remove stm_ prefix) 2016-11-14 09:31:14 +01:00