{"action":"created","comment":{"url":"https://api.github.com/repos/uw-midsun/firmware/pulls/comments/189441685","pull_request_review_id":121626363,"id":189441685,"diff_hunk":"@@ -0,0 +1,42 @@\n+#pragma once\n+// FSM for the charger\n+//\n+// Requires\n+// - notify\n+// - charger_pin\n+// - charger_controller\n+// To be initialized.\n+//\n+// Charger design:\n+//\n+// Charger Disconnected:\n+// - Do nothing\n+//\n+// Charger Connected:\n+// - Notify of connection periodically\n+//\n+// Charger Charging:\n+// - Notify of connection periodically\n+// - Charge while command is not expired and periodically publish data\n+// - Exits immediately in case of fault\n+//\n+// Transition Table:\n+// | From \\ To    | Disconnected | Connected | Charging |\n+// | Disconnected |              |     Y     |     N    |\n+// | Connected    |       Y      |           |   G(Y)   |\n+// | Charging     |       Y      |           |          |\n+//\n+// Y - Allowed\n+// N - Not Allowed\n+// G(Y) - Guarded but Allowed\n+\n+#include <stdbool.h>\n+\n+#include \"charger_can.h\"\n+#include \"event_queue.h\"\n+\n+// Initializes the FSM |charger_can_status| is used to guard against faults.\n+void charger_fsm_init(ChargerCanStatus *charger_can_status);\n+\n+// Attempts the transition based on the event in |e|.\n+bool charger_fsm_process_event(const Event *e);","path":"projects/charger/inc/charger_fsm.h","position":null,"original_position":42,"commit_id":"ee04bca3bc2205fd69974cb55779b1867c9a0722","original_commit_id":"d4f93989831b439ace696024c87dd2e267ddc3a9","user":{"login":"ckitagawa","id":9539007,"avatar_url":"https://avatars0.githubusercontent.com/u/9539007?v=4","gravatar_id":"","url":"https://api.github.com/users/ckitagawa","html_url":"https://github.com/ckitagawa","followers_url":"https://api.github.com/users/ckitagawa/followers","following_url":"https://api.github.com/users/ckitagawa/following{/other_user}","gists_url":"https://api.github.com/users/ckitagawa/gists{/gist_id}","starred_url":"https://api.github.com/users/ckitagawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckitagawa/subscriptions","organizations_url":"https://api.github.com/users/ckitagawa/orgs","repos_url":"https://api.github.com/users/ckitagawa/repos","events_url":"https://api.github.com/users/ckitagawa/events{/privacy}","received_events_url":"https://api.github.com/users/ckitagawa/received_events","type":"User","site_admin":false},"body":"Done. I don't really like that design pattern. I would rather explicitly declare which FSM are executing with this kind of function call but since this seems to be the paradigm others are using I guess I'll go with it.1","created_at":"2018-05-19T18:36:09Z","updated_at":"2018-05-19T18:36:09Z","html_url":"https://github.com/uw-midsun/firmware/pull/186#discussion_r189441685","pull_request_url":"https://api.github.com/repos/uw-midsun/firmware/pulls/186","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/comments/189441685"},"html":{"href":"https://github.com/uw-midsun/firmware/pull/186#discussion_r189441685"},"pull_request":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/186"}},"in_reply_to_id":188622046},"pull_request":{"url":"https://api.github.com/repos/uw-midsun/firmware/pulls/186","id":187990579,"html_url":"https://github.com/uw-midsun/firmware/pull/186","diff_url":"https://github.com/uw-midsun/firmware/pull/186.diff","patch_url":"https://github.com/uw-midsun/firmware/pull/186.patch","issue_url":"https://api.github.com/repos/uw-midsun/firmware/issues/186","number":186,"state":"open","locked":false,"title":"ELEC-355: Finish Charger","user":{"login":"ckitagawa","id":9539007,"avatar_url":"https://avatars0.githubusercontent.com/u/9539007?v=4","gravatar_id":"","url":"https://api.github.com/users/ckitagawa","html_url":"https://github.com/ckitagawa","followers_url":"https://api.github.com/users/ckitagawa/followers","following_url":"https://api.github.com/users/ckitagawa/following{/other_user}","gists_url":"https://api.github.com/users/ckitagawa/gists{/gist_id}","starred_url":"https://api.github.com/users/ckitagawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckitagawa/subscriptions","organizations_url":"https://api.github.com/users/ckitagawa/orgs","repos_url":"https://api.github.com/users/ckitagawa/repos","events_url":"https://api.github.com/users/ckitagawa/events{/privacy}","received_events_url":"https://api.github.com/users/ckitagawa/received_events","type":"User","site_admin":false},"body":"This PR implements the `main()` of the Charger, adds Configuration files and adds the global control FSM.\r\n\r\nWith this the bulk of the charger firmware is finished. The remaining details require finalized hardware specs and designs.\r\n\r\nNote that the following are still not finalized:\r\n- Transmission period for notify/command\r\n- Whether to re-broadcast status messages from the charger over Network CAN.\r\n- `charger_pin.h` will need modification as it may require an ADC or PWM input rather than being interrupt driven for status reasons. (Although CAN already has all this data so this is wholly redundant). \r\n- Whether an external Relay control (not over CAN) is necessary. If so this is a simple addition of a GPIO pin which can either be added directly to the FSM or merged into `charger_controller`\r\n\r\n@taipingli do you have any of these details finalized?","created_at":"2018-05-15T01:19:52Z","updated_at":"2018-05-19T18:36:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8553fcf511ab716132140ce81ff85c897a7cca5","assignee":null,"assignees":[],"requested_reviewers":[{"login":"karlding","id":6836385,"avatar_url":"https://avatars2.githubusercontent.com/u/6836385?v=4","gravatar_id":"","url":"https://api.github.com/users/karlding","html_url":"https://github.com/karlding","followers_url":"https://api.github.com/users/karlding/followers","following_url":"https://api.github.com/users/karlding/following{/other_user}","gists_url":"https://api.github.com/users/karlding/gists{/gist_id}","starred_url":"https://api.github.com/users/karlding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlding/subscriptions","organizations_url":"https://api.github.com/users/karlding/orgs","repos_url":"https://api.github.com/users/karlding/repos","events_url":"https://api.github.com/users/karlding/events{/privacy}","received_events_url":"https://api.github.com/users/karlding/received_events","type":"User","site_admin":false},{"login":"taipingli","id":20136820,"avatar_url":"https://avatars3.githubusercontent.com/u/20136820?v=4","gravatar_id":"","url":"https://api.github.com/users/taipingli","html_url":"https://github.com/taipingli","followers_url":"https://api.github.com/users/taipingli/followers","following_url":"https://api.github.com/users/taipingli/following{/other_user}","gists_url":"https://api.github.com/users/taipingli/gists{/gist_id}","starred_url":"https://api.github.com/users/taipingli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taipingli/subscriptions","organizations_url":"https://api.github.com/users/taipingli/orgs","repos_url":"https://api.github.com/users/taipingli/repos","events_url":"https://api.github.com/users/taipingli/events{/privacy}","received_events_url":"https://api.github.com/users/taipingli/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uw-midsun/firmware/pulls/186/commits","review_comments_url":"https://api.github.com/repos/uw-midsun/firmware/pulls/186/comments","review_comment_url":"https://api.github.com/repos/uw-midsun/firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uw-midsun/firmware/issues/186/comments","statuses_url":"https://api.github.com/repos/uw-midsun/firmware/statuses/ee04bca3bc2205fd69974cb55779b1867c9a0722","head":{"label":"uw-midsun:elec_355_finished_charger","ref":"elec_355_finished_charger","sha":"ee04bca3bc2205fd69974cb55779b1867c9a0722","user":{"login":"uw-midsun","id":14828575,"avatar_url":"https://avatars1.githubusercontent.com/u/14828575?v=4","gravatar_id":"","url":"https://api.github.com/users/uw-midsun","html_url":"https://github.com/uw-midsun","followers_url":"https://api.github.com/users/uw-midsun/followers","following_url":"https://api.github.com/users/uw-midsun/following{/other_user}","gists_url":"https://api.github.com/users/uw-midsun/gists{/gist_id}","starred_url":"https://api.github.com/users/uw-midsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uw-midsun/subscriptions","organizations_url":"https://api.github.com/users/uw-midsun/orgs","repos_url":"https://api.github.com/users/uw-midsun/repos","events_url":"https://api.github.com/users/uw-midsun/events{/privacy}","received_events_url":"https://api.github.com/users/uw-midsun/received_events","type":"Organization","site_admin":false},"repo":{"id":69197028,"name":"firmware","full_name":"uw-midsun/firmware","owner":{"login":"uw-midsun","id":14828575,"avatar_url":"https://avatars1.githubusercontent.com/u/14828575?v=4","gravatar_id":"","url":"https://api.github.com/users/uw-midsun","html_url":"https://github.com/uw-midsun","followers_url":"https://api.github.com/users/uw-midsun/followers","following_url":"https://api.github.com/users/uw-midsun/following{/other_user}","gists_url":"https://api.github.com/users/uw-midsun/gists{/gist_id}","starred_url":"https://api.github.com/users/uw-midsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uw-midsun/subscriptions","organizations_url":"https://api.github.com/users/uw-midsun/orgs","repos_url":"https://api.github.com/users/uw-midsun/repos","events_url":"https://api.github.com/users/uw-midsun/events{/privacy}","received_events_url":"https://api.github.com/users/uw-midsun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uw-midsun/firmware","description":"Firmware for MSXII","fork":false,"url":"https://api.github.com/repos/uw-midsun/firmware","forks_url":"https://api.github.com/repos/uw-midsun/firmware/forks","keys_url":"https://api.github.com/repos/uw-midsun/firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uw-midsun/firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uw-midsun/firmware/teams","hooks_url":"https://api.github.com/repos/uw-midsun/firmware/hooks","issue_events_url":"https://api.github.com/repos/uw-midsun/firmware/issues/events{/number}","events_url":"https://api.github.com/repos/uw-midsun/firmware/events","assignees_url":"https://api.github.com/repos/uw-midsun/firmware/assignees{/user}","branches_url":"https://api.github.com/repos/uw-midsun/firmware/branches{/branch}","tags_url":"https://api.github.com/repos/uw-midsun/firmware/tags","blobs_url":"https://api.github.com/repos/uw-midsun/firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uw-midsun/firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uw-midsun/firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/uw-midsun/firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uw-midsun/firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/uw-midsun/firmware/languages","stargazers_url":"https://api.github.com/repos/uw-midsun/firmware/stargazers","contributors_url":"https://api.github.com/repos/uw-midsun/firmware/contributors","subscribers_url":"https://api.github.com/repos/uw-midsun/firmware/subscribers","subscription_url":"https://api.github.com/repos/uw-midsun/firmware/subscription","commits_url":"https://api.github.com/repos/uw-midsun/firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/uw-midsun/firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/uw-midsun/firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/uw-midsun/firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/uw-midsun/firmware/contents/{+path}","compare_url":"https://api.github.com/repos/uw-midsun/firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uw-midsun/firmware/merges","archive_url":"https://api.github.com/repos/uw-midsun/firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uw-midsun/firmware/downloads","issues_url":"https://api.github.com/repos/uw-midsun/firmware/issues{/number}","pulls_url":"https://api.github.com/repos/uw-midsun/firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/uw-midsun/firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/uw-midsun/firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uw-midsun/firmware/labels{/name}","releases_url":"https://api.github.com/repos/uw-midsun/firmware/releases{/id}","deployments_url":"https://api.github.com/repos/uw-midsun/firmware/deployments","created_at":"2016-09-25T23:38:58Z","updated_at":"2018-05-18T06:59:14Z","pushed_at":"2018-05-19T18:35:49Z","git_url":"git://github.com/uw-midsun/firmware.git","ssh_url":"git@github.com:uw-midsun/firmware.git","clone_url":"https://github.com/uw-midsun/firmware.git","svn_url":"https://github.com/uw-midsun/firmware","homepage":"","size":2895,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2,"open_issues":9,"watchers":3,"default_branch":"master"}},"base":{"label":"uw-midsun:master","ref":"master","sha":"73d986b900d7385ca75dfff076af376f7f11e695","user":{"login":"uw-midsun","id":14828575,"avatar_url":"https://avatars1.githubusercontent.com/u/14828575?v=4","gravatar_id":"","url":"https://api.github.com/users/uw-midsun","html_url":"https://github.com/uw-midsun","followers_url":"https://api.github.com/users/uw-midsun/followers","following_url":"https://api.github.com/users/uw-midsun/following{/other_user}","gists_url":"https://api.github.com/users/uw-midsun/gists{/gist_id}","starred_url":"https://api.github.com/users/uw-midsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uw-midsun/subscriptions","organizations_url":"https://api.github.com/users/uw-midsun/orgs","repos_url":"https://api.github.com/users/uw-midsun/repos","events_url":"https://api.github.com/users/uw-midsun/events{/privacy}","received_events_url":"https://api.github.com/users/uw-midsun/received_events","type":"Organization","site_admin":false},"repo":{"id":69197028,"name":"firmware","full_name":"uw-midsun/firmware","owner":{"login":"uw-midsun","id":14828575,"avatar_url":"https://avatars1.githubusercontent.com/u/14828575?v=4","gravatar_id":"","url":"https://api.github.com/users/uw-midsun","html_url":"https://github.com/uw-midsun","followers_url":"https://api.github.com/users/uw-midsun/followers","following_url":"https://api.github.com/users/uw-midsun/following{/other_user}","gists_url":"https://api.github.com/users/uw-midsun/gists{/gist_id}","starred_url":"https://api.github.com/users/uw-midsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uw-midsun/subscriptions","organizations_url":"https://api.github.com/users/uw-midsun/orgs","repos_url":"https://api.github.com/users/uw-midsun/repos","events_url":"https://api.github.com/users/uw-midsun/events{/privacy}","received_events_url":"https://api.github.com/users/uw-midsun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uw-midsun/firmware","description":"Firmware for MSXII","fork":false,"url":"https://api.github.com/repos/uw-midsun/firmware","forks_url":"https://api.github.com/repos/uw-midsun/firmware/forks","keys_url":"https://api.github.com/repos/uw-midsun/firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uw-midsun/firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uw-midsun/firmware/teams","hooks_url":"https://api.github.com/repos/uw-midsun/firmware/hooks","issue_events_url":"https://api.github.com/repos/uw-midsun/firmware/issues/events{/number}","events_url":"https://api.github.com/repos/uw-midsun/firmware/events","assignees_url":"https://api.github.com/repos/uw-midsun/firmware/assignees{/user}","branches_url":"https://api.github.com/repos/uw-midsun/firmware/branches{/branch}","tags_url":"https://api.github.com/repos/uw-midsun/firmware/tags","blobs_url":"https://api.github.com/repos/uw-midsun/firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uw-midsun/firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uw-midsun/firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/uw-midsun/firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uw-midsun/firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/uw-midsun/firmware/languages","stargazers_url":"https://api.github.com/repos/uw-midsun/firmware/stargazers","contributors_url":"https://api.github.com/repos/uw-midsun/firmware/contributors","subscribers_url":"https://api.github.com/repos/uw-midsun/firmware/subscribers","subscription_url":"https://api.github.com/repos/uw-midsun/firmware/subscription","commits_url":"https://api.github.com/repos/uw-midsun/firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/uw-midsun/firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/uw-midsun/firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/uw-midsun/firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/uw-midsun/firmware/contents/{+path}","compare_url":"https://api.github.com/repos/uw-midsun/firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uw-midsun/firmware/merges","archive_url":"https://api.github.com/repos/uw-midsun/firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uw-midsun/firmware/downloads","issues_url":"https://api.github.com/repos/uw-midsun/firmware/issues{/number}","pulls_url":"https://api.github.com/repos/uw-midsun/firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/uw-midsun/firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/uw-midsun/firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uw-midsun/firmware/labels{/name}","releases_url":"https://api.github.com/repos/uw-midsun/firmware/releases{/id}","deployments_url":"https://api.github.com/repos/uw-midsun/firmware/deployments","created_at":"2016-09-25T23:38:58Z","updated_at":"2018-05-18T06:59:14Z","pushed_at":"2018-05-19T18:35:49Z","git_url":"git://github.com/uw-midsun/firmware.git","ssh_url":"git@github.com:uw-midsun/firmware.git","clone_url":"https://github.com/uw-midsun/firmware.git","svn_url":"https://github.com/uw-midsun/firmware","homepage":"","size":2895,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2,"open_issues":9,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/186"},"html":{"href":"https://github.com/uw-midsun/firmware/pull/186"},"issue":{"href":"https://api.github.com/repos/uw-midsun/firmware/issues/186"},"comments":{"href":"https://api.github.com/repos/uw-midsun/firmware/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uw-midsun/firmware/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/uw-midsun/firmware/statuses/ee04bca3bc2205fd69974cb55779b1867c9a0722"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ckitagawa"}}