mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
239 lines
33 KiB
HTML
239 lines
33 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.3.1"/>
|
|
<title>USB Host Shield 2.0: hidboot.cpp Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<link href="imageStyle.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">USB Host Shield 2.0
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.3.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
<li><a href="globals.html"><span>File Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Pages</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_e5fbe6d2783ccd4c93c7856d92d7be6e.html">GitHub</a></li><li class="navelem"><a class="el" href="dir_397a095372f04465e811d0ee219bbf8f.html">USB_Host_Shield_2.0</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">hidboot.cpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="hidboot_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.</span></div>
|
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">This software may be distributed and modified under the terms of the GNU</span></div>
|
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">General Public License version 2 (GPL2) as published by the Free Software</span></div>
|
|
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">Foundation and appearing in the file GPL2.TXT included in the packaging of</span></div>
|
|
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">this file. Please note that GPL2 Section 2[b] requires that all works based</span></div>
|
|
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">on this software must also be made publicly available under the terms of</span></div>
|
|
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">the GPL2 ("Copyleft").</span></div>
|
|
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">Contact information</span></div>
|
|
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">-------------------</span></div>
|
|
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">Circuits At Home, LTD</span></div>
|
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">Web : http://www.circuitsathome.com</span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">e-mail : support@circuitsathome.com</span></div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include "<a class="code" href="hidboot_8h.html">hidboot.h</a>"</span></div>
|
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div>
|
|
<div class="line"><a name="l00019"></a><span class="lineno"><a class="code" href="class_mouse_report_parser.html#a2dd4e0add7c902300de5e7250c6d6110"> 19</a></span> <span class="keywordtype">void</span> <a class="code" href="class_mouse_report_parser.html#a2dd4e0add7c902300de5e7250c6d6110">MouseReportParser::Parse</a>(<a class="code" href="class_h_i_d.html">HID</a> *hid, <span class="keywordtype">bool</span> is_rpt_id, uint8_t len, uint8_t *buf) {</div>
|
|
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <a class="code" href="struct_m_o_u_s_e_i_n_f_o.html">MOUSEINFO</a> *pmi = (<a class="code" href="struct_m_o_u_s_e_i_n_f_o.html">MOUSEINFO</a>*)buf;</div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmLeftButton == 0 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a848ceb3b38f0dc9e09a83612c1fa89ff">bmLeftButton</a> == 1)</div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <a class="code" href="class_mouse_report_parser.html#accfab93f9a2ba8fa0998437dcca44086">OnLeftButtonDown</a>(pmi);</div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmLeftButton == 1 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a848ceb3b38f0dc9e09a83612c1fa89ff">bmLeftButton</a> == 0)</div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <a class="code" href="class_mouse_report_parser.html#a6e640919bf67e70c66f1dcbee5798e45">OnLeftButtonUp</a>(pmi);</div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmRightButton == 0 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a07f604e1dffc0a72fa28e94a5094ebbe">bmRightButton</a> == 1)</div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <a class="code" href="class_mouse_report_parser.html#a6884349e6b2de0cbfedf3e1a77c23870">OnRightButtonDown</a>(pmi);</div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div>
|
|
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmRightButton == 1 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a07f604e1dffc0a72fa28e94a5094ebbe">bmRightButton</a> == 0)</div>
|
|
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <a class="code" href="class_mouse_report_parser.html#a1bdfee565073cd8b77cbeb9e184c174f">OnRightButtonUp</a>(pmi);</div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmMiddleButton == 0 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a7fb48a7cb68cfc8db2bb8838694c0b51">bmMiddleButton</a> == 1)</div>
|
|
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <a class="code" href="class_mouse_report_parser.html#ad1c06ea106608bd3dcb5c90ecc487ac9">OnMiddleButtonDown</a>(pmi);</div>
|
|
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div>
|
|
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.bmMiddleButton == 1 && pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a7fb48a7cb68cfc8db2bb8838694c0b51">bmMiddleButton</a> == 0)</div>
|
|
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="code" href="class_mouse_report_parser.html#a7512c9a85581aa4be52a780d7c91f655">OnMiddleButtonUp</a>(pmi);</div>
|
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div>
|
|
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">if</span> (prevState.mouseInfo.dX != pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#a8b67db1c54e5db9782a0b5b707dcf9db">dX</a> || prevState.mouseInfo.dY != pmi-><a class="code" href="struct_m_o_u_s_e_i_n_f_o.html#ae7192500776548f5c6868cc37eaaabb2">dY</a>)</div>
|
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <a class="code" href="class_mouse_report_parser.html#a3e231baff6196df63dbad9a44f4945a7">OnMouseMove</a>(pmi);</div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">if</span> (len > <span class="keyword">sizeof</span> (<a class="code" href="struct_m_o_u_s_e_i_n_f_o.html">MOUSEINFO</a>))</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i<<span class="keyword">sizeof</span> (<a class="code" href="struct_m_o_u_s_e_i_n_f_o.html">MOUSEINFO</a>); i++)</div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  prevState.bInfo[i] = buf[i];</div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> };</div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"><a class="code" href="class_keyboard_report_parser.html#a60d8d4d4d187ce5c0e0d69aee7cc772f"> 48</a></span> <span class="keywordtype">void</span> <a class="code" href="class_keyboard_report_parser.html#a60d8d4d4d187ce5c0e0d69aee7cc772f">KeyboardReportParser::Parse</a>(<a class="code" href="class_h_i_d.html">HID</a> *hid, <span class="keywordtype">bool</span> is_rpt_id, uint8_t len, uint8_t *buf) {</div>
|
|
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="comment">// On error - return</span></div>
|
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">if</span> (buf[2] == 1)</div>
|
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">return</span>;</div>
|
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div>
|
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">//KBDINFO *pki = (KBDINFO*)buf;</span></div>
|
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div>
|
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keywordflow">for</span> (uint8_t i = 2; i < 8; i++) {</div>
|
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">bool</span> down = <span class="keyword">false</span>;</div>
|
|
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">bool</span> up = <span class="keyword">false</span>;</div>
|
|
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">for</span> (uint8_t j = 2; j < 8; j++) {</div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">if</span> (buf[i] == <a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[j] && buf[i] != 1)</div>
|
|
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  down = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">if</span> (buf[j] == <a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[i] && <a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[i] != 1)</div>
|
|
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  up = <span class="keyword">true</span>;</div>
|
|
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div>
|
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">if</span> (!down) {</div>
|
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="class_keyboard_report_parser.html#a486df60a3d29f73e9052d3efb0c38de6">HandleLockingKeys</a>(hid, buf[i]);</div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="class_keyboard_report_parser.html#af855e596bbbb9755535f6e69f4ca2305">OnKeyDown</a>(*buf, buf[i]);</div>
|
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  }</div>
|
|
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">if</span> (!up)</div>
|
|
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <a class="code" href="class_keyboard_report_parser.html#a57710d31e5379db14779f960f5c714b2">OnKeyUp</a>(<a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[0], <a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[i]);</div>
|
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  }</div>
|
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i < 8; i++)</div>
|
|
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <a class="code" href="class_keyboard_report_parser.html#aea2971182f9022436206092132aead32">prevState</a>.bInfo[i] = buf[i];</div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> };</div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div>
|
|
<div class="line"><a name="l00076"></a><span class="lineno"><a class="code" href="class_keyboard_report_parser.html#a486df60a3d29f73e9052d3efb0c38de6"> 76</a></span> uint8_t <a class="code" href="class_keyboard_report_parser.html#a486df60a3d29f73e9052d3efb0c38de6">KeyboardReportParser::HandleLockingKeys</a>(<a class="code" href="class_h_i_d.html">HID</a> *hid, uint8_t key) {</div>
|
|
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  uint8_t old_keys = <a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.bLeds;</div>
|
|
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div>
|
|
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">switch</span> (key) {</div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#accb7a413ed6fa7db7192fc957d477ab8">KEY_NUM_LOCK</a>:</div>
|
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmNumLock = ~<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmNumLock;</div>
|
|
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">break</span>;</div>
|
|
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#aaac34940ff83d1431044aaca015639ce">KEY_CAPS_LOCK</a>:</div>
|
|
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmCapsLock = ~<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmCapsLock;</div>
|
|
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">break</span>;</div>
|
|
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#ab94d4309f6059492ef7dbf1a880cf7e0">KEY_SCROLL_LOCK</a>:</div>
|
|
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmScrollLock = ~<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmScrollLock;</div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">break</span>;</div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div>
|
|
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div>
|
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (old_keys != <a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.bLeds && hid)</div>
|
|
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">return</span> (hid-><a class="code" href="class_h_i_d.html#a58ca963ba0f12d2a457cb247595f38e9">SetReport</a>(0, 0<span class="comment">/*hid->GetIface()*/</span>, 2, 0, 1, &<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.bLeds));</div>
|
|
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div>
|
|
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">return</span> 0;</div>
|
|
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> }</div>
|
|
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div>
|
|
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span> <span class="keyword">const</span> uint8_t KeyboardReportParser::numKeys[] PROGMEM = {<span class="charliteral">'!'</span>, <span class="charliteral">'@'</span>, <span class="charliteral">'#'</span>, <span class="charliteral">'$'</span>, <span class="charliteral">'%'</span>, <span class="charliteral">'^'</span>, <span class="charliteral">'&'</span>, <span class="charliteral">'*'</span>, <span class="charliteral">'('</span>, <span class="charliteral">')'</span>};</div>
|
|
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> <span class="keyword">const</span> uint8_t KeyboardReportParser::symKeysUp[] PROGMEM = {<span class="charliteral">'_'</span>, <span class="charliteral">'+'</span>, <span class="charliteral">'{'</span>, <span class="charliteral">'}'</span>, <span class="charliteral">'|'</span>, <span class="charliteral">'~'</span>, <span class="charliteral">':'</span>, <span class="charliteral">'"'</span>, <span class="charliteral">'~'</span>, <span class="charliteral">'<'</span>, <span class="charliteral">'>'</span>, <span class="charliteral">'?'</span>};</div>
|
|
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="keyword">const</span> uint8_t KeyboardReportParser::symKeysLo[] PROGMEM = {<span class="charliteral">'-'</span>, <span class="charliteral">'='</span>, <span class="charliteral">'['</span>, <span class="charliteral">']'</span>, <span class="charliteral">'\\'</span>, <span class="charliteral">' '</span>, <span class="charliteral">';'</span>, <span class="charliteral">'\''</span>, <span class="charliteral">'`'</span>, <span class="charliteral">','</span>, <span class="charliteral">'.'</span>, <span class="charliteral">'/'</span>};</div>
|
|
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="keyword">const</span> uint8_t KeyboardReportParser::padKeys[] PROGMEM = {<span class="charliteral">'/'</span>, <span class="charliteral">'*'</span>, <span class="charliteral">'-'</span>, <span class="charliteral">'+'</span>, 0x13};</div>
|
|
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div>
|
|
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="class_keyboard_report_parser.html#aa21e9230ae4c2f068c404a9c2909a1f3"> 102</a></span> uint8_t <a class="code" href="class_keyboard_report_parser.html#aa21e9230ae4c2f068c404a9c2909a1f3">KeyboardReportParser::OemToAscii</a>(uint8_t mod, uint8_t key) {</div>
|
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  uint8_t shift = (mod & 0x22);</div>
|
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div>
|
|
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="comment">// [a-z]</span></div>
|
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">if</span> (key > 0x03 && key < 0x1e) {</div>
|
|
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="comment">// Upper case letters</span></div>
|
|
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">if</span> ((<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmCapsLock == 0 && (mod & 2)) ||</div>
|
|
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  (<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmCapsLock == 1 && (mod & 2) == 0))</div>
|
|
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">return</span> (key - 4 + <span class="charliteral">'A'</span>);</div>
|
|
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> </div>
|
|
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="comment">// Lower case letters</span></div>
|
|
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">else</span></div>
|
|
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordflow">return</span> (key - 4 + <span class="charliteral">'a'</span>);</div>
|
|
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  }<span class="comment">// Numbers</span></div>
|
|
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (key > 0x1d && key < 0x27) {</div>
|
|
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordflow">if</span> (shift)</div>
|
|
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">return</span> ((uint8_t)pgm_read_byte(&numKeys[key - 0x1e]));</div>
|
|
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">else</span></div>
|
|
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> (key - 0x1e + <span class="charliteral">'1'</span>);</div>
|
|
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  }<span class="comment">// Keypad Numbers</span></div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (key > 0x58 && key < 0x62) {</div>
|
|
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">if</span> (<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmNumLock == 1)</div>
|
|
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordflow">return</span> (key - 0x59 + <span class="charliteral">'1'</span>);</div>
|
|
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (key > 0x2c && key < 0x39)</div>
|
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">return</span> ((shift) ? (uint8_t)pgm_read_byte(&symKeysUp[key - 0x2d]) : (uint8_t)pgm_read_byte(&symKeysLo[key - 0x2d]));</div>
|
|
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (key > 0x53 && key < 0x59)</div>
|
|
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">return</span> (uint8_t)pgm_read_byte(&padKeys[key - 0x54]);</div>
|
|
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">else</span> {</div>
|
|
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">switch</span> (key) {</div>
|
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#a8a5ff83d21dfa704c1c3eff56d5b3a4b">KEY_SPACE</a>: <span class="keywordflow">return</span> (0x20);</div>
|
|
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#abaee5edb96e542206ae6c8102ac228af">KEY_ENTER</a>: <span class="keywordflow">return</span> (0x13);</div>
|
|
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#a814922ab1199d78d521bc9157b108063">KEY_ZERO</a>: <span class="keywordflow">return</span> ((shift) ? <span class="charliteral">')'</span>: <span class="charliteral">'0'</span>);</div>
|
|
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#aa8ccc5884206b4200185b8899b80b390">KEY_ZERO2</a>: <span class="keywordflow">return</span> ((<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmNumLock == 1) ? <span class="charliteral">'0'</span>: 0);</div>
|
|
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">case</span> <a class="code" href="hidboot_8h.html#a53f3c246f66d6cd725ff79bb3b1e0c74">KEY_PERIOD</a>: <span class="keywordflow">return</span> ((<a class="code" href="class_keyboard_report_parser.html#a61b14d08418be2e8f2a30b6cfbecef4e">kbdLockingKeys</a>.kbdLeds.bmNumLock == 1) ? <span class="charliteral">'.'</span>: 0);</div>
|
|
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  }</div>
|
|
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  }</div>
|
|
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">return</span> ( 0);</div>
|
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> }</div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.3.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|