madhephaestus / ESP32Servo

Arduino-compatible servo library for the ESP32
138 stars 53 forks source link

Use of different min, max and default timer bit depth width depending on ESP32 versions #28

Closed loicreboursiere closed 2 years ago

loicreboursiere commented 2 years ago

Definition of three macros have been added MINIMUM_TIMER_WIDTH, MAXIMUM_TIMER_WIDTH and DEFAULT_TIMER_WIDTH in order to adapt minimum and maximum bit depth for timer width depending on the used ESP32. Specific values have been added for ESP32-C3 through the use of ARDUINO_ESP32C3_DEV. Other ESP32 versions may need their own #else if instructions. The modification has also been used and is working with ESP32-WROOM. setTimerWidth function has been modified in order to take into account MINIMUM_TIMER_WIDTH and MAXIMUM_TIMER_WIDTH macros and make the code more generic on this particular point.

madhephaestus commented 2 years ago

this is great, thanks!