{"action":"opened","issue":{"url":"https://api.github.com/repos/mbedmicro/mbed/issues/2310","repository_url":"https://api.github.com/repos/mbedmicro/mbed","labels_url":"https://api.github.com/repos/mbedmicro/mbed/issues/2310/labels{/name}","comments_url":"https://api.github.com/repos/mbedmicro/mbed/issues/2310/comments","events_url":"https://api.github.com/repos/mbedmicro/mbed/issues/2310/events","html_url":"https://github.com/mbedmicro/mbed/issues/2310","id":168277226,"number":2310,"title":"Better RTOS integration for mbed-drivers","user":{"login":"anpilog","id":4169962,"avatar_url":"https://avatars.githubusercontent.com/u/4169962?v=3","gravatar_id":"","url":"https://api.github.com/users/anpilog","html_url":"https://github.com/anpilog","followers_url":"https://api.github.com/users/anpilog/followers","following_url":"https://api.github.com/users/anpilog/following{/other_user}","gists_url":"https://api.github.com/users/anpilog/gists{/gist_id}","starred_url":"https://api.github.com/users/anpilog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anpilog/subscriptions","organizations_url":"https://api.github.com/users/anpilog/orgs","repos_url":"https://api.github.com/users/anpilog/repos","events_url":"https://api.github.com/users/anpilog/events{/privacy}","received_events_url":"https://api.github.com/users/anpilog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-29T08:39:34Z","updated_at":"2016-07-29T08:39:34Z","closed_at":null,"body":"Hi,\r\n\r\nAs @0xc0170 suggested I created this issue as place to discuss RTOS integration to drivers (SPI, I2C, etc).\r\n\r\nlock()/unlock() methods should address common user needs in better way.\r\n\r\nAs one of the option it could be:\r\n```cpp\r\nclass SPI {\r\npublic:\r\n    virtual bool lock(uint32_t millisec=osWaitForever) {\r\n        return _mutex->lock(millisec) == osOK;\r\n    }\r\n}\r\n```\r\n\r\nIMHO those lock/unlock wrappers around mutex should be used only by user.\r\nCurrent approach when each driver method user lock()/unlock() covers only integrity of register access.\r\nBut in case of SPI, for example, more important to cover a transaction.\r\nAnd so far user has to use separate mutex for this.\r\n"}}
{"actor":{"display_login":"anpilog"}}