Skip to content

Commit 0f87a01

Browse files
committed
docs: Update to say that Timer(3) is free, and detail LED intensity.
1 parent a8a4b01 commit 0f87a01

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

docs/library/pyb.LED.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Methods
2525
If no argument is given, return the LED intensity.
2626
If an argument is given, set the LED intensity and return ``None``.
2727

28+
*Note:* Only LED(3) and LED(4) can have a smoothly varying intensity, and
29+
they use timer PWM to implement it. LED(3) uses Timer(2) and LED(4) uses
30+
Timer(3). These timers are only configured for PWM if the intensity of the
31+
relevant LED is set to a value between 1 and 254. Otherwise the timers are
32+
free for general purpose use.
33+
2834
.. method:: led.off()
2935

3036
Turn the LED off.

docs/library/pyb.Timer.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ class Timer -- control internal timers
3737
tim.callback(lambda t: ...) # set callback for update interrupt (t=tim instance)
3838
tim.callback(None) # clear callback
3939
40-
*Note:* Timer 3 is reserved for internal use. Timer 5 controls
41-
the servo driver, and Timer 6 is used for timed ADC/DAC reading/writing.
42-
It is recommended to use the other timers in your programs.
40+
*Note:* Timer(2) and Timer(3) are used for PWM to set the intensity of LED(3)
41+
and LED(4) respectively. But these timers are only configured for PWM if
42+
the intensity of the relevant LED is set to a value between 1 and 254. If
43+
the intensity feature of the LEDs is not used then these timers are free for
44+
general purpose use. Similarly, Timer(5) controls the servo driver, and
45+
Timer(6) is used for timed ADC/DAC reading/writing. It is recommended to
46+
use the other timers in your programs.
4347

4448
*Note:* Memory can't be allocated during a callback (an interrupt) and so
4549
exceptions raised within a callback don't give much information. See
@@ -56,7 +60,7 @@ Constructors
5660

5761
Construct a new timer object of the given id. If additional
5862
arguments are given, then the timer is initialised by ``init(...)``.
59-
``id`` can be 1 to 14, excluding 3.
63+
``id`` can be 1 to 14.
6064

6165
Methods
6266
-------

0 commit comments

Comments
 (0)