{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/2603","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/2603/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/2603/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/2603/events","html_url":"https://github.com/micropython/micropython/issues/2603","id":187581905,"number":2603,"title":"RFC: Introducing machine.Signal class","user":{"login":"pfalcon","id":500451,"avatar_url":"https://avatars.githubusercontent.com/u/500451?v=3","gravatar_id":"","url":"https://api.github.com/users/pfalcon","html_url":"https://github.com/pfalcon","followers_url":"https://api.github.com/users/pfalcon/followers","following_url":"https://api.github.com/users/pfalcon/following{/other_user}","gists_url":"https://api.github.com/users/pfalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/pfalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfalcon/subscriptions","organizations_url":"https://api.github.com/users/pfalcon/orgs","repos_url":"https://api.github.com/users/pfalcon/repos","events_url":"https://api.github.com/users/pfalcon/events{/privacy}","received_events_url":"https://api.github.com/users/pfalcon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/micropython/micropython/milestones/3","html_url":"https://github.com/micropython/micropython/milestone/3","labels_url":"https://api.github.com/repos/micropython/micropython/milestones/3/labels","id":648060,"number":3,"title":"prio-high","description":"High priority","creator":{"login":"pfalcon","id":500451,"avatar_url":"https://avatars.githubusercontent.com/u/500451?v=3","gravatar_id":"","url":"https://api.github.com/users/pfalcon","html_url":"https://github.com/pfalcon","followers_url":"https://api.github.com/users/pfalcon/followers","following_url":"https://api.github.com/users/pfalcon/following{/other_user}","gists_url":"https://api.github.com/users/pfalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/pfalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfalcon/subscriptions","organizations_url":"https://api.github.com/users/pfalcon/orgs","repos_url":"https://api.github.com/users/pfalcon/repos","events_url":"https://api.github.com/users/pfalcon/events{/privacy}","received_events_url":"https://api.github.com/users/pfalcon/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2014-05-03T19:31:40Z","updated_at":"2016-11-11T11:33:22Z","due_on":null,"closed_at":null},"comments":64,"created_at":"2016-11-06T19:13:13Z","updated_at":"2017-02-13T19:54:51Z","closed_at":null,"body":"This RFC comes from a problem posed in https://github.com/micropython/micropython/pull/2571 : while application in it, while should work the same way on all devices, show different behavior depending whether there's an active-low, or active-high LED. It (RFC) is also a result of initial discussion of the problem done in http://forum.micropython.org/viewtopic.php?f=3&t=2545 .\r\n\r\nSo, what's proposed here is to add \"Signal\" object to handle a hardware signal inversion feature, while leaving Pin object intact. To avoid complex constructors like:\r\n\r\n~~~\r\nled = Signal(Pin(\"A0\"), inverted=True)\r\n~~~\r\n\r\nIt's proposed Signal to accept all the same parameters as Pin (and internally use them in the call to Pin constructor), and additionally \"inverted\" keyword arg (name can be discussed).\r\n\r\nSignal object can have following methods: assert(), deassert(), is_asserted() - likely, in addition to standard Pin methods.\r\n\r\nFormulated like the above, Signal class has implementation benefits comparing to adding \"inverted\" kwarg directly to Pin:\r\n\r\n* Simplest implementations of Pin which don't have internal state, can continue not having it.\r\n* Signal class can be implemented once in port-independent manner and work for any port.\r\n"},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/279503584","html_url":"https://github.com/micropython/micropython/issues/2603#issuecomment-279503584","issue_url":"https://api.github.com/repos/micropython/micropython/issues/2603","id":279503584,"user":{"login":"pfalcon","id":500451,"avatar_url":"https://avatars.githubusercontent.com/u/500451?v=3","gravatar_id":"","url":"https://api.github.com/users/pfalcon","html_url":"https://github.com/pfalcon","followers_url":"https://api.github.com/users/pfalcon/followers","following_url":"https://api.github.com/users/pfalcon/following{/other_user}","gists_url":"https://api.github.com/users/pfalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/pfalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfalcon/subscriptions","organizations_url":"https://api.github.com/users/pfalcon/orgs","repos_url":"https://api.github.com/users/pfalcon/repos","events_url":"https://api.github.com/users/pfalcon/events{/privacy}","received_events_url":"https://api.github.com/users/pfalcon/received_events","type":"User","site_admin":false},"created_at":"2017-02-13T19:54:51Z","updated_at":"2017-02-13T19:54:51Z","body":">> `__call__` is hugely impractical for maintenance of larger projects. There's simply nothing to search for when you want to see when Pin operations happen. \"value\" method name provides good search selectivity.\r\n\r\n> Doesn't that argument also apply to on() and off(). There is no \"value\" to search for\r\n\r\nI'm sorry if that sounded confusing. To search where a particular operation takes place, one would search for a name of a method which performs that operation. And if a method is not called by a name, because it is a special method (like `__call__`), a user is in trouble - there's \"nothing\" to search for, or more exactly, search terms provide very low selectivity (a user gets many false positives).\r\n\r\nConsider following code and you'll understand what I mean:\r\n\r\n~~~\r\na = Pin(1)\r\ndef b(c):\r\n    print(c)\r\n\r\n# 1000 lines later:\r\n\r\na(1)\r\nb(1)\r\n~~~\r\n"}}
{"actor":{"display_login":"pfalcon"}}