{"action":"created","comment":{"url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/comments/26452655","id":26452655,"diff_hunk":"@@ -0,0 +1,209 @@\n+#include <stdio.h>\n+#include <string.h>\n+\n+#include <FreeRTOS.h>\n+#include <task.h>\n+#include <queue.h>\n+#include <semphr.h>\n+\n+#include <stdbool.h>\n+#include <util.h>\n+#include <stdio.h>\n+#include <shell.h>\n+\n+char *shell_prompt_text = \"> \";\n+char *shell_banner = \"\\n\\nCommand Shell\";\n+\n+struct shell_state {\n+\t/* +1 for the help command */\n+\tstruct shell_cmd commands[SHELL_MAX_COMMANDS + 1];\n+\tint command_count;\n+\tchar input_buf[32];\n+\tint input_pos;\n+\tbool initialized;\n+\txSemaphoreHandle shell_lock;\n+} shell_state;\n+\n+static bool shell_is_whitespace(char c)\n+{\n+\tswitch(c) {\n+\tcase ' ':\n+\tcase '\\t':\n+\tcase '\\r':\n+\tcase '\\n':\n+\t\treturn true;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\treturn false;\n+}\n+\n+static void shell_exec_cmd(int argc, char **argv)\n+{\n+\tunsigned int cmd_len;\n+\tunsigned int tgt_cmd_len = strlen(argv[0]);\n+\tint i;\n+\tfor (i = 0; i < shell_state.command_count; i++) {\n+\t\tcmd_len = strlen(shell_state.commands[i].command);\n+\n+\t\tif (cmd_len == tgt_cmd_len && shell_state.commands[i].action &&\n+\t\t    strncmp(argv[0], shell_state.commands[i].command, tgt_cmd_len) == 0) {\n+\t\t\tshell_state.commands[i].action(argc, argv);\n+\t\t\tputchar('\\n');\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\tprintf(\"Invalid Command!\\n\");\n+}\n+\n+static void shell_parse_command(void)\n+{\n+\tint i;\n+\tint arg_count = 0;\n+\tchar *arg_list[8] = {NULL};\n+\tbool in_arg = false;\n+\n+\t/* TODO: Fix the bug where I pass everything as args...*/\n+\tfor(i = 0; i < shell_state.input_pos; i++) {\n+\t\tif (shell_is_whitespace(shell_state.input_buf[i]) && arg_count == 0)","path":"libs/shell/shell.c","position":68,"original_position":68,"commit_id":"21774cd0149c396b5637be47e3b2e87912b7614e","original_commit_id":"21774cd0149c396b5637be47e3b2e87912b7614e","user":{"login":"vadimplobanov","id":3520675,"avatar_url":"https://avatars.githubusercontent.com/u/3520675?v=3","gravatar_id":"","url":"https://api.github.com/users/vadimplobanov","html_url":"https://github.com/vadimplobanov","followers_url":"https://api.github.com/users/vadimplobanov/followers","following_url":"https://api.github.com/users/vadimplobanov/following{/other_user}","gists_url":"https://api.github.com/users/vadimplobanov/gists{/gist_id}","starred_url":"https://api.github.com/users/vadimplobanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vadimplobanov/subscriptions","organizations_url":"https://api.github.com/users/vadimplobanov/orgs","repos_url":"https://api.github.com/users/vadimplobanov/repos","events_url":"https://api.github.com/users/vadimplobanov/events{/privacy}","received_events_url":"https://api.github.com/users/vadimplobanov/received_events","type":"User","site_admin":false},"body":"I think this entire conditional is subsumed by the code below, and is superfluous.","created_at":"2015-03-15T21:33:52Z","updated_at":"2015-03-15T21:33:52Z","html_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6#discussion_r26452655","pull_request_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/comments/26452655"},"html":{"href":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6#discussion_r26452655"},"pull_request":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6","id":31190126,"html_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6","diff_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6.diff","patch_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6.patch","issue_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/6","number":6,"state":"open","locked":false,"title":"F0 usart","user":{"login":"Jeff-Ciesielski","id":759677,"avatar_url":"https://avatars.githubusercontent.com/u/759677?v=3","gravatar_id":"","url":"https://api.github.com/users/Jeff-Ciesielski","html_url":"https://github.com/Jeff-Ciesielski","followers_url":"https://api.github.com/users/Jeff-Ciesielski/followers","following_url":"https://api.github.com/users/Jeff-Ciesielski/following{/other_user}","gists_url":"https://api.github.com/users/Jeff-Ciesielski/gists{/gist_id}","starred_url":"https://api.github.com/users/Jeff-Ciesielski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jeff-Ciesielski/subscriptions","organizations_url":"https://api.github.com/users/Jeff-Ciesielski/orgs","repos_url":"https://api.github.com/users/Jeff-Ciesielski/repos","events_url":"https://api.github.com/users/Jeff-Ciesielski/events{/privacy}","received_events_url":"https://api.github.com/users/Jeff-Ciesielski/received_events","type":"User","site_admin":false},"body":"This patch set adds an stm32f0 interrupt driven usart driver, as well as a serial command shell and stm32f0 example","created_at":"2015-03-14T21:07:37Z","updated_at":"2015-03-15T21:33:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0e80449ebc836a876b65db0efe0892f5f0f0188","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6/commits","review_comments_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6/comments","review_comment_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/6/comments","statuses_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/statuses/21774cd0149c396b5637be47e3b2e87912b7614e","head":{"label":"autosportlabs:f0_usart","ref":"f0_usart","sha":"21774cd0149c396b5637be47e3b2e87912b7614e","user":{"login":"autosportlabs","id":1274125,"avatar_url":"https://avatars.githubusercontent.com/u/1274125?v=3","gravatar_id":"","url":"https://api.github.com/users/autosportlabs","html_url":"https://github.com/autosportlabs","followers_url":"https://api.github.com/users/autosportlabs/followers","following_url":"https://api.github.com/users/autosportlabs/following{/other_user}","gists_url":"https://api.github.com/users/autosportlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/autosportlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autosportlabs/subscriptions","organizations_url":"https://api.github.com/users/autosportlabs/orgs","repos_url":"https://api.github.com/users/autosportlabs/repos","events_url":"https://api.github.com/users/autosportlabs/events{/privacy}","received_events_url":"https://api.github.com/users/autosportlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":15401076,"name":"STM32Fx_FreeRTOS_Base","full_name":"autosportlabs/STM32Fx_FreeRTOS_Base","owner":{"login":"autosportlabs","id":1274125,"avatar_url":"https://avatars.githubusercontent.com/u/1274125?v=3","gravatar_id":"","url":"https://api.github.com/users/autosportlabs","html_url":"https://github.com/autosportlabs","followers_url":"https://api.github.com/users/autosportlabs/followers","following_url":"https://api.github.com/users/autosportlabs/following{/other_user}","gists_url":"https://api.github.com/users/autosportlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/autosportlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autosportlabs/subscriptions","organizations_url":"https://api.github.com/users/autosportlabs/orgs","repos_url":"https://api.github.com/users/autosportlabs/repos","events_url":"https://api.github.com/users/autosportlabs/events{/privacy}","received_events_url":"https://api.github.com/users/autosportlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base","description":"FreeRTOS starter project for STM32 F1 and F4 microcontrollers.","fork":false,"url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base","forks_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/forks","keys_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/teams","hooks_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/hooks","issue_events_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/events{/number}","events_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/events","assignees_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/assignees{/user}","branches_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/branches{/branch}","tags_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/tags","blobs_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/refs{/sha}","trees_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/statuses/{sha}","languages_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/languages","stargazers_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/stargazers","contributors_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/contributors","subscribers_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/subscribers","subscription_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/subscription","commits_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/commits{/sha}","git_commits_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/commits{/sha}","comments_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/comments{/number}","issue_comment_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/comments{/number}","contents_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/contents/{+path}","compare_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/merges","archive_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/downloads","issues_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues{/number}","pulls_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls{/number}","milestones_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/milestones{/number}","notifications_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/labels{/name}","releases_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/releases{/id}","created_at":"2013-12-23T17:47:46Z","updated_at":"2015-01-30T05:50:13Z","pushed_at":"2015-03-14T21:06:30Z","git_url":"git://github.com/autosportlabs/STM32Fx_FreeRTOS_Base.git","ssh_url":"git@github.com:autosportlabs/STM32Fx_FreeRTOS_Base.git","clone_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base.git","svn_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base","homepage":null,"size":4228,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"autosportlabs:master","ref":"master","sha":"ee1b46c8d724b2bb4517f54a9d979bc02ed9258e","user":{"login":"autosportlabs","id":1274125,"avatar_url":"https://avatars.githubusercontent.com/u/1274125?v=3","gravatar_id":"","url":"https://api.github.com/users/autosportlabs","html_url":"https://github.com/autosportlabs","followers_url":"https://api.github.com/users/autosportlabs/followers","following_url":"https://api.github.com/users/autosportlabs/following{/other_user}","gists_url":"https://api.github.com/users/autosportlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/autosportlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autosportlabs/subscriptions","organizations_url":"https://api.github.com/users/autosportlabs/orgs","repos_url":"https://api.github.com/users/autosportlabs/repos","events_url":"https://api.github.com/users/autosportlabs/events{/privacy}","received_events_url":"https://api.github.com/users/autosportlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":15401076,"name":"STM32Fx_FreeRTOS_Base","full_name":"autosportlabs/STM32Fx_FreeRTOS_Base","owner":{"login":"autosportlabs","id":1274125,"avatar_url":"https://avatars.githubusercontent.com/u/1274125?v=3","gravatar_id":"","url":"https://api.github.com/users/autosportlabs","html_url":"https://github.com/autosportlabs","followers_url":"https://api.github.com/users/autosportlabs/followers","following_url":"https://api.github.com/users/autosportlabs/following{/other_user}","gists_url":"https://api.github.com/users/autosportlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/autosportlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autosportlabs/subscriptions","organizations_url":"https://api.github.com/users/autosportlabs/orgs","repos_url":"https://api.github.com/users/autosportlabs/repos","events_url":"https://api.github.com/users/autosportlabs/events{/privacy}","received_events_url":"https://api.github.com/users/autosportlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base","description":"FreeRTOS starter project for STM32 F1 and F4 microcontrollers.","fork":false,"url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base","forks_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/forks","keys_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/teams","hooks_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/hooks","issue_events_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/events{/number}","events_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/events","assignees_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/assignees{/user}","branches_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/branches{/branch}","tags_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/tags","blobs_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/refs{/sha}","trees_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/statuses/{sha}","languages_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/languages","stargazers_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/stargazers","contributors_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/contributors","subscribers_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/subscribers","subscription_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/subscription","commits_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/commits{/sha}","git_commits_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/git/commits{/sha}","comments_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/comments{/number}","issue_comment_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/comments{/number}","contents_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/contents/{+path}","compare_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/merges","archive_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/downloads","issues_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues{/number}","pulls_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls{/number}","milestones_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/milestones{/number}","notifications_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/labels{/name}","releases_url":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/releases{/id}","created_at":"2013-12-23T17:47:46Z","updated_at":"2015-01-30T05:50:13Z","pushed_at":"2015-03-14T21:06:30Z","git_url":"git://github.com/autosportlabs/STM32Fx_FreeRTOS_Base.git","ssh_url":"git@github.com:autosportlabs/STM32Fx_FreeRTOS_Base.git","clone_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base.git","svn_url":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base","homepage":null,"size":4228,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6"},"html":{"href":"https://github.com/autosportlabs/STM32Fx_FreeRTOS_Base/pull/6"},"issue":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/6"},"comments":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/autosportlabs/STM32Fx_FreeRTOS_Base/statuses/21774cd0149c396b5637be47e3b2e87912b7614e"}}}}