Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

What does "#warning Using TIM_DIV256_CLOCK for longest timer" mean? #29

Unanswered
mark-hahn asked this question in Q&A
Discussion options

I'm getting "#warning Using TIM_DIV256_CLOCK for longest timer" in my compiler output. What does this mean? How do I get rid of it? I always want my compiles to be clean of all warnings.

You must be logged in to vote

Replies: 1 comment · 5 replies

Comment options

The warnings were there for unsophisticated users to be aware of the effect of selecting the option.

If you're a sophisticated one, you must know how and where to get rid of it, by commenting out the #warning lines

#if ( defined(USING_TIM_DIV1) && USING_TIM_DIV1 )
#warning Using TIM_DIV1_CLOCK for shortest and most accurate timer
#define TIM_CLOCK_FREQ TIM_DIV1_CLOCK
#define TIM_DIV TIM_DIV1
#elif ( defined(USING_TIM_DIV16) && USING_TIM_DIV16 )
#warning Using TIM_DIV16_CLOCK for medium time and medium accurate timer
#define TIM_CLOCK_FREQ TIM_DIV16_CLOCK
#define TIM_DIV TIM_DIV16
#elif ( defined(USING_TIM_DIV256) && USING_TIM_DIV256 )
#warning Using TIM_DIV256_CLOCK for longest timer but least accurate
#define TIM_CLOCK_FREQ TIM_DIV256_CLOCK
#define TIM_DIV TIM_DIV256
#else
#warning Default to using TIM_DIV256_CLOCK for longest timer but least accurate
#define TIM_CLOCK_FREQ TIM_DIV256_CLOCK
#define TIM_DIV TIM_DIV256
#endif

You must be logged in to vote
5 replies
@mark-hahn
Comment options

Thanks for the fast response.

I'm guess I'm unsophisticated so I don't know what it means and therefore I cannot be aware of the effect. What does the warning mean?

@mark-hahn
Comment options

never mind. I was confused by the word "but". I would have thought it should be "and".

@khoih-prog
Comment options

Using TIM_DIV1_CLOCK for shortest and most accurate timer

As the warning says, when you select TIM_DIV1_CLOCK, you have more accurate timer, but the longest possible ISR timer will be shorter (because of the number of bits, 32/64, used to count, uint32_t or uint64_t)

On the extreme side, Using TIM_DIV256_CLOCK for longest timer but least accurate means when you select TIM_DIV256_CLOCK, you have less accurate timer, but the longest possible ISR timer will be longest.

The selection depends on your use-case. First try the best TIM_DIV1_CLOCK, if not long enough, reduce gradually to USING_TIM_DIV16, then the worst USING_TIM_DIV256

@mark-hahn
Comment options

Thanks. (I wish there was a like button.)

@khoih-prog
Comment options

You're very welcome. Your words are more than enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.