{"action":"opened","issue":{"url":"https://api.github.com/repos/whaleygeek/anyio/issues/22","repository_url":"https://api.github.com/repos/whaleygeek/anyio","labels_url":"https://api.github.com/repos/whaleygeek/anyio/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/whaleygeek/anyio/issues/22/comments","events_url":"https://api.github.com/repos/whaleygeek/anyio/issues/22/events","html_url":"https://github.com/whaleygeek/anyio/issues/22","id":157377392,"number":22,"title":"Improvements in modular architecture","user":{"login":"whaleygeek","id":4086785,"avatar_url":"https://avatars.githubusercontent.com/u/4086785?v=3","gravatar_id":"","url":"https://api.github.com/users/whaleygeek","html_url":"https://github.com/whaleygeek","followers_url":"https://api.github.com/users/whaleygeek/followers","following_url":"https://api.github.com/users/whaleygeek/following{/other_user}","gists_url":"https://api.github.com/users/whaleygeek/gists{/gist_id}","starred_url":"https://api.github.com/users/whaleygeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whaleygeek/subscriptions","organizations_url":"https://api.github.com/users/whaleygeek/orgs","repos_url":"https://api.github.com/users/whaleygeek/repos","events_url":"https://api.github.com/users/whaleygeek/events{/privacy}","received_events_url":"https://api.github.com/users/whaleygeek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-29T09:23:18Z","updated_at":"2016-05-29T09:23:18Z","closed_at":null,"body":"I want to improve the modular architecture, both at the arduino end and at the python end.\r\n\r\nIn order to add different modules at the python end for things like Analog, PWM, SPI and I2C (especially to mimic other third party libraries like rpi-smbus to enable a range of existing python libraries to be used out of the box), there needs to be a way to multiplex a single link to the arduino board for multiple purposes.\r\n\r\nThe arduino firmware already has a 'character prefix' command style that can be multiplexed to different driver modules at the arduino end, so that should probably cope ok. However, at the Python end, the GPIOClient owns the serial port and won't really share it amongst different usages. This will get especially hard if different code is running indifferent threads (e.g. pwm in one thread and analog in a second), as there is a single shared link to the arduino board, and this does not share very well at the moment.\r\n\r\nI'm going to suggest some architectural changes at the Python end that should be mostly compatible with existing code, but probably introduce a better request multiplexer with thread-safe support, and a message router for incoming rx messages (so that responses can correctly be routed to the thread/task/code that expects that response).\r\n\r\nThe ultimate aim is to allow any number of I/O capable libraries to be sat on top of this and work together. The test case is to be able to use RPi.smbus and RPi.GPIO like abstractions simultaneously *underneath* existing code that uses those two existing abstractions (clearly performance might tail off a bit, but it should at least *logically* work)."}}
{"actor":{"display_login":"whaleygeek"}}