{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/1408","labels_url":"https://api.github.com/repos/micropython/micropython/issues/1408/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/1408/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/1408/events","html_url":"https://github.com/micropython/micropython/issues/1408","id":98825855,"number":1408,"title":"Consistent Pin API for all ports","user":{"login":"danicampora","id":7749335,"avatar_url":"https://avatars.githubusercontent.com/u/7749335?v=3","gravatar_id":"","url":"https://api.github.com/users/danicampora","html_url":"https://github.com/danicampora","followers_url":"https://api.github.com/users/danicampora/followers","following_url":"https://api.github.com/users/danicampora/following{/other_user}","gists_url":"https://api.github.com/users/danicampora/gists{/gist_id}","starred_url":"https://api.github.com/users/danicampora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danicampora/subscriptions","organizations_url":"https://api.github.com/users/danicampora/orgs","repos_url":"https://api.github.com/users/danicampora/repos","events_url":"https://api.github.com/users/danicampora/events{/privacy}","received_events_url":"https://api.github.com/users/danicampora/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-08-03T19:52:13Z","updated_at":"2015-08-11T14:54:25Z","closed_at":null,"body":"This continues what started being discussed in #1405. The Pin API as far as the constructor (and the init()) method is concerned needs to be modified a bit in order to make it more general and suitable for a wide range of MCUs. Here's my proposal:\r\n\r\n```python\r\nPin(pin, mode, *, type=Pin.PP, pull=None, af=0)\r\n```\r\n- `mode` can be `IN`, `OUT` or `AF`\r\n- `type` can be `PP` or `OD`. Irrelevant when `mode=Pin.IN`.\r\n- `pull` can be `PULL_UP`, `PULL_DOWN` or `None` (or `PULL_NONE` but we could save on QSTRs)\r\n- `af` is only relevant when `mode=Pin.AF`. Alternate functions can vary widely from micro to micro so I think it's OK for the values of this param to be port specific.\r\n"},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/129917534","html_url":"https://github.com/micropython/micropython/issues/1408#issuecomment-129917534","issue_url":"https://api.github.com/repos/micropython/micropython/issues/1408","id":129917534,"user":{"login":"danicampora","id":7749335,"avatar_url":"https://avatars.githubusercontent.com/u/7749335?v=3","gravatar_id":"","url":"https://api.github.com/users/danicampora","html_url":"https://github.com/danicampora","followers_url":"https://api.github.com/users/danicampora/followers","following_url":"https://api.github.com/users/danicampora/following{/other_user}","gists_url":"https://api.github.com/users/danicampora/gists{/gist_id}","starred_url":"https://api.github.com/users/danicampora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danicampora/subscriptions","organizations_url":"https://api.github.com/users/danicampora/orgs","repos_url":"https://api.github.com/users/danicampora/repos","events_url":"https://api.github.com/users/danicampora/events{/privacy}","received_events_url":"https://api.github.com/users/danicampora/received_events","type":"User","site_admin":false},"created_at":"2015-08-11T14:54:25Z","updated_at":"2015-08-11T14:54:25Z","body":"> Perhaps a Pin should default to be an input, for circuit safety, rather than an output.\r\n\r\nGood point, but the `mode` is a required param so no need to specify a default value. My mistake, now corrected ;-)."}}