{"action":"created","comment":{"url":"https://api.github.com/repos/crust-firmware/crust/pulls/comments/179984724","pull_request_review_id":110325675,"id":179984724,"diff_hunk":"@@ -0,0 +1,81 @@\n+/*\n+ * Copyright © 2017-2018 The Crust Firmware Authors.\n+ * SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)\n+ */\n+\n+#ifndef DRIVERS_SENSOR_H\n+#define DRIVERS_SENSOR_H\n+\n+#include <dm.h>\n+#include <intrusive.h>\n+#include <stdbool.h>\n+#include <stdint.h>\n+#include <util.h>\n+\n+#define SENSOR_OPS(dev) \\\n+\t(&container_of((dev)->drv, struct sensor_driver, drv)->ops)\n+\n+struct sensor_conversion {\n+\tconst int16_t min_value;  /**< Addition factor. */\n+\tconst int16_t multiplier; /**< Multiplicaton factor. */\n+};\n+\n+struct sensor_info {\n+\tconst char *const              name;    /**< Name exported to SCPI. */\n+\tuint32_t                       reading; /**< Current value from sensor.\n+\t                                         * */\n+\tconst struct sensor_conversion formula; /**< Information on converting\n+\t                                         * cooked value. */\n+\tconst uint8_t                  address; /**< address of register. */\n+};\n+\n+struct sensor_driver_ops {\n+\tstruct sensor_info *(*get_info)(struct device *dev, uint8_t id);\n+\tuint32_t            (*read_raw)(struct device *dev, uint8_t id,\n+\t                                uint32_t *raw);\n+};\n+\n+struct sensor_driver {\n+\tconst struct driver            drv;\n+\tconst struct sensor_driver_ops ops;\n+};\n+\n+/**\n+ * Get the number of sensors within a device.\n+ *\n+ * This function has no defined errors.\n+ *\n+ * @param dev   A device containing one or more sensors.\n+ * @return      The number of sensors available on this device.\n+ */\n+\n+/**\n+ * Get generic information about a sensor.\n+ *\n+ * This function has no defined errors.\n+ *\n+ * @param dev   The device containing this sensor.\n+ * @param id    The device-specific identifier for this sensor.\n+ * @return      A pointer to the information structure.\n+ */\n+static inline struct sensor_info *\n+sensor_get_info(struct device *dev, uint8_t id)\n+{\n+\treturn SENSOR_OPS(dev)->get_info(dev, id);\n+}\n+\n+/**\n+ * Get the current reading from a sensor. If the value is unknown, this\n+ * function returns UINT32_MAX for the value","path":"include/drivers/sensor.h","position":69,"original_position":69,"commit_id":"1d58d5b92526a7a92be13802ae52491e2802df03","original_commit_id":"1d58d5b92526a7a92be13802ae52491e2802df03","user":{"login":"agom94","id":18688003,"avatar_url":"https://avatars0.githubusercontent.com/u/18688003?v=4","gravatar_id":"","url":"https://api.github.com/users/agom94","html_url":"https://github.com/agom94","followers_url":"https://api.github.com/users/agom94/followers","following_url":"https://api.github.com/users/agom94/following{/other_user}","gists_url":"https://api.github.com/users/agom94/gists{/gist_id}","starred_url":"https://api.github.com/users/agom94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agom94/subscriptions","organizations_url":"https://api.github.com/users/agom94/orgs","repos_url":"https://api.github.com/users/agom94/repos","events_url":"https://api.github.com/users/agom94/events{/privacy}","received_events_url":"https://api.github.com/users/agom94/received_events","type":"User","site_admin":false},"body":"Comment was written before the function. The function implementation does use the same error codes as everywhere else. This comment is now fixed.","created_at":"2018-04-09T04:26:53Z","updated_at":"2018-04-09T04:26:53Z","html_url":"https://github.com/crust-firmware/crust/pull/135#discussion_r179984724","pull_request_url":"https://api.github.com/repos/crust-firmware/crust/pulls/135","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/comments/179984724"},"html":{"href":"https://github.com/crust-firmware/crust/pull/135#discussion_r179984724"},"pull_request":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/135"}},"in_reply_to_id":179979862},"pull_request":{"url":"https://api.github.com/repos/crust-firmware/crust/pulls/135","id":180127793,"html_url":"https://github.com/crust-firmware/crust/pull/135","diff_url":"https://github.com/crust-firmware/crust/pull/135.diff","patch_url":"https://github.com/crust-firmware/crust/pull/135.patch","issue_url":"https://api.github.com/repos/crust-firmware/crust/issues/135","number":135,"state":"open","locked":false,"title":"WIP: Create Sensor class and ths driver","user":{"login":"agom94","id":18688003,"avatar_url":"https://avatars0.githubusercontent.com/u/18688003?v=4","gravatar_id":"","url":"https://api.github.com/users/agom94","html_url":"https://github.com/agom94","followers_url":"https://api.github.com/users/agom94/followers","following_url":"https://api.github.com/users/agom94/following{/other_user}","gists_url":"https://api.github.com/users/agom94/gists{/gist_id}","starred_url":"https://api.github.com/users/agom94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agom94/subscriptions","organizations_url":"https://api.github.com/users/agom94/orgs","repos_url":"https://api.github.com/users/agom94/repos","events_url":"https://api.github.com/users/agom94/events{/privacy}","received_events_url":"https://api.github.com/users/agom94/received_events","type":"User","site_admin":false},"body":"<!-- Thank you for contributing to Crust firmware!\r\n\r\nPull requests that do not follow the guidelines outlined in the Crust firmware\r\ncontribution guidelines are subject to immediate rejection! -->\r\n\r\n## Purpose\r\nAllows crust to get temperature readings.\r\n\r\nCloses #53\r\n\r\n## Considerations for reviewers\r\nStill a WIP but I wouldnt mind a review of any thoughts/suggestions you may have. \r\n","created_at":"2018-04-07T22:15:10Z","updated_at":"2018-04-09T04:26:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbb8934bb8036c7dae25534d29262ba631557691","assignee":null,"assignees":[],"requested_reviewers":[{"login":"drewwalters96","id":9168811,"avatar_url":"https://avatars1.githubusercontent.com/u/9168811?v=4","gravatar_id":"","url":"https://api.github.com/users/drewwalters96","html_url":"https://github.com/drewwalters96","followers_url":"https://api.github.com/users/drewwalters96/followers","following_url":"https://api.github.com/users/drewwalters96/following{/other_user}","gists_url":"https://api.github.com/users/drewwalters96/gists{/gist_id}","starred_url":"https://api.github.com/users/drewwalters96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewwalters96/subscriptions","organizations_url":"https://api.github.com/users/drewwalters96/orgs","repos_url":"https://api.github.com/users/drewwalters96/repos","events_url":"https://api.github.com/users/drewwalters96/events{/privacy}","received_events_url":"https://api.github.com/users/drewwalters96/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/crust-firmware/crust/pulls/135/commits","review_comments_url":"https://api.github.com/repos/crust-firmware/crust/pulls/135/comments","review_comment_url":"https://api.github.com/repos/crust-firmware/crust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crust-firmware/crust/issues/135/comments","statuses_url":"https://api.github.com/repos/crust-firmware/crust/statuses/1d58d5b92526a7a92be13802ae52491e2802df03","head":{"label":"agom94:sensor","ref":"sensor","sha":"1d58d5b92526a7a92be13802ae52491e2802df03","user":{"login":"agom94","id":18688003,"avatar_url":"https://avatars0.githubusercontent.com/u/18688003?v=4","gravatar_id":"","url":"https://api.github.com/users/agom94","html_url":"https://github.com/agom94","followers_url":"https://api.github.com/users/agom94/followers","following_url":"https://api.github.com/users/agom94/following{/other_user}","gists_url":"https://api.github.com/users/agom94/gists{/gist_id}","starred_url":"https://api.github.com/users/agom94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agom94/subscriptions","organizations_url":"https://api.github.com/users/agom94/orgs","repos_url":"https://api.github.com/users/agom94/repos","events_url":"https://api.github.com/users/agom94/events{/privacy}","received_events_url":"https://api.github.com/users/agom94/received_events","type":"User","site_admin":false},"repo":{"id":119324365,"name":"crust","full_name":"agom94/crust","owner":{"login":"agom94","id":18688003,"avatar_url":"https://avatars0.githubusercontent.com/u/18688003?v=4","gravatar_id":"","url":"https://api.github.com/users/agom94","html_url":"https://github.com/agom94","followers_url":"https://api.github.com/users/agom94/followers","following_url":"https://api.github.com/users/agom94/following{/other_user}","gists_url":"https://api.github.com/users/agom94/gists{/gist_id}","starred_url":"https://api.github.com/users/agom94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agom94/subscriptions","organizations_url":"https://api.github.com/users/agom94/orgs","repos_url":"https://api.github.com/users/agom94/repos","events_url":"https://api.github.com/users/agom94/events{/privacy}","received_events_url":"https://api.github.com/users/agom94/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/agom94/crust","description":"ARISC firmware for sunxi SoCs","fork":true,"url":"https://api.github.com/repos/agom94/crust","forks_url":"https://api.github.com/repos/agom94/crust/forks","keys_url":"https://api.github.com/repos/agom94/crust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/agom94/crust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/agom94/crust/teams","hooks_url":"https://api.github.com/repos/agom94/crust/hooks","issue_events_url":"https://api.github.com/repos/agom94/crust/issues/events{/number}","events_url":"https://api.github.com/repos/agom94/crust/events","assignees_url":"https://api.github.com/repos/agom94/crust/assignees{/user}","branches_url":"https://api.github.com/repos/agom94/crust/branches{/branch}","tags_url":"https://api.github.com/repos/agom94/crust/tags","blobs_url":"https://api.github.com/repos/agom94/crust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/agom94/crust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/agom94/crust/git/refs{/sha}","trees_url":"https://api.github.com/repos/agom94/crust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/agom94/crust/statuses/{sha}","languages_url":"https://api.github.com/repos/agom94/crust/languages","stargazers_url":"https://api.github.com/repos/agom94/crust/stargazers","contributors_url":"https://api.github.com/repos/agom94/crust/contributors","subscribers_url":"https://api.github.com/repos/agom94/crust/subscribers","subscription_url":"https://api.github.com/repos/agom94/crust/subscription","commits_url":"https://api.github.com/repos/agom94/crust/commits{/sha}","git_commits_url":"https://api.github.com/repos/agom94/crust/git/commits{/sha}","comments_url":"https://api.github.com/repos/agom94/crust/comments{/number}","issue_comment_url":"https://api.github.com/repos/agom94/crust/issues/comments{/number}","contents_url":"https://api.github.com/repos/agom94/crust/contents/{+path}","compare_url":"https://api.github.com/repos/agom94/crust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/agom94/crust/merges","archive_url":"https://api.github.com/repos/agom94/crust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/agom94/crust/downloads","issues_url":"https://api.github.com/repos/agom94/crust/issues{/number}","pulls_url":"https://api.github.com/repos/agom94/crust/pulls{/number}","milestones_url":"https://api.github.com/repos/agom94/crust/milestones{/number}","notifications_url":"https://api.github.com/repos/agom94/crust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/agom94/crust/labels{/name}","releases_url":"https://api.github.com/repos/agom94/crust/releases{/id}","deployments_url":"https://api.github.com/repos/agom94/crust/deployments","created_at":"2018-01-29T03:04:41Z","updated_at":"2018-04-09T02:16:43Z","pushed_at":"2018-04-09T02:30:17Z","git_url":"git://github.com/agom94/crust.git","ssh_url":"git@github.com:agom94/crust.git","clone_url":"https://github.com/agom94/crust.git","svn_url":"https://github.com/agom94/crust","homepage":null,"size":348,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crust-firmware:master","ref":"master","sha":"75c620c82dec5090859cff30b7ec0422f607daf3","user":{"login":"crust-firmware","id":34251778,"avatar_url":"https://avatars1.githubusercontent.com/u/34251778?v=4","gravatar_id":"","url":"https://api.github.com/users/crust-firmware","html_url":"https://github.com/crust-firmware","followers_url":"https://api.github.com/users/crust-firmware/followers","following_url":"https://api.github.com/users/crust-firmware/following{/other_user}","gists_url":"https://api.github.com/users/crust-firmware/gists{/gist_id}","starred_url":"https://api.github.com/users/crust-firmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crust-firmware/subscriptions","organizations_url":"https://api.github.com/users/crust-firmware/orgs","repos_url":"https://api.github.com/users/crust-firmware/repos","events_url":"https://api.github.com/users/crust-firmware/events{/privacy}","received_events_url":"https://api.github.com/users/crust-firmware/received_events","type":"Organization","site_admin":false},"repo":{"id":114480237,"name":"crust","full_name":"crust-firmware/crust","owner":{"login":"crust-firmware","id":34251778,"avatar_url":"https://avatars1.githubusercontent.com/u/34251778?v=4","gravatar_id":"","url":"https://api.github.com/users/crust-firmware","html_url":"https://github.com/crust-firmware","followers_url":"https://api.github.com/users/crust-firmware/followers","following_url":"https://api.github.com/users/crust-firmware/following{/other_user}","gists_url":"https://api.github.com/users/crust-firmware/gists{/gist_id}","starred_url":"https://api.github.com/users/crust-firmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crust-firmware/subscriptions","organizations_url":"https://api.github.com/users/crust-firmware/orgs","repos_url":"https://api.github.com/users/crust-firmware/repos","events_url":"https://api.github.com/users/crust-firmware/events{/privacy}","received_events_url":"https://api.github.com/users/crust-firmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crust-firmware/crust","description":"ARISC firmware for sunxi SoCs","fork":false,"url":"https://api.github.com/repos/crust-firmware/crust","forks_url":"https://api.github.com/repos/crust-firmware/crust/forks","keys_url":"https://api.github.com/repos/crust-firmware/crust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crust-firmware/crust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crust-firmware/crust/teams","hooks_url":"https://api.github.com/repos/crust-firmware/crust/hooks","issue_events_url":"https://api.github.com/repos/crust-firmware/crust/issues/events{/number}","events_url":"https://api.github.com/repos/crust-firmware/crust/events","assignees_url":"https://api.github.com/repos/crust-firmware/crust/assignees{/user}","branches_url":"https://api.github.com/repos/crust-firmware/crust/branches{/branch}","tags_url":"https://api.github.com/repos/crust-firmware/crust/tags","blobs_url":"https://api.github.com/repos/crust-firmware/crust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crust-firmware/crust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crust-firmware/crust/git/refs{/sha}","trees_url":"https://api.github.com/repos/crust-firmware/crust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crust-firmware/crust/statuses/{sha}","languages_url":"https://api.github.com/repos/crust-firmware/crust/languages","stargazers_url":"https://api.github.com/repos/crust-firmware/crust/stargazers","contributors_url":"https://api.github.com/repos/crust-firmware/crust/contributors","subscribers_url":"https://api.github.com/repos/crust-firmware/crust/subscribers","subscription_url":"https://api.github.com/repos/crust-firmware/crust/subscription","commits_url":"https://api.github.com/repos/crust-firmware/crust/commits{/sha}","git_commits_url":"https://api.github.com/repos/crust-firmware/crust/git/commits{/sha}","comments_url":"https://api.github.com/repos/crust-firmware/crust/comments{/number}","issue_comment_url":"https://api.github.com/repos/crust-firmware/crust/issues/comments{/number}","contents_url":"https://api.github.com/repos/crust-firmware/crust/contents/{+path}","compare_url":"https://api.github.com/repos/crust-firmware/crust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crust-firmware/crust/merges","archive_url":"https://api.github.com/repos/crust-firmware/crust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crust-firmware/crust/downloads","issues_url":"https://api.github.com/repos/crust-firmware/crust/issues{/number}","pulls_url":"https://api.github.com/repos/crust-firmware/crust/pulls{/number}","milestones_url":"https://api.github.com/repos/crust-firmware/crust/milestones{/number}","notifications_url":"https://api.github.com/repos/crust-firmware/crust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crust-firmware/crust/labels{/name}","releases_url":"https://api.github.com/repos/crust-firmware/crust/releases{/id}","deployments_url":"https://api.github.com/repos/crust-firmware/crust/deployments","created_at":"2017-12-16T18:00:03Z","updated_at":"2018-04-09T01:41:47Z","pushed_at":"2018-04-09T02:30:18Z","git_url":"git://github.com/crust-firmware/crust.git","ssh_url":"git@github.com:crust-firmware/crust.git","clone_url":"https://github.com/crust-firmware/crust.git","svn_url":"https://github.com/crust-firmware/crust","homepage":null,"size":334,"stargazers_count":6,"watchers_count":6,"language":"C","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":32,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":5,"open_issues":32,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/135"},"html":{"href":"https://github.com/crust-firmware/crust/pull/135"},"issue":{"href":"https://api.github.com/repos/crust-firmware/crust/issues/135"},"comments":{"href":"https://api.github.com/repos/crust-firmware/crust/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crust-firmware/crust/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/crust-firmware/crust/statuses/1d58d5b92526a7a92be13802ae52491e2802df03"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"agom94"}}