575 lines
30 KiB
C
575 lines
30 KiB
C
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
|
||
|
|
<meta charset='utf-8'>
|
||
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
|
<title>avr_demo/blog/simple_usart/main.c at master · tuupola/avr_demo · GitHub</title>
|
||
|
|
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
|
||
|
|
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
|
||
|
|
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
|
||
|
|
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
|
||
|
|
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
|
||
|
|
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
|
||
|
|
<link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
|
||
|
|
<meta property="og:image" content="https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png">
|
||
|
|
<meta name="hostname" content="github-fe116-cp1-prd.iad.github.net">
|
||
|
|
<meta name="ruby" content="ruby 1.9.3p194-tcs-github-tcmalloc (e1c0c3f392) [x86_64-linux]">
|
||
|
|
<link rel="assets" href="https://github.global.ssl.fastly.net/">
|
||
|
|
<link rel="conduit-xhr" href="https://ghconduit.com:25035/">
|
||
|
|
<link rel="xhr-socket" href="/_sockets" />
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<meta name="msapplication-TileImage" content="/windows-tile.png" />
|
||
|
|
<meta name="msapplication-TileColor" content="#ffffff" />
|
||
|
|
<meta name="selected-link" value="repo_source" data-pjax-transient />
|
||
|
|
<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="collector-cdn.github.com" name="octolytics-script-host" /><meta content="github" name="octolytics-app-id" /><meta content="5DCD7E6C:7CEB:22CB74C:52966235" name="octolytics-dimension-request_id" />
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||
|
|
|
||
|
|
<meta content="authenticity_token" name="csrf-param" />
|
||
|
|
<meta content="Z8WK15cndJeh5aTcDDIvn6UiDOGNuwPyju5r/ApIIHY=" name="csrf-token" />
|
||
|
|
|
||
|
|
<link href="https://github.global.ssl.fastly.net/assets/github-9a2db5f210ccf9921691f9c282c4d7795ddc350d.css" media="all" rel="stylesheet" type="text/css" />
|
||
|
|
<link href="https://github.global.ssl.fastly.net/assets/github2-0d13991e20a336d82fda83764454db508e9cf1c1.css" media="all" rel="stylesheet" type="text/css" />
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<script src="https://github.global.ssl.fastly.net/assets/frameworks-f78f9db32da9343ba16e477c7b54aa5b971fecbd.js" type="text/javascript"></script>
|
||
|
|
<script src="https://github.global.ssl.fastly.net/assets/github-0027dfa2fe63e83319cafa77f57322ac81018255.js" type="text/javascript"></script>
|
||
|
|
|
||
|
|
<meta http-equiv="x-pjax-version" content="42930c09ba2e0c643dddee85e1d7d5dd">
|
||
|
|
|
||
|
|
<link data-pjax-transient rel='permalink' href='/tuupola/avr_demo/blob/93ac6d434f8ed33c1d98bdc70bb3f8dfece1e127/blog/simple_usart/main.c'>
|
||
|
|
<meta property="og:title" content="avr_demo"/>
|
||
|
|
<meta property="og:type" content="githubog:gitrepository"/>
|
||
|
|
<meta property="og:url" content="https://github.com/tuupola/avr_demo"/>
|
||
|
|
<meta property="og:image" content="https://github.global.ssl.fastly.net/images/gravatars/gravatar-user-420.png"/>
|
||
|
|
<meta property="og:site_name" content="GitHub"/>
|
||
|
|
<meta property="og:description" content="avr_demo - Atmel demo code. Does not use any Arduino libraries. I want to learn this the hard way (tm)."/>
|
||
|
|
|
||
|
|
<meta name="description" content="avr_demo - Atmel demo code. Does not use any Arduino libraries. I want to learn this the hard way (tm)." />
|
||
|
|
|
||
|
|
<meta content="21913" name="octolytics-dimension-user_id" /><meta content="tuupola" name="octolytics-dimension-user_login" /><meta content="448248" name="octolytics-dimension-repository_id" /><meta content="tuupola/avr_demo" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="448248" name="octolytics-dimension-repository_network_root_id" /><meta content="tuupola/avr_demo" name="octolytics-dimension-repository_network_root_nwo" />
|
||
|
|
<link href="https://github.com/tuupola/avr_demo/commits/master.atom" rel="alternate" title="Recent Commits to avr_demo:master" type="application/atom+xml" />
|
||
|
|
|
||
|
|
</head>
|
||
|
|
|
||
|
|
|
||
|
|
<body class="logged_out env-production linux vis-public page-blob">
|
||
|
|
<div class="wrapper">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="header header-logged-out">
|
||
|
|
<div class="container clearfix">
|
||
|
|
|
||
|
|
<a class="header-logo-wordmark" href="https://github.com/">
|
||
|
|
<span class="mega-octicon octicon-logo-github"></span>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<div class="header-actions">
|
||
|
|
<a class="button primary" href="/join">Sign up</a>
|
||
|
|
<a class="button signin" href="/login?return_to=%2Ftuupola%2Favr_demo%2Fblob%2Fmaster%2Fblog%2Fsimple_usart%2Fmain.c">Sign in</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="command-bar js-command-bar in-repository">
|
||
|
|
|
||
|
|
<ul class="top-nav">
|
||
|
|
<li class="explore"><a href="/explore">Explore</a></li>
|
||
|
|
<li class="features"><a href="/features">Features</a></li>
|
||
|
|
<li class="enterprise"><a href="https://enterprise.github.com/">Enterprise</a></li>
|
||
|
|
<li class="blog"><a href="/blog">Blog</a></li>
|
||
|
|
</ul>
|
||
|
|
<form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
|
||
|
|
|
||
|
|
<input type="text" data-hotkey=" s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
|
||
|
|
|
||
|
|
|
||
|
|
data-repo="tuupola/avr_demo"
|
||
|
|
data-branch="master"
|
||
|
|
data-sha="74470625850bce7c16349869721ce21bee4d5b01"
|
||
|
|
>
|
||
|
|
|
||
|
|
<input type="hidden" name="nwo" value="tuupola/avr_demo" />
|
||
|
|
|
||
|
|
<div class="select-menu js-menu-container js-select-menu search-context-select-menu">
|
||
|
|
<span class="minibutton select-menu-button js-menu-target">
|
||
|
|
<span class="js-select-button">This repository</span>
|
||
|
|
</span>
|
||
|
|
|
||
|
|
<div class="select-menu-modal-holder js-menu-content js-navigation-container">
|
||
|
|
<div class="select-menu-modal">
|
||
|
|
|
||
|
|
<div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
|
||
|
|
<span class="select-menu-item-icon octicon octicon-check"></span>
|
||
|
|
<input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
|
||
|
|
<div class="select-menu-item-text js-select-button-text">This repository</div>
|
||
|
|
</div> <!-- /.select-menu-item -->
|
||
|
|
|
||
|
|
<div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
|
||
|
|
<span class="select-menu-item-icon octicon octicon-check"></span>
|
||
|
|
<input type="radio" name="search_target" value="global" />
|
||
|
|
<div class="select-menu-item-text js-select-button-text">All repositories</div>
|
||
|
|
</div> <!-- /.select-menu-item -->
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<span class="octicon help tooltipped downwards" title="Show command bar help">
|
||
|
|
<span class="octicon octicon-question"></span>
|
||
|
|
</span>
|
||
|
|
|
||
|
|
|
||
|
|
<input type="hidden" name="ref" value="cmdform">
|
||
|
|
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="site" itemscope itemtype="http://schema.org/WebPage">
|
||
|
|
|
||
|
|
<div class="pagehead repohead instapaper_ignore readability-menu">
|
||
|
|
<div class="container">
|
||
|
|
|
||
|
|
|
||
|
|
<ul class="pagehead-actions">
|
||
|
|
|
||
|
|
|
||
|
|
<li>
|
||
|
|
<a href="/login?return_to=%2Ftuupola%2Favr_demo"
|
||
|
|
class="minibutton with-count js-toggler-target star-button tooltipped upwards"
|
||
|
|
title="You must be signed in to use this feature" rel="nofollow">
|
||
|
|
<span class="octicon octicon-star"></span>Star
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<a class="social-count js-social-count" href="/tuupola/avr_demo/stargazers">
|
||
|
|
8
|
||
|
|
</a>
|
||
|
|
|
||
|
|
</li>
|
||
|
|
|
||
|
|
<li>
|
||
|
|
<a href="/login?return_to=%2Ftuupola%2Favr_demo"
|
||
|
|
class="minibutton with-count js-toggler-target fork-button tooltipped upwards"
|
||
|
|
title="You must be signed in to fork a repository" rel="nofollow">
|
||
|
|
<span class="octicon octicon-git-branch"></span>Fork
|
||
|
|
</a>
|
||
|
|
<a href="/tuupola/avr_demo/network" class="social-count">
|
||
|
|
8
|
||
|
|
</a>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
<h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
|
||
|
|
<span class="repo-label"><span>public</span></span>
|
||
|
|
<span class="mega-octicon octicon-repo"></span>
|
||
|
|
<span class="author">
|
||
|
|
<a href="/tuupola" class="url fn" itemprop="url" rel="author"><span itemprop="title">tuupola</span></a>
|
||
|
|
</span>
|
||
|
|
<span class="repohead-name-divider">/</span>
|
||
|
|
<strong><a href="/tuupola/avr_demo" class="js-current-repository js-repo-home-link">avr_demo</a></strong>
|
||
|
|
|
||
|
|
<span class="page-context-loader">
|
||
|
|
<img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</span>
|
||
|
|
|
||
|
|
</h1>
|
||
|
|
</div><!-- /.container -->
|
||
|
|
</div><!-- /.repohead -->
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="container">
|
||
|
|
|
||
|
|
<div class="repository-with-sidebar repo-container ">
|
||
|
|
|
||
|
|
<div class="repository-sidebar">
|
||
|
|
|
||
|
|
|
||
|
|
<div class="sunken-menu vertical-right repo-nav js-repo-nav js-repository-container-pjax js-octicon-loaders">
|
||
|
|
<div class="sunken-menu-contents">
|
||
|
|
<ul class="sunken-menu-group">
|
||
|
|
<li class="tooltipped leftwards" title="Code">
|
||
|
|
<a href="/tuupola/avr_demo" aria-label="Code" class="selected js-selected-navigation-item sunken-menu-item" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /tuupola/avr_demo">
|
||
|
|
<span class="octicon octicon-code"></span> <span class="full-word">Code</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
|
||
|
|
<li class="tooltipped leftwards" title="Issues">
|
||
|
|
<a href="/tuupola/avr_demo/issues" aria-label="Issues" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /tuupola/avr_demo/issues">
|
||
|
|
<span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
|
||
|
|
<span class='counter'>0</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
|
||
|
|
<li class="tooltipped leftwards" title="Pull Requests"><a href="/tuupola/avr_demo/pulls" aria-label="Pull Requests" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /tuupola/avr_demo/pulls">
|
||
|
|
<span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
|
||
|
|
<span class='counter'>0</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
|
||
|
|
|
||
|
|
</ul>
|
||
|
|
<div class="sunken-menu-separator"></div>
|
||
|
|
<ul class="sunken-menu-group">
|
||
|
|
|
||
|
|
<li class="tooltipped leftwards" title="Pulse">
|
||
|
|
<a href="/tuupola/avr_demo/pulse" aria-label="Pulse" class="js-selected-navigation-item sunken-menu-item" data-pjax="true" data-selected-links="pulse /tuupola/avr_demo/pulse">
|
||
|
|
<span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
|
||
|
|
<li class="tooltipped leftwards" title="Graphs">
|
||
|
|
<a href="/tuupola/avr_demo/graphs" aria-label="Graphs" class="js-selected-navigation-item sunken-menu-item" data-pjax="true" data-selected-links="repo_graphs repo_contributors /tuupola/avr_demo/graphs">
|
||
|
|
<span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
|
||
|
|
<li class="tooltipped leftwards" title="Network">
|
||
|
|
<a href="/tuupola/avr_demo/network" aria-label="Network" class="js-selected-navigation-item sunken-menu-item js-disable-pjax" data-selected-links="repo_network /tuupola/avr_demo/network">
|
||
|
|
<span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
|
||
|
|
<img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
|
||
|
|
</a> </li>
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="only-with-full-nav">
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="clone-url open"
|
||
|
|
data-protocol-type="http"
|
||
|
|
data-url="/users/set_protocol?protocol_selector=http&protocol_type=clone">
|
||
|
|
<h3><strong>HTTPS</strong> clone URL</h3>
|
||
|
|
<div class="clone-url-box">
|
||
|
|
<input type="text" class="clone js-url-field"
|
||
|
|
value="https://github.com/tuupola/avr_demo.git" readonly="readonly">
|
||
|
|
|
||
|
|
<span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/tuupola/avr_demo.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="clone-url "
|
||
|
|
data-protocol-type="subversion"
|
||
|
|
data-url="/users/set_protocol?protocol_selector=subversion&protocol_type=clone">
|
||
|
|
<h3><strong>Subversion</strong> checkout URL</h3>
|
||
|
|
<div class="clone-url-box">
|
||
|
|
<input type="text" class="clone js-url-field"
|
||
|
|
value="https://github.com/tuupola/avr_demo" readonly="readonly">
|
||
|
|
|
||
|
|
<span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/tuupola/avr_demo" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
<p class="clone-options">You can clone with
|
||
|
|
<a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
|
||
|
|
or <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>.
|
||
|
|
<span class="octicon help tooltipped upwards" title="Get help on which URL is right for you.">
|
||
|
|
<a href="https://help.github.com/articles/which-remote-url-should-i-use">
|
||
|
|
<span class="octicon octicon-question"></span>
|
||
|
|
</a>
|
||
|
|
</span>
|
||
|
|
</p>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<a href="/tuupola/avr_demo/archive/master.zip"
|
||
|
|
class="minibutton sidebar-button"
|
||
|
|
title="Download this repository as a zip file"
|
||
|
|
rel="nofollow">
|
||
|
|
<span class="octicon octicon-cloud-download"></span>
|
||
|
|
Download ZIP
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</div><!-- /.repository-sidebar -->
|
||
|
|
|
||
|
|
<div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<!-- blob contrib key: blob_contributors:v21:eb093eae0646134b647629d4b8312b4d -->
|
||
|
|
|
||
|
|
<p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
|
||
|
|
|
||
|
|
<a href="/tuupola/avr_demo/find/master" data-pjax data-hotkey="t" class="js-show-file-finder" style="display:none">Show File Finder</a>
|
||
|
|
|
||
|
|
<div class="file-navigation">
|
||
|
|
|
||
|
|
|
||
|
|
<div class="select-menu js-menu-container js-select-menu" >
|
||
|
|
<span class="minibutton select-menu-button js-menu-target" data-hotkey="w"
|
||
|
|
data-master-branch="master"
|
||
|
|
data-ref="master"
|
||
|
|
role="button" aria-label="Switch branches or tags" tabindex="0">
|
||
|
|
<span class="octicon octicon-git-branch"></span>
|
||
|
|
<i>branch:</i>
|
||
|
|
<span class="js-select-button">master</span>
|
||
|
|
</span>
|
||
|
|
|
||
|
|
<div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>
|
||
|
|
|
||
|
|
<div class="select-menu-modal">
|
||
|
|
<div class="select-menu-header">
|
||
|
|
<span class="select-menu-title">Switch branches/tags</span>
|
||
|
|
<span class="octicon octicon-remove-close js-menu-close"></span>
|
||
|
|
</div> <!-- /.select-menu-header -->
|
||
|
|
|
||
|
|
<div class="select-menu-filters">
|
||
|
|
<div class="select-menu-text-filter">
|
||
|
|
<input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
|
||
|
|
</div>
|
||
|
|
<div class="select-menu-tabs">
|
||
|
|
<ul>
|
||
|
|
<li class="select-menu-tab">
|
||
|
|
<a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
|
||
|
|
</li>
|
||
|
|
<li class="select-menu-tab">
|
||
|
|
<a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
</div><!-- /.select-menu-tabs -->
|
||
|
|
</div><!-- /.select-menu-filters -->
|
||
|
|
|
||
|
|
<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
|
||
|
|
|
||
|
|
<div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
|
||
|
|
|
||
|
|
|
||
|
|
<div class="select-menu-item js-navigation-item selected">
|
||
|
|
<span class="select-menu-item-icon octicon octicon-check"></span>
|
||
|
|
<a href="/tuupola/avr_demo/blob/master/blog/simple_usart/main.c"
|
||
|
|
data-name="master"
|
||
|
|
data-skip-pjax="true"
|
||
|
|
rel="nofollow"
|
||
|
|
class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
|
||
|
|
title="master">master</a>
|
||
|
|
</div> <!-- /.select-menu-item -->
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="select-menu-no-results">Nothing to show</div>
|
||
|
|
</div> <!-- /.select-menu-list -->
|
||
|
|
|
||
|
|
<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
|
||
|
|
<div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
|
||
|
|
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="select-menu-no-results">Nothing to show</div>
|
||
|
|
</div> <!-- /.select-menu-list -->
|
||
|
|
|
||
|
|
</div> <!-- /.select-menu-modal -->
|
||
|
|
</div> <!-- /.select-menu-modal-holder -->
|
||
|
|
</div> <!-- /.select-menu -->
|
||
|
|
|
||
|
|
<div class="breadcrumb">
|
||
|
|
<span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/tuupola/avr_demo" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">avr_demo</span></a></span></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/tuupola/avr_demo/tree/master/blog" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">blog</span></a></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/tuupola/avr_demo/tree/master/blog/simple_usart" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">simple_usart</span></a></span><span class="separator"> / </span><strong class="final-path">main.c</strong> <span class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="blog/simple_usart/main.c" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div class="commit file-history-tease">
|
||
|
|
<img class="main-avatar" height="24" src="https://2.gravatar.com/avatar/5335e4549262930d6a6b804c1a602b93?d=https%3A%2F%2Fidenticons.github.com%2Fcacfd29f3d3396d54a6257286e2138e1.png&r=x&s=140" width="24" />
|
||
|
|
<span class="author"><a href="/tuupola" rel="author">tuupola</a></span>
|
||
|
|
<time class="js-relative-date" datetime="2011-11-19T09:48:56-08:00" title="2011-11-19 09:48:56">November 19, 2011</time>
|
||
|
|
<div class="commit-title">
|
||
|
|
<a href="/tuupola/avr_demo/commit/e270477397b5c008aba7edc4f44ec1f8c404ddc1" class="message" data-pjax="true" title="Example code for Simple Serial Communications With AVR Libc blog entry.">Example code for Simple Serial Communications With AVR Libc blog entry.</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="participation">
|
||
|
|
<p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>1</strong> contributor</a></p>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
<div id="blob_contributors_box" style="display:none">
|
||
|
|
<h2 class="facebox-header">Users who have contributed to this file</h2>
|
||
|
|
<ul class="facebox-user-list">
|
||
|
|
<li class="facebox-user-list-item">
|
||
|
|
<img height="24" src="https://2.gravatar.com/avatar/5335e4549262930d6a6b804c1a602b93?d=https%3A%2F%2Fidenticons.github.com%2Fcacfd29f3d3396d54a6257286e2138e1.png&r=x&s=140" width="24" />
|
||
|
|
<a href="/tuupola">tuupola</a>
|
||
|
|
</li>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="files" class="bubble">
|
||
|
|
<div class="file">
|
||
|
|
<div class="meta">
|
||
|
|
<div class="info">
|
||
|
|
<span class="icon"><b class="octicon octicon-file-text"></b></span>
|
||
|
|
<span class="mode" title="File Mode">file</span>
|
||
|
|
<span>37 lines (29 sloc)</span>
|
||
|
|
<span>0.707 kb</span>
|
||
|
|
</div>
|
||
|
|
<div class="actions">
|
||
|
|
<div class="button-group">
|
||
|
|
<a class="minibutton disabled tooltipped leftwards" href="#"
|
||
|
|
title="You must be signed in to make or propose changes">Edit</a>
|
||
|
|
<a href="/tuupola/avr_demo/raw/master/blog/simple_usart/main.c" class="button minibutton " id="raw-url">Raw</a>
|
||
|
|
<a href="/tuupola/avr_demo/blame/master/blog/simple_usart/main.c" class="button minibutton ">Blame</a>
|
||
|
|
<a href="/tuupola/avr_demo/commits/master/blog/simple_usart/main.c" class="button minibutton " rel="nofollow">History</a>
|
||
|
|
</div><!-- /.button-group -->
|
||
|
|
<a class="minibutton danger disabled empty-icon tooltipped leftwards" href="#"
|
||
|
|
title="You must be signed in and on a branch to make or propose changes">
|
||
|
|
Delete
|
||
|
|
</a>
|
||
|
|
</div><!-- /.actions -->
|
||
|
|
|
||
|
|
</div>
|
||
|
|
<div class="blob-wrapper data type-c js-blob-data">
|
||
|
|
<table class="file-code file-diff">
|
||
|
|
<tr class="file-code-line">
|
||
|
|
<td class="blob-line-nums">
|
||
|
|
<span id="L1" rel="#L1">1</span>
|
||
|
|
<span id="L2" rel="#L2">2</span>
|
||
|
|
<span id="L3" rel="#L3">3</span>
|
||
|
|
<span id="L4" rel="#L4">4</span>
|
||
|
|
<span id="L5" rel="#L5">5</span>
|
||
|
|
<span id="L6" rel="#L6">6</span>
|
||
|
|
<span id="L7" rel="#L7">7</span>
|
||
|
|
<span id="L8" rel="#L8">8</span>
|
||
|
|
<span id="L9" rel="#L9">9</span>
|
||
|
|
<span id="L10" rel="#L10">10</span>
|
||
|
|
<span id="L11" rel="#L11">11</span>
|
||
|
|
<span id="L12" rel="#L12">12</span>
|
||
|
|
<span id="L13" rel="#L13">13</span>
|
||
|
|
<span id="L14" rel="#L14">14</span>
|
||
|
|
<span id="L15" rel="#L15">15</span>
|
||
|
|
<span id="L16" rel="#L16">16</span>
|
||
|
|
<span id="L17" rel="#L17">17</span>
|
||
|
|
<span id="L18" rel="#L18">18</span>
|
||
|
|
<span id="L19" rel="#L19">19</span>
|
||
|
|
<span id="L20" rel="#L20">20</span>
|
||
|
|
<span id="L21" rel="#L21">21</span>
|
||
|
|
<span id="L22" rel="#L22">22</span>
|
||
|
|
<span id="L23" rel="#L23">23</span>
|
||
|
|
<span id="L24" rel="#L24">24</span>
|
||
|
|
<span id="L25" rel="#L25">25</span>
|
||
|
|
<span id="L26" rel="#L26">26</span>
|
||
|
|
<span id="L27" rel="#L27">27</span>
|
||
|
|
<span id="L28" rel="#L28">28</span>
|
||
|
|
<span id="L29" rel="#L29">29</span>
|
||
|
|
<span id="L30" rel="#L30">30</span>
|
||
|
|
<span id="L31" rel="#L31">31</span>
|
||
|
|
<span id="L32" rel="#L32">32</span>
|
||
|
|
<span id="L33" rel="#L33">33</span>
|
||
|
|
<span id="L34" rel="#L34">34</span>
|
||
|
|
<span id="L35" rel="#L35">35</span>
|
||
|
|
<span id="L36" rel="#L36">36</span>
|
||
|
|
|
||
|
|
</td>
|
||
|
|
<td class="blob-line-code">
|
||
|
|
<div class="highlight"><pre><div class='line' id='LC1'><span class="cm">/*</span></div><div class='line' id='LC2'><span class="cm"> * Demonstration on how to redirect stdio to UART. </span></div><div class='line' id='LC3'><span class="cm"> *</span></div><div class='line' id='LC4'><span class="cm"> * http://appelsiini.net/2011/simple-usart-with-avr-libc</span></div><div class='line' id='LC5'><span class="cm"> *</span></div><div class='line' id='LC6'><span class="cm"> * To compile and upload run: make clean; make; make program;</span></div><div class='line' id='LC7'><span class="cm"> * Connect to serial with: screen /dev/tty.usbserial-*</span></div><div class='line' id='LC8'><span class="cm"> *</span></div><div class='line' id='LC9'><span class="cm"> * Copyright 2011 Mika Tuupola</span></div><div class='line' id='LC10'><span class="cm"> *</span></div><div class='line' id='LC11'><span class="cm"> * Licensed under the MIT license:</span></div><div class='line' id='LC12'><span class="cm"> * http://www.opensource.org/licenses/mit-license.php</span></div><div class='line' id='LC13'><span class="cm"> *</span></div><div class='line' id='LC14'><span class="cm"> */</span></div><div class='line' id='LC15'> </div><div class='line' id='LC16'><span class="cp">#include <stdio.h></span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="cp">#include "main.h"</span></div><div class='line' id='LC19'><span class="cp">#include "uart.h"</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'><span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span> </div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'> <span class="n">uart_init</span><span class="p">();</span></div><div class='line' id='LC24'> <span class="n">stdout</span> <span class="o">=</span> <span class="o">&</span><span class="n">uart_output</span><span class="p">;</span></div><div class='line' id='LC25'> <span class="n">stdin</span> <span class="o">=</span> <span class="o">&</span><span class="n">uart_input</span><span class="p">;</span></div><div class='line' id='LC26'> </div><div class='line' id='LC27'> <span class="kt">char</span> <span class="n">input</span><span class="p">;</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'> <span class="k">while</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC30'> <span class="n">puts</span><span class="p">(</span><span class="s">"Hello world!"</span><span class="p">);</span></div><div class='line' id='LC31'> <span class="n">input</span> <span class="o">=</span> <span class="n">getchar</span><span class="p">();</span></div><div class='line' id='LC32'> <span class="n">printf</span><span class="p">(</span><span class="s">"You wrote %c</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">input</span><span class="p">);</span> </div><div class='line' id='LC33'> <span class="p">}</span></div><div class='line' id='LC34'> </div><div class='line' id='LC35'> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC36'><span class="p">}</span></div></pre></div>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
|
||
|
|
<div id="jump-to-line" style="display:none">
|
||
|
|
<form accept-charset="UTF-8" class="js-jump-to-line-form">
|
||
|
|
<input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line…" autofocus>
|
||
|
|
<button type="submit" class="button">Go</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div><!-- /.repo-container -->
|
||
|
|
<div class="modal-backdrop"></div>
|
||
|
|
</div><!-- /.container -->
|
||
|
|
</div><!-- /.site -->
|
||
|
|
|
||
|
|
|
||
|
|
</div><!-- /.wrapper -->
|
||
|
|
|
||
|
|
<div class="container">
|
||
|
|
<div class="site-footer">
|
||
|
|
<ul class="site-footer-links right">
|
||
|
|
<li><a href="https://status.github.com/">Status</a></li>
|
||
|
|
<li><a href="http://developer.github.com">API</a></li>
|
||
|
|
<li><a href="http://training.github.com">Training</a></li>
|
||
|
|
<li><a href="http://shop.github.com">Shop</a></li>
|
||
|
|
<li><a href="/blog">Blog</a></li>
|
||
|
|
<li><a href="/about">About</a></li>
|
||
|
|
|
||
|
|
</ul>
|
||
|
|
|
||
|
|
<a href="/">
|
||
|
|
<span class="mega-octicon octicon-mark-github"></span>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<ul class="site-footer-links">
|
||
|
|
<li>© 2013 <span title="0.02682s from github-fe116-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
|
||
|
|
<li><a href="/site/terms">Terms</a></li>
|
||
|
|
<li><a href="/site/privacy">Privacy</a></li>
|
||
|
|
<li><a href="/security">Security</a></li>
|
||
|
|
<li><a href="/contact">Contact</a></li>
|
||
|
|
</ul>
|
||
|
|
</div><!-- /.site-footer -->
|
||
|
|
</div><!-- /.container -->
|
||
|
|
|
||
|
|
|
||
|
|
<div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
|
||
|
|
<div class="fullscreen-container js-fullscreen-container">
|
||
|
|
<div class="textarea-wrap">
|
||
|
|
<textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
|
||
|
|
<div class="suggester-container">
|
||
|
|
<div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
|
||
|
|
data-url="/tuupola/avr_demo/suggestions/commit">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="fullscreen-sidebar">
|
||
|
|
<a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
|
||
|
|
<span class="mega-octicon octicon-screen-normal"></span>
|
||
|
|
</a>
|
||
|
|
<a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
|
||
|
|
title="Switch themes">
|
||
|
|
<span class="octicon octicon-color-mode"></span>
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<div id="ajax-error-message" class="flash flash-error">
|
||
|
|
<span class="octicon octicon-alert"></span>
|
||
|
|
<a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
|
||
|
|
Something went wrong with that request. Please try again.
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
</html>
|
||
|
|
|