{"action":"created","issue":{"url":"https://api.github.com/repos/spark/firmware/issues/611","labels_url":"https://api.github.com/repos/spark/firmware/issues/611/labels{/name}","comments_url":"https://api.github.com/repos/spark/firmware/issues/611/comments","events_url":"https://api.github.com/repos/spark/firmware/issues/611/events","html_url":"https://github.com/spark/firmware/pull/611","id":106275628,"number":611,"title":"Feature/button events","user":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spark/firmware/milestones/11","html_url":"https://github.com/spark/firmware/milestones/0.4.6","labels_url":"https://api.github.com/repos/spark/firmware/milestones/11/labels","id":1268393,"number":11,"title":"0.4.6","description":"","creator":{"login":"m-mcgowan","id":2465470,"avatar_url":"https://avatars.githubusercontent.com/u/2465470?v=3","gravatar_id":"","url":"https://api.github.com/users/m-mcgowan","html_url":"https://github.com/m-mcgowan","followers_url":"https://api.github.com/users/m-mcgowan/followers","following_url":"https://api.github.com/users/m-mcgowan/following{/other_user}","gists_url":"https://api.github.com/users/m-mcgowan/gists{/gist_id}","starred_url":"https://api.github.com/users/m-mcgowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-mcgowan/subscriptions","organizations_url":"https://api.github.com/users/m-mcgowan/orgs","repos_url":"https://api.github.com/users/m-mcgowan/repos","events_url":"https://api.github.com/users/m-mcgowan/events{/privacy}","received_events_url":"https://api.github.com/users/m-mcgowan/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":32,"state":"closed","created_at":"2015-08-23T22:45:17Z","updated_at":"2015-10-01T12:42:49Z","due_on":"2015-09-29T22:00:00Z","closed_at":"2015-10-01T12:42:49Z"},"comments":1,"created_at":"2015-09-14T05:53:20Z","updated_at":"2015-11-27T11:55:33Z","closed_at":"2015-09-26T03:39:38Z","pull_request":{"url":"https://api.github.com/repos/spark/firmware/pulls/611","html_url":"https://github.com/spark/firmware/pull/611","diff_url":"https://github.com/spark/firmware/pull/611.diff","patch_url":"https://github.com/spark/firmware/pull/611.patch"},"body":"reworked button events to be more flexible, simpler to code and easier to hook by applications.\r\n\r\ne.g. example app that turns the LED magenta while the button is held down\r\n\r\n```\r\nvoid button_handler(system_event_t event, uint32_t duration, void* )\r\n{\r\n    if (!duration) { // just pressed\r\n        RGB.control(true);\r\n        RGB.color(255,0,128);\r\n    }\r\n    else {    // just released\r\n        RGB.control(false);\r\n    }\r\n}\r\n\r\nvoid setup()\r\n{\r\n    System.on(button_status, button_handler);\r\n}\r\n\r\nvoid loop()\r\n{\r\n// it would be nice to fire routine events while the button is being pushed, rather than rely upon loop\r\n    if (System.buttonPushed()>1000) {\r\n        RGB.color(255,128,0);\r\n    }\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/spark/firmware/issues/comments/160123306","html_url":"https://github.com/spark/firmware/pull/611#issuecomment-160123306","issue_url":"https://api.github.com/repos/spark/firmware/issues/611","id":160123306,"user":{"login":"ScruffR","id":6604878,"avatar_url":"https://avatars.githubusercontent.com/u/6604878?v=3","gravatar_id":"","url":"https://api.github.com/users/ScruffR","html_url":"https://github.com/ScruffR","followers_url":"https://api.github.com/users/ScruffR/followers","following_url":"https://api.github.com/users/ScruffR/following{/other_user}","gists_url":"https://api.github.com/users/ScruffR/gists{/gist_id}","starred_url":"https://api.github.com/users/ScruffR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScruffR/subscriptions","organizations_url":"https://api.github.com/users/ScruffR/orgs","repos_url":"https://api.github.com/users/ScruffR/repos","events_url":"https://api.github.com/users/ScruffR/events{/privacy}","received_events_url":"https://api.github.com/users/ScruffR/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T11:55:33Z","updated_at":"2015-11-27T11:55:33Z","body":"This still wants documenting ;-)"}}