{"action":"created","comment":{"url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/comments/209311257","pull_request_review_id":145305156,"id":209311257,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTMxMTI1Nw==","diff_hunk":"@@ -1,19 +1,76 @@\n+// Dac is a driver for the Digital-To-Analog converter for the LPC40xx chip\n #pragma once\n-\n-#include <cstdint>\n-#include <cstdio>\n+#include \"L0_LowLevel/LPC40xx.h\"\n+#include \"L1_Drivers/pin_configure.hpp\"\n \n class DacInterface\n {\n  public:\n-    virtual bool Initialize();\n-    virtual bool WriteDac(uint16_t dac_output);\n-    virtual bool SetVoltage(float voltage);\n-    // Sine Demonstration Function\n-    virtual void SineDac(uint32_t frequency_hz);\n-    // Sawtooth Demonstration Function\n-    virtual void SawtoothDac(uint32_t frequency_hz);\n-    // Triangle Demonstration Function\n-    virtual void TriangleDac(uint32_t frequency_hz);\n-    virtual void SetBias(bool bias_level);\n+    enum BiasLevel: uint8_t\n+    {\n+        kBiasHigh  = 0,\n+        kBiasLow   = 1\n+    };\n+    virtual void Initialize(void)                   = 0;\n+    virtual bool WriteDac(uint16_t dac_output)      = 0;\n+    virtual bool SetVoltage(float voltage)          = 0;\n+    virtual void SetBias(BiasLevel bias_level)      = 0;\n+};\n+class Dac : public DacInterface\n+{\n+ public:\n+    static LPC_DAC_TypeDef * dac_ptr;\n+    static LPC_SC_TypeDef * sc_ptr;\n+    static LPC_IOCON_TypeDef * iocon_ptr;\n+    static constexpr float kVref = 3.3;\n+    enum Bit : uint8_t\n+    {\n+        kClockDividerReg = 0,\n+        kBiasReg = 16,\n+        kDacOutReg = 6,\n+        kEnableDacReg = 16\n+    };\n+    // PinConfigure led3(PinConfigure::CreatePinConfigure<1, 15>());\n+    /* Initialize Dac by setting the clock divider and enabling \n+      The Dac Pin withiin IOCON.  Then set the initial Bias level to 0 */\n+    void Initialize(void) override\n+    {\n+        // Set Clock Divider to 1\n+        sc_ptr->PCLKSEL = (1 << kClockDividerReg);\n+        // Enable DAC Pin P0.26\n+        iocon_ptr->P0_26 = (1 << kEnableDacReg);\n+        // Set Update Rate to 1MHz\n+        dac_ptr->CR &= ~(1 << kBiasReg);\n+    }\n+    // The Dac ouptut is a 10 bit input and thus it is necessary to\n+    // ensure dac_output is less than 1024(largest 10-bit number)\n+    bool WriteDac(uint16_t dac_output) override\n+    {\n+        SJ2_ASSERT_FATAL(dac_output > 1023,\n+                         \"dac_output is above SJ2\"\n+                         \"output capacity.\");","path":"firmware/library/L1_Drivers/dac.hpp","position":64,"original_position":64,"commit_id":"e0ee5d35feb6976acac391d7c4e1205a50f9e00f","original_commit_id":"e0ee5d35feb6976acac391d7c4e1205a50f9e00f","user":{"login":"kammce","id":4549768,"node_id":"MDQ6VXNlcjQ1NDk3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/4549768?v=4","gravatar_id":"","url":"https://api.github.com/users/kammce","html_url":"https://github.com/kammce","followers_url":"https://api.github.com/users/kammce/followers","following_url":"https://api.github.com/users/kammce/following{/other_user}","gists_url":"https://api.github.com/users/kammce/gists{/gist_id}","starred_url":"https://api.github.com/users/kammce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kammce/subscriptions","organizations_url":"https://api.github.com/users/kammce/orgs","repos_url":"https://api.github.com/users/kammce/repos","events_url":"https://api.github.com/users/kammce/events{/privacy}","received_events_url":"https://api.github.com/users/kammce/received_events","type":"User","site_admin":false},"body":"You can be more specific here. For example you can say, `Input invalid. Input MUST be between 0 and 1023`. So that the user immediately knows what they need to fix. Otherwise, the developer will have to look up what the SJ2's output capacity is.","created_at":"2018-08-10T16:12:24Z","updated_at":"2018-08-10T16:17:21Z","html_url":"https://github.com/kammce/SJSU-Dev2/pull/157#discussion_r209311257","pull_request_url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/comments/209311257"},"html":{"href":"https://github.com/kammce/SJSU-Dev2/pull/157#discussion_r209311257"},"pull_request":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157","id":207276522,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3Mjc2NTIy","html_url":"https://github.com/kammce/SJSU-Dev2/pull/157","diff_url":"https://github.com/kammce/SJSU-Dev2/pull/157.diff","patch_url":"https://github.com/kammce/SJSU-Dev2/pull/157.patch","issue_url":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/157","number":157,"state":"open","locked":false,"title":"Dac Implementation","user":{"login":"RadConMannBor","id":22582870,"node_id":"MDQ6VXNlcjIyNTgyODcw","avatar_url":"https://avatars0.githubusercontent.com/u/22582870?v=4","gravatar_id":"","url":"https://api.github.com/users/RadConMannBor","html_url":"https://github.com/RadConMannBor","followers_url":"https://api.github.com/users/RadConMannBor/followers","following_url":"https://api.github.com/users/RadConMannBor/following{/other_user}","gists_url":"https://api.github.com/users/RadConMannBor/gists{/gist_id}","starred_url":"https://api.github.com/users/RadConMannBor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RadConMannBor/subscriptions","organizations_url":"https://api.github.com/users/RadConMannBor/orgs","repos_url":"https://api.github.com/users/RadConMannBor/repos","events_url":"https://api.github.com/users/RadConMannBor/events{/privacy}","received_events_url":"https://api.github.com/users/RadConMannBor/received_events","type":"User","site_admin":false},"body":"Pull request necessary for code review,  I know i need many changes and i currently need to figure out the correct calculation to implement the frequency into all my demo functions.  ","created_at":"2018-08-09T10:53:52Z","updated_at":"2018-08-10T16:17:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"600eeb10327a145f62e252421b696657024fe9f5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157/commits","review_comments_url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157/comments","review_comment_url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/157/comments","statuses_url":"https://api.github.com/repos/kammce/SJSU-Dev2/statuses/e0ee5d35feb6976acac391d7c4e1205a50f9e00f","head":{"label":"RadConMannBor:Dac_Staging","ref":"Dac_Staging","sha":"e0ee5d35feb6976acac391d7c4e1205a50f9e00f","user":{"login":"RadConMannBor","id":22582870,"node_id":"MDQ6VXNlcjIyNTgyODcw","avatar_url":"https://avatars0.githubusercontent.com/u/22582870?v=4","gravatar_id":"","url":"https://api.github.com/users/RadConMannBor","html_url":"https://github.com/RadConMannBor","followers_url":"https://api.github.com/users/RadConMannBor/followers","following_url":"https://api.github.com/users/RadConMannBor/following{/other_user}","gists_url":"https://api.github.com/users/RadConMannBor/gists{/gist_id}","starred_url":"https://api.github.com/users/RadConMannBor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RadConMannBor/subscriptions","organizations_url":"https://api.github.com/users/RadConMannBor/orgs","repos_url":"https://api.github.com/users/RadConMannBor/repos","events_url":"https://api.github.com/users/RadConMannBor/events{/privacy}","received_events_url":"https://api.github.com/users/RadConMannBor/received_events","type":"User","site_admin":false},"repo":{"id":136752435,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY3NTI0MzU=","name":"SJSU-Dev2","full_name":"RadConMannBor/SJSU-Dev2","owner":{"login":"RadConMannBor","id":22582870,"node_id":"MDQ6VXNlcjIyNTgyODcw","avatar_url":"https://avatars0.githubusercontent.com/u/22582870?v=4","gravatar_id":"","url":"https://api.github.com/users/RadConMannBor","html_url":"https://github.com/RadConMannBor","followers_url":"https://api.github.com/users/RadConMannBor/followers","following_url":"https://api.github.com/users/RadConMannBor/following{/other_user}","gists_url":"https://api.github.com/users/RadConMannBor/gists{/gist_id}","starred_url":"https://api.github.com/users/RadConMannBor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RadConMannBor/subscriptions","organizations_url":"https://api.github.com/users/RadConMannBor/orgs","repos_url":"https://api.github.com/users/RadConMannBor/repos","events_url":"https://api.github.com/users/RadConMannBor/events{/privacy}","received_events_url":"https://api.github.com/users/RadConMannBor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RadConMannBor/SJSU-Dev2","description":"Firmware framework written by San Jose State University for the SJTwo board and LPC4078 microprocessor","fork":true,"url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2","forks_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/forks","keys_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/teams","hooks_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/hooks","issue_events_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/issues/events{/number}","events_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/events","assignees_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/assignees{/user}","branches_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/branches{/branch}","tags_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/tags","blobs_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/git/refs{/sha}","trees_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/statuses/{sha}","languages_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/languages","stargazers_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/stargazers","contributors_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/contributors","subscribers_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/subscribers","subscription_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/subscription","commits_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/commits{/sha}","git_commits_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/git/commits{/sha}","comments_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/comments{/number}","issue_comment_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/issues/comments{/number}","contents_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/contents/{+path}","compare_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/merges","archive_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/downloads","issues_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/issues{/number}","pulls_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/pulls{/number}","milestones_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/milestones{/number}","notifications_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/labels{/name}","releases_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/releases{/id}","deployments_url":"https://api.github.com/repos/RadConMannBor/SJSU-Dev2/deployments","created_at":"2018-06-09T19:39:00Z","updated_at":"2018-08-08T23:15:44Z","pushed_at":"2018-08-10T08:18:35Z","git_url":"git://github.com/RadConMannBor/SJSU-Dev2.git","ssh_url":"git@github.com:RadConMannBor/SJSU-Dev2.git","clone_url":"https://github.com/RadConMannBor/SJSU-Dev2.git","svn_url":"https://github.com/RadConMannBor/SJSU-Dev2","homepage":null,"size":55334,"stargazers_count":1,"watchers_count":1,"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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"kammce:master","ref":"master","sha":"e282f3fa4d262661603a9acfb7a0bf62f31bf2e7","user":{"login":"kammce","id":4549768,"node_id":"MDQ6VXNlcjQ1NDk3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/4549768?v=4","gravatar_id":"","url":"https://api.github.com/users/kammce","html_url":"https://github.com/kammce","followers_url":"https://api.github.com/users/kammce/followers","following_url":"https://api.github.com/users/kammce/following{/other_user}","gists_url":"https://api.github.com/users/kammce/gists{/gist_id}","starred_url":"https://api.github.com/users/kammce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kammce/subscriptions","organizations_url":"https://api.github.com/users/kammce/orgs","repos_url":"https://api.github.com/users/kammce/repos","events_url":"https://api.github.com/users/kammce/events{/privacy}","received_events_url":"https://api.github.com/users/kammce/received_events","type":"User","site_admin":false},"repo":{"id":128694826,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg2OTQ4MjY=","name":"SJSU-Dev2","full_name":"kammce/SJSU-Dev2","owner":{"login":"kammce","id":4549768,"node_id":"MDQ6VXNlcjQ1NDk3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/4549768?v=4","gravatar_id":"","url":"https://api.github.com/users/kammce","html_url":"https://github.com/kammce","followers_url":"https://api.github.com/users/kammce/followers","following_url":"https://api.github.com/users/kammce/following{/other_user}","gists_url":"https://api.github.com/users/kammce/gists{/gist_id}","starred_url":"https://api.github.com/users/kammce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kammce/subscriptions","organizations_url":"https://api.github.com/users/kammce/orgs","repos_url":"https://api.github.com/users/kammce/repos","events_url":"https://api.github.com/users/kammce/events{/privacy}","received_events_url":"https://api.github.com/users/kammce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kammce/SJSU-Dev2","description":"Firmware framework written by San Jose State University for the SJTwo board and LPC4078 microprocessor","fork":false,"url":"https://api.github.com/repos/kammce/SJSU-Dev2","forks_url":"https://api.github.com/repos/kammce/SJSU-Dev2/forks","keys_url":"https://api.github.com/repos/kammce/SJSU-Dev2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kammce/SJSU-Dev2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kammce/SJSU-Dev2/teams","hooks_url":"https://api.github.com/repos/kammce/SJSU-Dev2/hooks","issue_events_url":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/events{/number}","events_url":"https://api.github.com/repos/kammce/SJSU-Dev2/events","assignees_url":"https://api.github.com/repos/kammce/SJSU-Dev2/assignees{/user}","branches_url":"https://api.github.com/repos/kammce/SJSU-Dev2/branches{/branch}","tags_url":"https://api.github.com/repos/kammce/SJSU-Dev2/tags","blobs_url":"https://api.github.com/repos/kammce/SJSU-Dev2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kammce/SJSU-Dev2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kammce/SJSU-Dev2/git/refs{/sha}","trees_url":"https://api.github.com/repos/kammce/SJSU-Dev2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kammce/SJSU-Dev2/statuses/{sha}","languages_url":"https://api.github.com/repos/kammce/SJSU-Dev2/languages","stargazers_url":"https://api.github.com/repos/kammce/SJSU-Dev2/stargazers","contributors_url":"https://api.github.com/repos/kammce/SJSU-Dev2/contributors","subscribers_url":"https://api.github.com/repos/kammce/SJSU-Dev2/subscribers","subscription_url":"https://api.github.com/repos/kammce/SJSU-Dev2/subscription","commits_url":"https://api.github.com/repos/kammce/SJSU-Dev2/commits{/sha}","git_commits_url":"https://api.github.com/repos/kammce/SJSU-Dev2/git/commits{/sha}","comments_url":"https://api.github.com/repos/kammce/SJSU-Dev2/comments{/number}","issue_comment_url":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/comments{/number}","contents_url":"https://api.github.com/repos/kammce/SJSU-Dev2/contents/{+path}","compare_url":"https://api.github.com/repos/kammce/SJSU-Dev2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kammce/SJSU-Dev2/merges","archive_url":"https://api.github.com/repos/kammce/SJSU-Dev2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kammce/SJSU-Dev2/downloads","issues_url":"https://api.github.com/repos/kammce/SJSU-Dev2/issues{/number}","pulls_url":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls{/number}","milestones_url":"https://api.github.com/repos/kammce/SJSU-Dev2/milestones{/number}","notifications_url":"https://api.github.com/repos/kammce/SJSU-Dev2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kammce/SJSU-Dev2/labels{/name}","releases_url":"https://api.github.com/repos/kammce/SJSU-Dev2/releases{/id}","deployments_url":"https://api.github.com/repos/kammce/SJSU-Dev2/deployments","created_at":"2018-04-09T00:49:32Z","updated_at":"2018-08-10T16:02:09Z","pushed_at":"2018-08-10T16:02:04Z","git_url":"git://github.com/kammce/SJSU-Dev2.git","ssh_url":"git@github.com:kammce/SJSU-Dev2.git","clone_url":"https://github.com/kammce/SJSU-Dev2.git","svn_url":"https://github.com/kammce/SJSU-Dev2","homepage":null,"size":50037,"stargazers_count":8,"watchers_count":8,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":66,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":31,"open_issues":66,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157"},"html":{"href":"https://github.com/kammce/SJSU-Dev2/pull/157"},"issue":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/157"},"comments":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/kammce/SJSU-Dev2/statuses/e0ee5d35feb6976acac391d7c4e1205a50f9e00f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kammce"}}