diff options
author | robert-hh <robert@hammelrath.com> | 2024-11-04 16:04:56 +0100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-11-18 16:05:56 +1100 |
commit | 898407defbb6327fde379304846999033bf349c5 (patch) | |
tree | 37a80eb19a64b85a1ca823598816bbaea5764bb2 /docs/mimxrt | |
parent | 5dc9eda1953668eb6861be01ca85f147dcf8d406 (diff) |
ports: Make PWM duty_u16 have an upper value of 65535 across all ports.
The following ports used 65536 as the upper value (100% duty cycle) and are
changed in this commit to use 65535: esp8266, mimxrt, nrf, samd.
Tested that output is high at `duty_u16(65535)` and low at `duty_u16(0)`.
Also verified that at `duty_u16(32768)` the high and low pulse have the
same length.
Partially reverts #10850, commits 9c7ad68165bcd224c94ca6d8f172362cf8000d99
and 2ac643c15bec8c88ece0e944ce58f36d02dfd2dd.
Signed-off-by: robert-hh <robert@hammelrath.com>
Diffstat (limited to 'docs/mimxrt')
-rw-r--r-- | docs/mimxrt/quickref.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/mimxrt/quickref.rst b/docs/mimxrt/quickref.rst index cfd060505..34e0aa79f 100644 --- a/docs/mimxrt/quickref.rst +++ b/docs/mimxrt/quickref.rst @@ -193,7 +193,7 @@ PWM Constructor - *freq* should be an integer which sets the frequency in Hz for the PWM cycle. The valid frequency range is 15 Hz resp. 18Hz resp. 24Hz up to > 1 MHz. - - *duty_u16* sets the duty cycle as a ratio ``duty_u16 / 65536``. + - *duty_u16* sets the duty cycle as a ratio ``duty_u16 / 65535``. The duty cycle of a X channel can only be changed, if the A and B channel of the respective submodule is not used. Otherwise the duty_16 value of the X channel is 32768 (50%). @@ -231,7 +231,7 @@ is created by dividing the pwm_clk signal by an integral factor, according to th f = pwm_clk / (2**n * m) -with n being in the range of 0..7, and m in the range of 2..65536. pmw_clk is 125Mhz +with n being in the range of 0..7, and m in the range of 2..65535. pmw_clk is 125Mhz for MIMXRT1010/1015/1020, 150 MHz for MIMXRT1050/1060/1064 and 160MHz for MIMXRT1170. The lowest frequency is pwm_clk/2**23 (15, 18, 20Hz). The highest frequency with U16 resolution is pwm_clk/2**16 (1907, 2288, 2441 Hz), the highest frequency @@ -255,7 +255,7 @@ Use the :ref:`machine.ADC <machine.ADC>` class:: from machine import ADC adc = ADC(Pin('A2')) # create ADC object on ADC pin - adc.read_u16() # read value, 0-65536 across voltage range 0.0v - 3.3v + adc.read_u16() # read value, 0-65535 across voltage range 0.0v - 3.3v The resolution of the ADC is 12 bit with 10 to 11 bit accuracy, irrespective of the value returned by read_u16(). If you need a higher resolution or better accuracy, use |