From ba1eca29fcdba3d5a21532c6ddc725826ea20191 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 22 Aug 2018 19:12:26 +0200 Subject: [PATCH] Reversed pin configuration/mapping as name->number instead of number->name --- platypush/plugins/gpio/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platypush/plugins/gpio/__init__.py b/platypush/plugins/gpio/__init__.py index 6ea4ac8b..3ff1ba53 100644 --- a/platypush/plugins/gpio/__init__.py +++ b/platypush/plugins/gpio/__init__.py @@ -18,23 +18,23 @@ class GpioPlugin(Plugin): def __init__(self, pins=None, *args, **kwargs): """ - :param pins: Configuration for the GPIO PINs as an pin_number -> name map. + :param pins: Configuration for the GPIO PINs as a name -> pin_number map. :type pins: dict Example:: { - 14: "LED_1", - 15: "LED_2", - 16: "MOTOR", - 17: "SENSOR" + "LED_1": 14, + "LED_2": 15, + "MOTOR": 16, + "SENSOR": 17 } """ super().__init__(*args, **kwargs) - self.pins_by_number = pins if pins else {} - self.pins_by_name = { name:number - for (number, name) in self.pins_by_number.items() } + self.pins_by_name = pins if pins else {} + self.pins_by_number = { number:name + for (name, number) in self.pins_by_name.items() } def _get_pin_number(self, pin): try: