Hello Quentin, On Wed, Jul 17, 2024 at 10:48:52AM +0200, Quentin Schulz wrote: > On 7/15/24 5:09 PM, Uwe Kleine-König wrote: > > On Mon, Jul 15, 2024 at 02:16:15PM +0200, Quentin Schulz wrote: > > > To give a bit more info on this, there are two possible flavors of the MCU, > > > ATtiny 816 (datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny416-816-DataSheet-DS40001913B.pdf) > > > and STM32F072CB (datasheet: https://www.st.com/content/ccc/resource/technical/document/reference_manual/c2/f8/8a/f2/18/e6/43/96/DM00031936.pdf/files/DM00031936.pdf/jcr:content/translations/en.DM00031936.pdf). > > > > > > FYI, on ATtiny, we use TCA in single-slope PWM generation mode and PERBUF > > > and CMP2BUF as period and duty-cycle registers. On STM32, we use TIM15 in > > > PWM mode and ARR and CCR1 as period and duty-cycle registers. > > > > Wouldn't it be more natural with these to have duty in a base-2 register > > for duty, in the assumption that your MCUs habe this, too? > > Not sure to understand what you meant by base-2 register here? I am guessing > you rather wanted to suggest a different unit/representation of the duty > cycle in the register in the FW API? For humans 100 as maximal value for a register is natural, but hardware usually uses binary representation ("base-2") for values and usually a register (or bit field) is used completely. That is, valid values range beween 0 and 2^n (or 2^n - 1) for some n. Note this discussion isn't really relevant to the driver. Just me wondering about the hardware design. So if you don't want to follow up, that's fine for me. Best regards Uwe
Attachment:
signature.asc
Description: PGP signature