Skip to content

Commit 773cb32

Browse files
author
Martin O'Hanlon
committed
rename use_pwm
1 parent b6f3a79 commit 773cb32

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

picozero/picozero.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -550,25 +550,25 @@ class PWMLED(PWMOutputDevice):
550550
"""
551551
PWMLED.brightness = PWMLED.value
552552

553-
def LED(pin, use_pwm=True, active_high=True, initial_value=False):
553+
def LED(pin, pwm=True, active_high=True, initial_value=False):
554554
"""
555555
Returns an instance of :class:`DigitalLED` or :class:`PWMLED` depending on
556-
the value of `use_pwm` parameter.
556+
the value of `pwm` parameter.
557557
558558
::
559559
560560
from picozero import LED
561561
562562
my_pwm_led = LED(1)
563563
564-
my_digital_led = LED(2, use_pwm=False)
564+
my_digital_led = LED(2, pwm=False)
565565
566566
:param int pin:
567567
The pin that the device is connected to.
568568
569569
:param int pin:
570-
If `use_pwm` is :data:`True` (the default), a :class:`PWMLED` will be
571-
returned. If `use_pwm` is :data:`False`, a :class:`DigitalLED` will be
570+
If `pwm` is :data:`True` (the default), a :class:`PWMLED` will be
571+
returned. If `pwm` is :data:`False`, a :class:`DigitalLED` will be
572572
returned. A :class:`PWMLED` can control the brightness of the LED but
573573
uses 1 PWM channel.
574574
@@ -581,7 +581,7 @@ def LED(pin, use_pwm=True, active_high=True, initial_value=False):
581581
If :data:`False` (the default), the device will be off initially. If
582582
:data:`True`, the device will be switched on initially.
583583
"""
584-
if use_pwm:
584+
if pwm:
585585
return PWMLED(
586586
pin=pin,
587587
active_high=active_high,
@@ -593,10 +593,10 @@ def LED(pin, use_pwm=True, active_high=True, initial_value=False):
593593
initial_value=initial_value)
594594

595595
try:
596-
pico_led = LED("LED", use_pwm=False)
596+
pico_led = LED("LED", pwm=False)
597597
except TypeError:
598598
# older version of micropython before "LED" was supported
599-
pico_led = LED(25, use_pwm=False)
599+
pico_led = LED(25, pwm=False)
600600

601601
class PWMBuzzer(PWMOutputDevice):
602602
"""

tests/test_picozero.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def test_LED_factory(self):
301301
self.assertIsInstance(d, PWMLED)
302302
d.close()
303303

304-
d = LED(1, use_pwm=False)
304+
d = LED(1, pwm=False)
305305
self.assertIsInstance(d, DigitalLED)
306306
d.close()
307307

0 commit comments

Comments
 (0)