{"action":"created","comment":{"url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/comments/69357680","id":69357680,"diff_hunk":"@@ -0,0 +1,191 @@\n+// coding: utf-8\n+/* Copyright (c) 2016, Roboterclub Aachen e. V.\n+ * All Rights Reserved.\n+ *\n+ * The file is part of the xpcc library and is released under the 3-clause BSD\n+ * license. See the file `LICENSE` for the full license governing this code.\n+ */\n+// ----------------------------------------------------------------------------\n+\n+#include <stdio.h>\n+#include <cmath>\n+\n+#include <xpcc/debug/logger/logger.hpp>\n+\n+#ifndef XPCC_BMP085_DATA_HPP\n+#define XPCC_BMP085_DATA_HPP\n+\n+#undef  XPCC_LOG_LEVEL\n+#define XPCC_LOG_LEVEL xpcc::log::DISABLED\n+\n+// Forward declaration the test class\n+class Bmp085Test;\n+\n+namespace xpcc\n+{\n+\n+template < typename I2cMaster >\n+class Bmp085;\n+\n+namespace bmp085data\n+{\n+\n+/**\n+ * Holds the calibration data from the sensor.\n+ * Values are used for calculation of calibrated\n+ * sensor values from raw sensor data\n+ */\n+struct ATTRIBUTE_PACKED\n+Calibration\n+{\n+\tint16_t  ac1;\n+\tint16_t  ac2;\n+\tint16_t  ac3;\n+\tuint16_t ac4;\n+\tuint16_t ac5;\n+\tuint16_t ac6;\n+\n+\tint16_t  b1;\n+\tint16_t  b2;\n+\n+\tint16_t  mb;\n+\tint16_t  mc;\n+\tint16_t  md;\n+};\n+\n+enum class\n+CalculationMode\n+{\n+\tFixedPoint,\n+\t// SinglePrecision,\n+\tDoublePrecision,\n+};\n+\n+template < CalculationMode >\n+class ATTRIBUTE_PACKED\n+DataBase\n+{\n+\ttemplate < typename I2cMaster >\n+\tfriend class Bmp085;\n+\n+\t// Grant unit test full access to private members.\n+\tfriend class ::Bmp085Test;\n+\n+public:\n+\t/// DATA Access\n+\tinline Calibration &\n+\tgetCalibration() {\n+\t\treturn calibration;\n+\t}\n+\n+public:\n+\t/// Notify data class about changed buffer of raw temperature data.\n+\tvoid inline\n+\trawTemperatureTouched() { meta &= ~TEMPERATURE_CALCULATED; }\n+\n+\t/// Notify data class about changed buffer of raw pressure data.\n+\tvoid inline\n+\trawPressureTouched() { meta &= ~PRESSURE_CALCULATED; }\n+\n+\t/**\n+\t * Get the calibrated temperature for the device in 0.1 degree Celsius\n+\t *\n+\t * If recalculation is necessary it is done on the fly.\n+\t * No I2C transaction.\n+\t */\n+\tint16_t inline\n+\tgetTemperature();\n+\n+\tvoid inline\n+\tgetTemperature(int16_t &temp) { temp = getTemperature(); };\n+\n+\tvoid inline\n+\tgetTemperature(float &temp);\n+\n+\tvoid inline\n+\tgetTemperature(double &temp);\n+\n+\t/**\n+\t * Get the calibrated pressure from the device in Pascal.\n+\t *\n+\t * If recalculation is necessary it is done on the fly.\n+\t * No I2C transaction.\n+\t */\n+\tint32_t inline\n+\tgetPressure();\n+\n+private:\n+\t/**\n+\t * Use the calibration data read from the sensor to\n+\t * calculate the calibrated temperature from the\n+\t * raw data.\n+\t * The result is stored in this struct for further\n+\t * access.\n+\t * Implemented differently for Fixed Point, Single and\n+\t * Double Precision by template specialsation.\n+\t */\n+\tvoid inline\n+\tcalculateCalibratedTemperature();\n+\n+\t/**\n+\t * See calculateCalibratedTemperature()\n+\t */\n+\tvoid inline\n+\tcalculateCalibratedPressure();\n+\n+\t// The order of these private variable is optimized for alignment of 4\n+\tCalibration calibration;\n+\n+private:\n+\t// Fixed Point\n+\tint16_t calibratedTemperature; // in 0.1 degree Celsius\n+\tint32_t calibratedPressure;    // in Pa\n+\n+\tint32_t b5; // calculated in calculateCalibratedTemperature, needed for calculateCalibratedPressure\n+\n+private:\n+\t// Double Precision\n+\t// Prepared coefficients for temperature conversion in double precision\n+\tdouble c5, c6, mc, md;","path":"src/xpcc/driver/pressure/bmp085_data.hpp","position":149,"original_position":149,"commit_id":"e0a319e4dac11afe50b33154c007865f3df41dba","original_commit_id":"e0a319e4dac11afe50b33154c007865f3df41dba","user":{"login":"salkinium","id":163066,"avatar_url":"https://avatars.githubusercontent.com/u/163066?v=3","gravatar_id":"","url":"https://api.github.com/users/salkinium","html_url":"https://github.com/salkinium","followers_url":"https://api.github.com/users/salkinium/followers","following_url":"https://api.github.com/users/salkinium/following{/other_user}","gists_url":"https://api.github.com/users/salkinium/gists{/gist_id}","starred_url":"https://api.github.com/users/salkinium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salkinium/subscriptions","organizations_url":"https://api.github.com/users/salkinium/orgs","repos_url":"https://api.github.com/users/salkinium/repos","events_url":"https://api.github.com/users/salkinium/events{/privacy}","received_events_url":"https://api.github.com/users/salkinium/received_events","type":"User","site_admin":false},"body":"> That's doing it quite well. Tried with func() in the base class but that did not work out. So that prototype must be repeated in every subclass.\r\n\r\nI was thinking that the base class is not a template and contains only the truly common things.\r\nBut yeah, duplication will not be completely gone.","created_at":"2016-07-01T21:27:10Z","updated_at":"2016-07-01T21:27:10Z","html_url":"https://github.com/roboterclubaachen/xpcc/pull/153#discussion_r69357680","pull_request_url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153","_links":{"self":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/comments/69357680"},"html":{"href":"https://github.com/roboterclubaachen/xpcc/pull/153#discussion_r69357680"},"pull_request":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153"}}},"pull_request":{"url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153","id":75890477,"html_url":"https://github.com/roboterclubaachen/xpcc/pull/153","diff_url":"https://github.com/roboterclubaachen/xpcc/pull/153.diff","patch_url":"https://github.com/roboterclubaachen/xpcc/pull/153.patch","issue_url":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/153","number":153,"state":"open","locked":false,"title":"[driver] Add double precision floating point calculation to BMP085.","user":{"login":"strongly-typed","id":1626990,"avatar_url":"https://avatars.githubusercontent.com/u/1626990?v=3","gravatar_id":"","url":"https://api.github.com/users/strongly-typed","html_url":"https://github.com/strongly-typed","followers_url":"https://api.github.com/users/strongly-typed/followers","following_url":"https://api.github.com/users/strongly-typed/following{/other_user}","gists_url":"https://api.github.com/users/strongly-typed/gists{/gist_id}","starred_url":"https://api.github.com/users/strongly-typed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongly-typed/subscriptions","organizations_url":"https://api.github.com/users/strongly-typed/orgs","repos_url":"https://api.github.com/users/strongly-typed/repos","events_url":"https://api.github.com/users/strongly-typed/events{/privacy}","received_events_url":"https://api.github.com/users/strongly-typed/received_events","type":"User","site_admin":false},"body":"And add a unittest that compares the fixed point results to the floating\r\npoint results.","created_at":"2016-06-30T21:04:06Z","updated_at":"2016-07-01T21:27:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77c1884ca6a4c8d7ee4c95154bf50bf5accb03cf","assignee":{"login":"salkinium","id":163066,"avatar_url":"https://avatars.githubusercontent.com/u/163066?v=3","gravatar_id":"","url":"https://api.github.com/users/salkinium","html_url":"https://github.com/salkinium","followers_url":"https://api.github.com/users/salkinium/followers","following_url":"https://api.github.com/users/salkinium/following{/other_user}","gists_url":"https://api.github.com/users/salkinium/gists{/gist_id}","starred_url":"https://api.github.com/users/salkinium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salkinium/subscriptions","organizations_url":"https://api.github.com/users/salkinium/orgs","repos_url":"https://api.github.com/users/salkinium/repos","events_url":"https://api.github.com/users/salkinium/events{/privacy}","received_events_url":"https://api.github.com/users/salkinium/received_events","type":"User","site_admin":false},"assignees":[{"login":"salkinium","id":163066,"avatar_url":"https://avatars.githubusercontent.com/u/163066?v=3","gravatar_id":"","url":"https://api.github.com/users/salkinium","html_url":"https://github.com/salkinium","followers_url":"https://api.github.com/users/salkinium/followers","following_url":"https://api.github.com/users/salkinium/following{/other_user}","gists_url":"https://api.github.com/users/salkinium/gists{/gist_id}","starred_url":"https://api.github.com/users/salkinium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salkinium/subscriptions","organizations_url":"https://api.github.com/users/salkinium/orgs","repos_url":"https://api.github.com/users/salkinium/repos","events_url":"https://api.github.com/users/salkinium/events{/privacy}","received_events_url":"https://api.github.com/users/salkinium/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153/commits","review_comments_url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153/comments","review_comment_url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/153/comments","statuses_url":"https://api.github.com/repos/roboterclubaachen/xpcc/statuses/e0a319e4dac11afe50b33154c007865f3df41dba","head":{"label":"strongly-typed:feature/ci_bmp085calc","ref":"feature/ci_bmp085calc","sha":"e0a319e4dac11afe50b33154c007865f3df41dba","user":{"login":"strongly-typed","id":1626990,"avatar_url":"https://avatars.githubusercontent.com/u/1626990?v=3","gravatar_id":"","url":"https://api.github.com/users/strongly-typed","html_url":"https://github.com/strongly-typed","followers_url":"https://api.github.com/users/strongly-typed/followers","following_url":"https://api.github.com/users/strongly-typed/following{/other_user}","gists_url":"https://api.github.com/users/strongly-typed/gists{/gist_id}","starred_url":"https://api.github.com/users/strongly-typed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongly-typed/subscriptions","organizations_url":"https://api.github.com/users/strongly-typed/orgs","repos_url":"https://api.github.com/users/strongly-typed/repos","events_url":"https://api.github.com/users/strongly-typed/events{/privacy}","received_events_url":"https://api.github.com/users/strongly-typed/received_events","type":"User","site_admin":false},"repo":{"id":40002251,"name":"xpcc","full_name":"strongly-typed/xpcc","owner":{"login":"strongly-typed","id":1626990,"avatar_url":"https://avatars.githubusercontent.com/u/1626990?v=3","gravatar_id":"","url":"https://api.github.com/users/strongly-typed","html_url":"https://github.com/strongly-typed","followers_url":"https://api.github.com/users/strongly-typed/followers","following_url":"https://api.github.com/users/strongly-typed/following{/other_user}","gists_url":"https://api.github.com/users/strongly-typed/gists{/gist_id}","starred_url":"https://api.github.com/users/strongly-typed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongly-typed/subscriptions","organizations_url":"https://api.github.com/users/strongly-typed/orgs","repos_url":"https://api.github.com/users/strongly-typed/repos","events_url":"https://api.github.com/users/strongly-typed/events{/privacy}","received_events_url":"https://api.github.com/users/strongly-typed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/strongly-typed/xpcc","description":"The C++ microcontroller framework xpcc","fork":true,"url":"https://api.github.com/repos/strongly-typed/xpcc","forks_url":"https://api.github.com/repos/strongly-typed/xpcc/forks","keys_url":"https://api.github.com/repos/strongly-typed/xpcc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongly-typed/xpcc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongly-typed/xpcc/teams","hooks_url":"https://api.github.com/repos/strongly-typed/xpcc/hooks","issue_events_url":"https://api.github.com/repos/strongly-typed/xpcc/issues/events{/number}","events_url":"https://api.github.com/repos/strongly-typed/xpcc/events","assignees_url":"https://api.github.com/repos/strongly-typed/xpcc/assignees{/user}","branches_url":"https://api.github.com/repos/strongly-typed/xpcc/branches{/branch}","tags_url":"https://api.github.com/repos/strongly-typed/xpcc/tags","blobs_url":"https://api.github.com/repos/strongly-typed/xpcc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongly-typed/xpcc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongly-typed/xpcc/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongly-typed/xpcc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongly-typed/xpcc/statuses/{sha}","languages_url":"https://api.github.com/repos/strongly-typed/xpcc/languages","stargazers_url":"https://api.github.com/repos/strongly-typed/xpcc/stargazers","contributors_url":"https://api.github.com/repos/strongly-typed/xpcc/contributors","subscribers_url":"https://api.github.com/repos/strongly-typed/xpcc/subscribers","subscription_url":"https://api.github.com/repos/strongly-typed/xpcc/subscription","commits_url":"https://api.github.com/repos/strongly-typed/xpcc/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongly-typed/xpcc/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongly-typed/xpcc/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongly-typed/xpcc/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongly-typed/xpcc/contents/{+path}","compare_url":"https://api.github.com/repos/strongly-typed/xpcc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongly-typed/xpcc/merges","archive_url":"https://api.github.com/repos/strongly-typed/xpcc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongly-typed/xpcc/downloads","issues_url":"https://api.github.com/repos/strongly-typed/xpcc/issues{/number}","pulls_url":"https://api.github.com/repos/strongly-typed/xpcc/pulls{/number}","milestones_url":"https://api.github.com/repos/strongly-typed/xpcc/milestones{/number}","notifications_url":"https://api.github.com/repos/strongly-typed/xpcc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongly-typed/xpcc/labels{/name}","releases_url":"https://api.github.com/repos/strongly-typed/xpcc/releases{/id}","deployments_url":"https://api.github.com/repos/strongly-typed/xpcc/deployments","created_at":"2015-07-31T11:28:23Z","updated_at":"2016-02-05T13:25:52Z","pushed_at":"2016-07-01T14:56:16Z","git_url":"git://github.com/strongly-typed/xpcc.git","ssh_url":"git@github.com:strongly-typed/xpcc.git","clone_url":"https://github.com/strongly-typed/xpcc.git","svn_url":"https://github.com/strongly-typed/xpcc","homepage":"xpcc.io","size":33512,"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":"develop"}},"base":{"label":"roboterclubaachen:develop","ref":"develop","sha":"82c60bc3d4eff63f5fa32af5702d564fc0a86c48","user":{"login":"roboterclubaachen","id":1502326,"avatar_url":"https://avatars.githubusercontent.com/u/1502326?v=3","gravatar_id":"","url":"https://api.github.com/users/roboterclubaachen","html_url":"https://github.com/roboterclubaachen","followers_url":"https://api.github.com/users/roboterclubaachen/followers","following_url":"https://api.github.com/users/roboterclubaachen/following{/other_user}","gists_url":"https://api.github.com/users/roboterclubaachen/gists{/gist_id}","starred_url":"https://api.github.com/users/roboterclubaachen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboterclubaachen/subscriptions","organizations_url":"https://api.github.com/users/roboterclubaachen/orgs","repos_url":"https://api.github.com/users/roboterclubaachen/repos","events_url":"https://api.github.com/users/roboterclubaachen/events{/privacy}","received_events_url":"https://api.github.com/users/roboterclubaachen/received_events","type":"Organization","site_admin":false},"repo":{"id":3626127,"name":"xpcc","full_name":"roboterclubaachen/xpcc","owner":{"login":"roboterclubaachen","id":1502326,"avatar_url":"https://avatars.githubusercontent.com/u/1502326?v=3","gravatar_id":"","url":"https://api.github.com/users/roboterclubaachen","html_url":"https://github.com/roboterclubaachen","followers_url":"https://api.github.com/users/roboterclubaachen/followers","following_url":"https://api.github.com/users/roboterclubaachen/following{/other_user}","gists_url":"https://api.github.com/users/roboterclubaachen/gists{/gist_id}","starred_url":"https://api.github.com/users/roboterclubaachen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboterclubaachen/subscriptions","organizations_url":"https://api.github.com/users/roboterclubaachen/orgs","repos_url":"https://api.github.com/users/roboterclubaachen/repos","events_url":"https://api.github.com/users/roboterclubaachen/events{/privacy}","received_events_url":"https://api.github.com/users/roboterclubaachen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/roboterclubaachen/xpcc","description":"The C++ microcontroller framework xpcc","fork":false,"url":"https://api.github.com/repos/roboterclubaachen/xpcc","forks_url":"https://api.github.com/repos/roboterclubaachen/xpcc/forks","keys_url":"https://api.github.com/repos/roboterclubaachen/xpcc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roboterclubaachen/xpcc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roboterclubaachen/xpcc/teams","hooks_url":"https://api.github.com/repos/roboterclubaachen/xpcc/hooks","issue_events_url":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/events{/number}","events_url":"https://api.github.com/repos/roboterclubaachen/xpcc/events","assignees_url":"https://api.github.com/repos/roboterclubaachen/xpcc/assignees{/user}","branches_url":"https://api.github.com/repos/roboterclubaachen/xpcc/branches{/branch}","tags_url":"https://api.github.com/repos/roboterclubaachen/xpcc/tags","blobs_url":"https://api.github.com/repos/roboterclubaachen/xpcc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roboterclubaachen/xpcc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roboterclubaachen/xpcc/git/refs{/sha}","trees_url":"https://api.github.com/repos/roboterclubaachen/xpcc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roboterclubaachen/xpcc/statuses/{sha}","languages_url":"https://api.github.com/repos/roboterclubaachen/xpcc/languages","stargazers_url":"https://api.github.com/repos/roboterclubaachen/xpcc/stargazers","contributors_url":"https://api.github.com/repos/roboterclubaachen/xpcc/contributors","subscribers_url":"https://api.github.com/repos/roboterclubaachen/xpcc/subscribers","subscription_url":"https://api.github.com/repos/roboterclubaachen/xpcc/subscription","commits_url":"https://api.github.com/repos/roboterclubaachen/xpcc/commits{/sha}","git_commits_url":"https://api.github.com/repos/roboterclubaachen/xpcc/git/commits{/sha}","comments_url":"https://api.github.com/repos/roboterclubaachen/xpcc/comments{/number}","issue_comment_url":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/comments{/number}","contents_url":"https://api.github.com/repos/roboterclubaachen/xpcc/contents/{+path}","compare_url":"https://api.github.com/repos/roboterclubaachen/xpcc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roboterclubaachen/xpcc/merges","archive_url":"https://api.github.com/repos/roboterclubaachen/xpcc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roboterclubaachen/xpcc/downloads","issues_url":"https://api.github.com/repos/roboterclubaachen/xpcc/issues{/number}","pulls_url":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls{/number}","milestones_url":"https://api.github.com/repos/roboterclubaachen/xpcc/milestones{/number}","notifications_url":"https://api.github.com/repos/roboterclubaachen/xpcc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roboterclubaachen/xpcc/labels{/name}","releases_url":"https://api.github.com/repos/roboterclubaachen/xpcc/releases{/id}","deployments_url":"https://api.github.com/repos/roboterclubaachen/xpcc/deployments","created_at":"2012-03-05T10:49:18Z","updated_at":"2016-06-29T18:00:19Z","pushed_at":"2016-07-01T14:56:16Z","git_url":"git://github.com/roboterclubaachen/xpcc.git","ssh_url":"git@github.com:roboterclubaachen/xpcc.git","clone_url":"https://github.com/roboterclubaachen/xpcc.git","svn_url":"https://github.com/roboterclubaachen/xpcc","homepage":"xpcc.io","size":61109,"stargazers_count":93,"watchers_count":93,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":27,"forks":20,"open_issues":27,"watchers":93,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153"},"html":{"href":"https://github.com/roboterclubaachen/xpcc/pull/153"},"issue":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/153"},"comments":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/issues/153/comments"},"review_comments":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153/comments"},"review_comment":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/pulls/153/commits"},"statuses":{"href":"https://api.github.com/repos/roboterclubaachen/xpcc/statuses/e0a319e4dac11afe50b33154c007865f3df41dba"}}}}
{"actor":{"display_login":"salkinium"}}