{"action":"created","comment":{"url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/comments/65395021","id":65395021,"diff_hunk":"@@ -1,120 +1,68 @@\n /**\n- * @file   drivers.c\n+ * @file   drivers.cpp\n  * @Author Ben Peters (ben@ardusat.com)\n+ * @Author Sam Olds (sam@ardusat.com)\n  * @date   December 3, 2014\n  * @brief  Implements sensor-specific driver read/initialization functions\n  *\n  * These functions are meant to provide a gateway interface that the higher-level\n  * generic interface uses to get data from individual sensors.\n  */\n \n-#include <Arduino.h>\n-#include <Wire.h>\n-#include \"drivers.h\"\n-#include \"pololu_LSM303.h\"\n #include \"ArdusatSDK.h\"\n+#include \"drivers.h\"\n+#include <Wire.h>\n \n static config_lsm303_accel_t _lsm303_d_accel_config;\n static config_lsm303_mag_t _lsm303_d_mag_config;\n static config_l3gd20_t _l3gd20_config;\n \n /**\n- * Generic I2C Read function\n- *\n- * @param devAddr I2C Device address\n- * @param reg Register address\n- * @param val pointer to byte array to read into\n- * @param length number of bytes to read\n- *\n- * @return 0 on success, other on failure\n+ * Check to see if both the ISL29125 and TCS34725 RGB Light Sensors\n+ * exists. They are only included with the spaceboard, not the space\n+ * kit, so if they do exist, the user has a spaceboard.\n  */\n-int _readFromRegAddr(uint8_t devAddr, uint8_t reg, void *val, int length)\n-{\n-  uint8_t *byteArray = (uint8_t *) val;\n-  int ret;\n-  int readData = 0;\n-\n-  Wire.beginTransmission(devAddr);\n-\n-  if (Wire.write(reg) < 1)\n-    return -1;\n-\n-  if ((ret = Wire.endTransmission(false)) != 0) {\n-    return ret;\n-  }\n-\n-  if (byteArray == NULL || length == 0)\n-    return 0;\n-\n-  Wire.beginTransmission(devAddr);\n-  Wire.requestFrom((byte) devAddr, (byte) length);\n-\n-  while (Wire.available() > 0) {\n-    byteArray[readData++] = Wire.read();\n-  }\n-\n-  if ((ret = Wire.endTransmission(true)) != 0) {\n-    return ret;\n+void catchSpaceboard() {\n+  // Only need to check once, as `catchSpaceboard` is called by all\n+  // sensor `begin` functions\n+  if (!ARDUSAT_SPACEBOARD && !MANUAL_CONFIG) {\n+    uint8_t islData;\n+    uint8_t tcsData;\n+    Wire.begin();\n+\n+    // Here, we are checking to see if the sensor replies with the\n+    // correct response at it's expected address on the spaceboard","path":"utility/drivers.cpp","position":74,"original_position":74,"commit_id":"b0800fc8c904cdfb9ad54b19af013c90bc94551d","original_commit_id":"b0800fc8c904cdfb9ad54b19af013c90bc94551d","user":{"login":"bencpeters","id":1310129,"avatar_url":"https://avatars.githubusercontent.com/u/1310129?v=3","gravatar_id":"","url":"https://api.github.com/users/bencpeters","html_url":"https://github.com/bencpeters","followers_url":"https://api.github.com/users/bencpeters/followers","following_url":"https://api.github.com/users/bencpeters/following{/other_user}","gists_url":"https://api.github.com/users/bencpeters/gists{/gist_id}","starred_url":"https://api.github.com/users/bencpeters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bencpeters/subscriptions","organizations_url":"https://api.github.com/users/bencpeters/orgs","repos_url":"https://api.github.com/users/bencpeters/repos","events_url":"https://api.github.com/users/bencpeters/events{/privacy}","received_events_url":"https://api.github.com/users/bencpeters/received_events","type":"User","site_admin":false},"body":"`s/it's/its`","created_at":"2016-06-01T16:25:26Z","updated_at":"2016-06-01T16:25:26Z","html_url":"https://github.com/ArduSat/ArdusatSDK/pull/11#discussion_r65395021","pull_request_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/comments/65395021"},"html":{"href":"https://github.com/ArduSat/ArdusatSDK/pull/11#discussion_r65395021"},"pull_request":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11","id":55041392,"html_url":"https://github.com/ArduSat/ArdusatSDK/pull/11","diff_url":"https://github.com/ArduSat/ArdusatSDK/pull/11.diff","patch_url":"https://github.com/ArduSat/ArdusatSDK/pull/11.patch","issue_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/11","number":11,"state":"open","locked":false,"title":"Support for new Spaceboard Sensors and better detection of hardware","user":{"login":"samolds","id":1863557,"avatar_url":"https://avatars.githubusercontent.com/u/1863557?v=3","gravatar_id":"","url":"https://api.github.com/users/samolds","html_url":"https://github.com/samolds","followers_url":"https://api.github.com/users/samolds/followers","following_url":"https://api.github.com/users/samolds/following{/other_user}","gists_url":"https://api.github.com/users/samolds/gists{/gist_id}","starred_url":"https://api.github.com/users/samolds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samolds/subscriptions","organizations_url":"https://api.github.com/users/samolds/orgs","repos_url":"https://api.github.com/users/samolds/repos","events_url":"https://api.github.com/users/samolds/events{/privacy}","received_events_url":"https://api.github.com/users/samolds/received_events","type":"User","site_admin":false},"body":"Added support for the 3 new spaceboard sensors: ISL29125 (RGB), TCS34725 (RGB), and SI1132 (UV).\r\n\r\nAt this point, this ongoing PR also includes a rewrite of the SDK interface to be more object oriented.","created_at":"2016-01-05T00:28:57Z","updated_at":"2016-06-01T16:25:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"072fe0c6bdb5402cfbb9b41b45b93c964afaed2b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11/commits","review_comments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11/comments","review_comment_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/11/comments","statuses_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/statuses/b0800fc8c904cdfb9ad54b19af013c90bc94551d","head":{"label":"ArduSat:spaceboard","ref":"spaceboard","sha":"b0800fc8c904cdfb9ad54b19af013c90bc94551d","user":{"login":"ArduSat","id":1914772,"avatar_url":"https://avatars.githubusercontent.com/u/1914772?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduSat","html_url":"https://github.com/ArduSat","followers_url":"https://api.github.com/users/ArduSat/followers","following_url":"https://api.github.com/users/ArduSat/following{/other_user}","gists_url":"https://api.github.com/users/ArduSat/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduSat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduSat/subscriptions","organizations_url":"https://api.github.com/users/ArduSat/orgs","repos_url":"https://api.github.com/users/ArduSat/repos","events_url":"https://api.github.com/users/ArduSat/events{/privacy}","received_events_url":"https://api.github.com/users/ArduSat/received_events","type":"Organization","site_admin":false},"repo":{"id":24110495,"name":"ArdusatSDK","full_name":"ArduSat/ArdusatSDK","owner":{"login":"ArduSat","id":1914772,"avatar_url":"https://avatars.githubusercontent.com/u/1914772?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduSat","html_url":"https://github.com/ArduSat","followers_url":"https://api.github.com/users/ArduSat/followers","following_url":"https://api.github.com/users/ArduSat/following{/other_user}","gists_url":"https://api.github.com/users/ArduSat/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduSat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduSat/subscriptions","organizations_url":"https://api.github.com/users/ArduSat/orgs","repos_url":"https://api.github.com/users/ArduSat/repos","events_url":"https://api.github.com/users/ArduSat/events{/privacy}","received_events_url":"https://api.github.com/users/ArduSat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ArduSat/ArdusatSDK","description":"Ardusat Sensors SDK","fork":false,"url":"https://api.github.com/repos/ArduSat/ArdusatSDK","forks_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/forks","keys_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/teams","hooks_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/hooks","issue_events_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/events{/number}","events_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/events","assignees_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/assignees{/user}","branches_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/branches{/branch}","tags_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/tags","blobs_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/statuses/{sha}","languages_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/languages","stargazers_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/stargazers","contributors_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/contributors","subscribers_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/subscribers","subscription_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/subscription","commits_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/contents/{+path}","compare_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/merges","archive_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/downloads","issues_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues{/number}","pulls_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls{/number}","milestones_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/milestones{/number}","notifications_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/labels{/name}","releases_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/releases{/id}","deployments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/deployments","created_at":"2014-09-16T17:42:33Z","updated_at":"2016-04-16T10:16:08Z","pushed_at":"2016-05-27T21:01:07Z","git_url":"git://github.com/ArduSat/ArdusatSDK.git","ssh_url":"git@github.com:ArduSat/ArdusatSDK.git","clone_url":"https://github.com/ArduSat/ArdusatSDK.git","svn_url":"https://github.com/ArduSat/ArdusatSDK","homepage":null,"size":508,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":2,"forks":11,"open_issues":2,"watchers":15,"default_branch":"master"}},"base":{"label":"ArduSat:master","ref":"master","sha":"b587c06b29a09b4d2f2094b9841d3f2f682799e8","user":{"login":"ArduSat","id":1914772,"avatar_url":"https://avatars.githubusercontent.com/u/1914772?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduSat","html_url":"https://github.com/ArduSat","followers_url":"https://api.github.com/users/ArduSat/followers","following_url":"https://api.github.com/users/ArduSat/following{/other_user}","gists_url":"https://api.github.com/users/ArduSat/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduSat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduSat/subscriptions","organizations_url":"https://api.github.com/users/ArduSat/orgs","repos_url":"https://api.github.com/users/ArduSat/repos","events_url":"https://api.github.com/users/ArduSat/events{/privacy}","received_events_url":"https://api.github.com/users/ArduSat/received_events","type":"Organization","site_admin":false},"repo":{"id":24110495,"name":"ArdusatSDK","full_name":"ArduSat/ArdusatSDK","owner":{"login":"ArduSat","id":1914772,"avatar_url":"https://avatars.githubusercontent.com/u/1914772?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduSat","html_url":"https://github.com/ArduSat","followers_url":"https://api.github.com/users/ArduSat/followers","following_url":"https://api.github.com/users/ArduSat/following{/other_user}","gists_url":"https://api.github.com/users/ArduSat/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduSat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduSat/subscriptions","organizations_url":"https://api.github.com/users/ArduSat/orgs","repos_url":"https://api.github.com/users/ArduSat/repos","events_url":"https://api.github.com/users/ArduSat/events{/privacy}","received_events_url":"https://api.github.com/users/ArduSat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ArduSat/ArdusatSDK","description":"Ardusat Sensors SDK","fork":false,"url":"https://api.github.com/repos/ArduSat/ArdusatSDK","forks_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/forks","keys_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/teams","hooks_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/hooks","issue_events_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/events{/number}","events_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/events","assignees_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/assignees{/user}","branches_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/branches{/branch}","tags_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/tags","blobs_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/statuses/{sha}","languages_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/languages","stargazers_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/stargazers","contributors_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/contributors","subscribers_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/subscribers","subscription_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/subscription","commits_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/contents/{+path}","compare_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/merges","archive_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/downloads","issues_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues{/number}","pulls_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls{/number}","milestones_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/milestones{/number}","notifications_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/labels{/name}","releases_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/releases{/id}","deployments_url":"https://api.github.com/repos/ArduSat/ArdusatSDK/deployments","created_at":"2014-09-16T17:42:33Z","updated_at":"2016-04-16T10:16:08Z","pushed_at":"2016-05-27T21:01:07Z","git_url":"git://github.com/ArduSat/ArdusatSDK.git","ssh_url":"git@github.com:ArduSat/ArdusatSDK.git","clone_url":"https://github.com/ArduSat/ArdusatSDK.git","svn_url":"https://github.com/ArduSat/ArdusatSDK","homepage":null,"size":508,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":2,"forks":11,"open_issues":2,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11"},"html":{"href":"https://github.com/ArduSat/ArdusatSDK/pull/11"},"issue":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/11"},"comments":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/ArduSat/ArdusatSDK/statuses/b0800fc8c904cdfb9ad54b19af013c90bc94551d"}}}}
{"actor":{"display_login":"bencpeters"}}