Hi there,
I'm studying the analogWrite and related functions (writeFrequency, writeResolution) on the Teensy 4.0 and after looking at the source code it seems like all the analogWriteResolution value does is scale the count value used by the PWM module... I'm just curious as to what use case a resolution less than 16 would have? Could it be useful for optimizing code somehow?
From pwm.c in the Teensy 4 core:
This is the only spot I could find any mention of analog_write_res that wasn't just being passed along from analogWriteResolution.
Hopefully this question hasn't been asked already - I couldn't find anything about it on this forum, but I'm also not sure my pjrc-search-fu is up to snuff... analogWriteResolution did not return many results.
Thanks in advance
Best,
Will
I'm studying the analogWrite and related functions (writeFrequency, writeResolution) on the Teensy 4.0 and after looking at the source code it seems like all the analogWriteResolution value does is scale the count value used by the PWM module... I'm just curious as to what use case a resolution less than 16 would have? Could it be useful for optimizing code somehow?
From pwm.c in the Teensy 4 core:
Code:
Line 143: uint32_t cval = ((uint32_t)val * (modulo + 1)) >> analog_write_res;
This is the only spot I could find any mention of analog_write_res that wasn't just being passed along from analogWriteResolution.
Hopefully this question hasn't been asked already - I couldn't find anything about it on this forum, but I'm also not sure my pjrc-search-fu is up to snuff... analogWriteResolution did not return many results.
Thanks in advance
Best,
Will