{"action":"created","comment":{"url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/comments/80443996","id":80443996,"diff_hunk":"@@ -0,0 +1,118 @@\n+/************************************************************************************************************************\n+ Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.\n+ All rights reserved.\n+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the\n+ following conditions are met:\n+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the\n+ following disclaimer.\n+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the\n+ following disclaimer in the documentation and/or other materials provided with the distribution.\n+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote\n+ products derived from this software without specific prior written permission.\n+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \n+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \n+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE \n+ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ ************************************************************************************************************************/\n+\n+#include \"bme280.h\"\n+#include <letmecreate/letmecreate.h>\n+#include <stdlib.h>\n+#include <unistd.h>\n+\n+struct bme280_t bme280;\n+static uint8_t readResult = 0;\n+\n+s8 weather_click_i2c_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) {\n+    s32 iError = BME280_INIT_VALUE;\n+\n+    for(int t = 0; t < cnt; t++) {\n+        u8 tmp = reg_addr + t;\n+        i2c_write(dev_addr, &tmp, 1);\n+        iError = i2c_read(dev_addr, &tmp, 1) >= 0 ? 0 : -1;\n+        *(reg_data + t) = tmp;\n+        if (iError < 0) {\n+            readResult = -1;\n+            break;\n+        }\n+    }\n+\n+    return (s8) iError;\n+}\n+\n+s8 weather_click_i2c_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) {\n+    s32 iError = BME280_INIT_VALUE;\n+    u8 array[2];\n+\n+    for(int t = 0; t < cnt; t++) {\n+        array[0] = reg_addr;\n+        array[1] = *(reg_data + t);\n+        iError = i2c_write(dev_addr, &array[0], 2) >= 0 ? 0 : -1;\n+        if (iError < 0) {\n+            readResult = -1;\n+            break;\n+        }\n+    }\n+\n+    return (s8) iError;\n+}\n+\n+void weather_click_delay_msek(u32 msek) {\n+    usleep(msek * 1000);\n+}\n+\n+s8 I2C_routine(void) {\n+    bme280.bus_write = weather_click_i2c_bus_write;\n+    bme280.bus_read = weather_click_i2c_bus_read;\n+    bme280.dev_addr = BME280_I2C_ADDRESS1;\n+    bme280.delay_msec = weather_click_delay_msek;\n+\n+    return BME280_INIT_VALUE;\n+}\n+\n+uint8_t weather_click_read_measurements(uint8_t mikrobus_index, double* temperature, double* pressure, double* humidity) {","path":"src/click/weather.c","position":null,"original_position":76,"commit_id":"c345b7b60eb3382907ee786c0fdcfb410138a48c","original_commit_id":"99e255b89140f930c36bfa0f9ee6a89f69a47b25","user":{"login":"mtusnio","id":9969852,"avatar_url":"https://avatars.githubusercontent.com/u/9969852?v=3","gravatar_id":"","url":"https://api.github.com/users/mtusnio","html_url":"https://github.com/mtusnio","followers_url":"https://api.github.com/users/mtusnio/followers","following_url":"https://api.github.com/users/mtusnio/following{/other_user}","gists_url":"https://api.github.com/users/mtusnio/gists{/gist_id}","starred_url":"https://api.github.com/users/mtusnio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtusnio/subscriptions","organizations_url":"https://api.github.com/users/mtusnio/orgs","repos_url":"https://api.github.com/users/mtusnio/repos","events_url":"https://api.github.com/users/mtusnio/events{/privacy}","received_events_url":"https://api.github.com/users/mtusnio/received_events","type":"User","site_admin":false},"body":"Do we need the split in this case? I think as @thetoster mentioned, this might be just a case of the design of the code, as in treating a read as one call to get all readings at once. I remember the joystick click had a similar case where it was better to read x and y axis at the same time to trigger another read.","created_at":"2016-09-26T10:05:22Z","updated_at":"2016-09-26T10:05:22Z","html_url":"https://github.com/francois-berder/LetMeCreate/pull/8#discussion_r80443996","pull_request_url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/comments/80443996"},"html":{"href":"https://github.com/francois-berder/LetMeCreate/pull/8#discussion_r80443996"},"pull_request":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8","id":83250977,"html_url":"https://github.com/francois-berder/LetMeCreate/pull/8","diff_url":"https://github.com/francois-berder/LetMeCreate/pull/8.diff","patch_url":"https://github.com/francois-berder/LetMeCreate/pull/8.patch","issue_url":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/8","number":8,"state":"open","locked":false,"title":"add Weather click support","user":{"login":"thetoster","id":4163370,"avatar_url":"https://avatars.githubusercontent.com/u/4163370?v=3","gravatar_id":"","url":"https://api.github.com/users/thetoster","html_url":"https://github.com/thetoster","followers_url":"https://api.github.com/users/thetoster/followers","following_url":"https://api.github.com/users/thetoster/following{/other_user}","gists_url":"https://api.github.com/users/thetoster/gists{/gist_id}","starred_url":"https://api.github.com/users/thetoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetoster/subscriptions","organizations_url":"https://api.github.com/users/thetoster/orgs","repos_url":"https://api.github.com/users/thetoster/repos","events_url":"https://api.github.com/users/thetoster/events{/privacy}","received_events_url":"https://api.github.com/users/thetoster/received_events","type":"User","site_admin":false},"body":"Introduced Weather Click and BME280 Bosh driver.","created_at":"2016-08-30T11:07:22Z","updated_at":"2016-09-26T10:05:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f93c8af61258c4d2a50f2779e2772f970ac8ef9d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8/commits","review_comments_url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8/comments","review_comment_url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/8/comments","statuses_url":"https://api.github.com/repos/francois-berder/LetMeCreate/statuses/c345b7b60eb3382907ee786c0fdcfb410138a48c","head":{"label":"thetoster:weather_click","ref":"weather_click","sha":"c345b7b60eb3382907ee786c0fdcfb410138a48c","user":{"login":"thetoster","id":4163370,"avatar_url":"https://avatars.githubusercontent.com/u/4163370?v=3","gravatar_id":"","url":"https://api.github.com/users/thetoster","html_url":"https://github.com/thetoster","followers_url":"https://api.github.com/users/thetoster/followers","following_url":"https://api.github.com/users/thetoster/following{/other_user}","gists_url":"https://api.github.com/users/thetoster/gists{/gist_id}","starred_url":"https://api.github.com/users/thetoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetoster/subscriptions","organizations_url":"https://api.github.com/users/thetoster/orgs","repos_url":"https://api.github.com/users/thetoster/repos","events_url":"https://api.github.com/users/thetoster/events{/privacy}","received_events_url":"https://api.github.com/users/thetoster/received_events","type":"User","site_admin":false},"repo":{"id":66830004,"name":"LetMeCreate","full_name":"thetoster/LetMeCreate","owner":{"login":"thetoster","id":4163370,"avatar_url":"https://avatars.githubusercontent.com/u/4163370?v=3","gravatar_id":"","url":"https://api.github.com/users/thetoster","html_url":"https://github.com/thetoster","followers_url":"https://api.github.com/users/thetoster/followers","following_url":"https://api.github.com/users/thetoster/following{/other_user}","gists_url":"https://api.github.com/users/thetoster/gists{/gist_id}","starred_url":"https://api.github.com/users/thetoster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetoster/subscriptions","organizations_url":"https://api.github.com/users/thetoster/orgs","repos_url":"https://api.github.com/users/thetoster/repos","events_url":"https://api.github.com/users/thetoster/events{/privacy}","received_events_url":"https://api.github.com/users/thetoster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thetoster/LetMeCreate","description":null,"fork":true,"url":"https://api.github.com/repos/thetoster/LetMeCreate","forks_url":"https://api.github.com/repos/thetoster/LetMeCreate/forks","keys_url":"https://api.github.com/repos/thetoster/LetMeCreate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thetoster/LetMeCreate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thetoster/LetMeCreate/teams","hooks_url":"https://api.github.com/repos/thetoster/LetMeCreate/hooks","issue_events_url":"https://api.github.com/repos/thetoster/LetMeCreate/issues/events{/number}","events_url":"https://api.github.com/repos/thetoster/LetMeCreate/events","assignees_url":"https://api.github.com/repos/thetoster/LetMeCreate/assignees{/user}","branches_url":"https://api.github.com/repos/thetoster/LetMeCreate/branches{/branch}","tags_url":"https://api.github.com/repos/thetoster/LetMeCreate/tags","blobs_url":"https://api.github.com/repos/thetoster/LetMeCreate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thetoster/LetMeCreate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thetoster/LetMeCreate/git/refs{/sha}","trees_url":"https://api.github.com/repos/thetoster/LetMeCreate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thetoster/LetMeCreate/statuses/{sha}","languages_url":"https://api.github.com/repos/thetoster/LetMeCreate/languages","stargazers_url":"https://api.github.com/repos/thetoster/LetMeCreate/stargazers","contributors_url":"https://api.github.com/repos/thetoster/LetMeCreate/contributors","subscribers_url":"https://api.github.com/repos/thetoster/LetMeCreate/subscribers","subscription_url":"https://api.github.com/repos/thetoster/LetMeCreate/subscription","commits_url":"https://api.github.com/repos/thetoster/LetMeCreate/commits{/sha}","git_commits_url":"https://api.github.com/repos/thetoster/LetMeCreate/git/commits{/sha}","comments_url":"https://api.github.com/repos/thetoster/LetMeCreate/comments{/number}","issue_comment_url":"https://api.github.com/repos/thetoster/LetMeCreate/issues/comments{/number}","contents_url":"https://api.github.com/repos/thetoster/LetMeCreate/contents/{+path}","compare_url":"https://api.github.com/repos/thetoster/LetMeCreate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thetoster/LetMeCreate/merges","archive_url":"https://api.github.com/repos/thetoster/LetMeCreate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thetoster/LetMeCreate/downloads","issues_url":"https://api.github.com/repos/thetoster/LetMeCreate/issues{/number}","pulls_url":"https://api.github.com/repos/thetoster/LetMeCreate/pulls{/number}","milestones_url":"https://api.github.com/repos/thetoster/LetMeCreate/milestones{/number}","notifications_url":"https://api.github.com/repos/thetoster/LetMeCreate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thetoster/LetMeCreate/labels{/name}","releases_url":"https://api.github.com/repos/thetoster/LetMeCreate/releases{/id}","deployments_url":"https://api.github.com/repos/thetoster/LetMeCreate/deployments","created_at":"2016-08-29T09:26:52Z","updated_at":"2016-08-29T09:26:54Z","pushed_at":"2016-09-26T07:25:25Z","git_url":"git://github.com/thetoster/LetMeCreate.git","ssh_url":"git@github.com:thetoster/LetMeCreate.git","clone_url":"https://github.com/thetoster/LetMeCreate.git","svn_url":"https://github.com/thetoster/LetMeCreate","homepage":null,"size":604,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"francois-berder:dev","ref":"dev","sha":"b85ed2854a5381fd9f7961eee675086becf96a5d","user":{"login":"francois-berder","id":18538310,"avatar_url":"https://avatars.githubusercontent.com/u/18538310?v=3","gravatar_id":"","url":"https://api.github.com/users/francois-berder","html_url":"https://github.com/francois-berder","followers_url":"https://api.github.com/users/francois-berder/followers","following_url":"https://api.github.com/users/francois-berder/following{/other_user}","gists_url":"https://api.github.com/users/francois-berder/gists{/gist_id}","starred_url":"https://api.github.com/users/francois-berder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francois-berder/subscriptions","organizations_url":"https://api.github.com/users/francois-berder/orgs","repos_url":"https://api.github.com/users/francois-berder/repos","events_url":"https://api.github.com/users/francois-berder/events{/privacy}","received_events_url":"https://api.github.com/users/francois-berder/received_events","type":"User","site_admin":false},"repo":{"id":59047688,"name":"LetMeCreate","full_name":"francois-berder/LetMeCreate","owner":{"login":"francois-berder","id":18538310,"avatar_url":"https://avatars.githubusercontent.com/u/18538310?v=3","gravatar_id":"","url":"https://api.github.com/users/francois-berder","html_url":"https://github.com/francois-berder","followers_url":"https://api.github.com/users/francois-berder/followers","following_url":"https://api.github.com/users/francois-berder/following{/other_user}","gists_url":"https://api.github.com/users/francois-berder/gists{/gist_id}","starred_url":"https://api.github.com/users/francois-berder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francois-berder/subscriptions","organizations_url":"https://api.github.com/users/francois-berder/orgs","repos_url":"https://api.github.com/users/francois-berder/repos","events_url":"https://api.github.com/users/francois-berder/events{/privacy}","received_events_url":"https://api.github.com/users/francois-berder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/francois-berder/LetMeCreate","description":"","fork":false,"url":"https://api.github.com/repos/francois-berder/LetMeCreate","forks_url":"https://api.github.com/repos/francois-berder/LetMeCreate/forks","keys_url":"https://api.github.com/repos/francois-berder/LetMeCreate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/francois-berder/LetMeCreate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/francois-berder/LetMeCreate/teams","hooks_url":"https://api.github.com/repos/francois-berder/LetMeCreate/hooks","issue_events_url":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/events{/number}","events_url":"https://api.github.com/repos/francois-berder/LetMeCreate/events","assignees_url":"https://api.github.com/repos/francois-berder/LetMeCreate/assignees{/user}","branches_url":"https://api.github.com/repos/francois-berder/LetMeCreate/branches{/branch}","tags_url":"https://api.github.com/repos/francois-berder/LetMeCreate/tags","blobs_url":"https://api.github.com/repos/francois-berder/LetMeCreate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/francois-berder/LetMeCreate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/francois-berder/LetMeCreate/git/refs{/sha}","trees_url":"https://api.github.com/repos/francois-berder/LetMeCreate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/francois-berder/LetMeCreate/statuses/{sha}","languages_url":"https://api.github.com/repos/francois-berder/LetMeCreate/languages","stargazers_url":"https://api.github.com/repos/francois-berder/LetMeCreate/stargazers","contributors_url":"https://api.github.com/repos/francois-berder/LetMeCreate/contributors","subscribers_url":"https://api.github.com/repos/francois-berder/LetMeCreate/subscribers","subscription_url":"https://api.github.com/repos/francois-berder/LetMeCreate/subscription","commits_url":"https://api.github.com/repos/francois-berder/LetMeCreate/commits{/sha}","git_commits_url":"https://api.github.com/repos/francois-berder/LetMeCreate/git/commits{/sha}","comments_url":"https://api.github.com/repos/francois-berder/LetMeCreate/comments{/number}","issue_comment_url":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/comments{/number}","contents_url":"https://api.github.com/repos/francois-berder/LetMeCreate/contents/{+path}","compare_url":"https://api.github.com/repos/francois-berder/LetMeCreate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/francois-berder/LetMeCreate/merges","archive_url":"https://api.github.com/repos/francois-berder/LetMeCreate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/francois-berder/LetMeCreate/downloads","issues_url":"https://api.github.com/repos/francois-berder/LetMeCreate/issues{/number}","pulls_url":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls{/number}","milestones_url":"https://api.github.com/repos/francois-berder/LetMeCreate/milestones{/number}","notifications_url":"https://api.github.com/repos/francois-berder/LetMeCreate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/francois-berder/LetMeCreate/labels{/name}","releases_url":"https://api.github.com/repos/francois-berder/LetMeCreate/releases{/id}","deployments_url":"https://api.github.com/repos/francois-berder/LetMeCreate/deployments","created_at":"2016-05-17T18:18:21Z","updated_at":"2016-08-18T18:02:34Z","pushed_at":"2016-09-26T07:25:25Z","git_url":"git://github.com/francois-berder/LetMeCreate.git","ssh_url":"git@github.com:francois-berder/LetMeCreate.git","clone_url":"https://github.com/francois-berder/LetMeCreate.git","svn_url":"https://github.com/francois-berder/LetMeCreate","homepage":null,"size":665,"stargazers_count":6,"watchers_count":6,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":3,"forks":6,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8"},"html":{"href":"https://github.com/francois-berder/LetMeCreate/pull/8"},"issue":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/8"},"comments":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/francois-berder/LetMeCreate/statuses/c345b7b60eb3382907ee786c0fdcfb410138a48c"}}}}
{"actor":{"display_login":"mtusnio"}}