navtree.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. var NAVTREE =
  2. [
  3. [ "CMSIS-Driver", "index.html", [
  4. [ "Overview", "index.html", null ],
  5. [ "Revision History of CMSIS-Driver", "driver_revisionHistory.html", null ],
  6. [ "Theory of Operation", "theoryOperation.html", [
  7. [ "Common Driver Functions", "theoryOperation.html#DriverFunctions", [
  8. [ "Cortex-M Processor Mode", "theoryOperation.html#ProcessorMode", null ]
  9. ] ],
  10. [ "Function Call Sequence", "theoryOperation.html#CallSequence", [
  11. [ "Start Sequence", "theoryOperation.html#CS_start", null ],
  12. [ "Stop Sequence", "theoryOperation.html#CS_stop", null ]
  13. ] ],
  14. [ "Shared I/O Pins", "theoryOperation.html#Share_IO", null ],
  15. [ "Data Transfer Functions", "theoryOperation.html#Data_Xfer_Functions", null ],
  16. [ "Access Struct", "theoryOperation.html#AccessStruct", [
  17. [ "Driver Instances", "theoryOperation.html#DriverInstances", null ]
  18. ] ],
  19. [ "Driver Configuration", "theoryOperation.html#DriverConfiguration", null ],
  20. [ "Code Example", "theoryOperation.html#CodeExample", null ]
  21. ] ],
  22. [ "Reference Implementation", "referenceImplementation.html", [
  23. [ "Driver Header Files", "referenceImplementation.html#DriverHeaderFiles", null ],
  24. [ "Driver Template Files", "referenceImplementation.html#DriverTemplates", null ],
  25. [ "Driver Examples", "referenceImplementation.html#DriverExamples", null ]
  26. ] ],
  27. [ "Driver Validation", "driverValidation.html", [
  28. [ "Sample Test Output", "driverValidation.html#test_output", null ],
  29. [ "Setup for Loop Back Communication", "driverValidation.html#loop_back_setup", null ]
  30. ] ],
  31. [ "Deprecated List", "deprecated.html", null ],
  32. [ "Reference", "modules.html", "modules" ],
  33. [ "Data Structures", "annotated.html", "annotated" ],
  34. [ "Data Structure Index", "classes.html", null ],
  35. [ "Data Fields", "functions.html", [
  36. [ "All", "functions.html", "functions_dup" ],
  37. [ "Variables", "functions_vars.html", "functions_vars" ]
  38. ] ]
  39. ] ]
  40. ];
  41. var NAVTREEINDEX =
  42. [
  43. "Driver__CAN_8h.html#ga11c12020b81a63a73a8b53e96a7e3deaa3b6d191c99f1eba4f01bcc5fbfaf67f3",
  44. "group__can__interface__gr.html",
  45. "group__flash__interface__gr.html#a50947f9a42bbaa2d68d6e5079150d7bf",
  46. "group__nand__bus__mode__codes.html#ga475a339e929eca46e11bc8a7b330aa45",
  47. "group__sai__slot__control.html#ga8f2cf3a212ca7fe389e00b082efb5d0b",
  48. "group__usart__mode__control.html",
  49. "group__wifi__interface__gr.html#a471a1be6d9adbccb83ca1f268643031c"
  50. ];
  51. var SYNCONMSG = 'click to disable panel synchronisation';
  52. var SYNCOFFMSG = 'click to enable panel synchronisation';
  53. var SYNCONMSG = 'click to disable panel synchronisation';
  54. var SYNCOFFMSG = 'click to enable panel synchronisation';
  55. var navTreeSubIndices = new Array();
  56. function getData(varName)
  57. {
  58. var i = varName.lastIndexOf('/');
  59. var n = i>=0 ? varName.substring(i+1) : varName;
  60. return eval(n.replace(/\-/g,'_'));
  61. }
  62. function stripPath(uri)
  63. {
  64. return uri.substring(uri.lastIndexOf('/')+1);
  65. }
  66. function stripPath2(uri)
  67. {
  68. var i = uri.lastIndexOf('/');
  69. var s = uri.substring(i+1);
  70. var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
  71. return m ? uri.substring(i-6) : s;
  72. }
  73. function localStorageSupported()
  74. {
  75. try {
  76. return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
  77. }
  78. catch(e) {
  79. return false;
  80. }
  81. }
  82. function storeLink(link)
  83. {
  84. if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
  85. window.localStorage.setItem('navpath',link);
  86. }
  87. }
  88. function deleteLink()
  89. {
  90. if (localStorageSupported()) {
  91. window.localStorage.setItem('navpath','');
  92. }
  93. }
  94. function cachedLink()
  95. {
  96. if (localStorageSupported()) {
  97. return window.localStorage.getItem('navpath');
  98. } else {
  99. return '';
  100. }
  101. }
  102. function getScript(scriptName,func,show)
  103. {
  104. var head = document.getElementsByTagName("head")[0];
  105. var script = document.createElement('script');
  106. script.id = scriptName;
  107. script.type = 'text/javascript';
  108. script.onload = func;
  109. script.src = scriptName+'.js';
  110. if ($.browser.msie && $.browser.version<=8) {
  111. // script.onload does not work with older versions of IE
  112. script.onreadystatechange = function() {
  113. if (script.readyState=='complete' || script.readyState=='loaded') {
  114. func(); if (show) showRoot();
  115. }
  116. }
  117. }
  118. head.appendChild(script);
  119. }
  120. function createIndent(o,domNode,node,level)
  121. {
  122. var level=-1;
  123. var n = node;
  124. while (n.parentNode) { level++; n=n.parentNode; }
  125. if (node.childrenData) {
  126. var imgNode = document.createElement("img");
  127. imgNode.style.paddingLeft=(16*level).toString()+'px';
  128. imgNode.width = 16;
  129. imgNode.height = 22;
  130. imgNode.border = 0;
  131. node.plus_img = imgNode;
  132. node.expandToggle = document.createElement("a");
  133. node.expandToggle.href = "javascript:void(0)";
  134. node.expandToggle.onclick = function() {
  135. if (node.expanded) {
  136. $(node.getChildrenUL()).slideUp("fast");
  137. node.plus_img.src = node.relpath+"ftv2pnode.png";
  138. node.expanded = false;
  139. } else {
  140. expandNode(o, node, false, false);
  141. }
  142. }
  143. node.expandToggle.appendChild(imgNode);
  144. domNode.appendChild(node.expandToggle);
  145. imgNode.src = node.relpath+"ftv2pnode.png";
  146. } else {
  147. var span = document.createElement("span");
  148. span.style.display = 'inline-block';
  149. span.style.width = 16*(level+1)+'px';
  150. span.style.height = '22px';
  151. span.innerHTML = '&#160;';
  152. domNode.appendChild(span);
  153. }
  154. }
  155. var animationInProgress = false;
  156. function gotoAnchor(anchor,aname,updateLocation)
  157. {
  158. var pos, docContent = $('#doc-content');
  159. if (anchor.parent().attr('class')=='memItemLeft' ||
  160. anchor.parent().attr('class')=='fieldtype' ||
  161. anchor.parent().is(':header'))
  162. {
  163. pos = anchor.parent().position().top;
  164. } else if (anchor.position()) {
  165. pos = anchor.position().top;
  166. }
  167. if (pos) {
  168. var dist = Math.abs(Math.min(
  169. pos-docContent.offset().top,
  170. docContent[0].scrollHeight-
  171. docContent.height()-docContent.scrollTop()));
  172. animationInProgress=true;
  173. docContent.animate({
  174. scrollTop: pos + docContent.scrollTop() - docContent.offset().top
  175. },Math.max(50,Math.min(500,dist)),function(){
  176. if (updateLocation) window.location.href=aname;
  177. animationInProgress=false;
  178. });
  179. }
  180. }
  181. function newNode(o, po, text, link, childrenData, lastNode)
  182. {
  183. var node = new Object();
  184. node.children = Array();
  185. node.childrenData = childrenData;
  186. node.depth = po.depth + 1;
  187. node.relpath = po.relpath;
  188. node.isLast = lastNode;
  189. node.li = document.createElement("li");
  190. po.getChildrenUL().appendChild(node.li);
  191. node.parentNode = po;
  192. node.itemDiv = document.createElement("div");
  193. node.itemDiv.className = "item";
  194. node.labelSpan = document.createElement("span");
  195. node.labelSpan.className = "label";
  196. createIndent(o,node.itemDiv,node,0);
  197. node.itemDiv.appendChild(node.labelSpan);
  198. node.li.appendChild(node.itemDiv);
  199. var a = document.createElement("a");
  200. node.labelSpan.appendChild(a);
  201. node.label = document.createTextNode(text);
  202. node.expanded = false;
  203. a.appendChild(node.label);
  204. if (link) {
  205. var url;
  206. if (link.substring(0,1)=='^') {
  207. url = link.substring(1);
  208. link = url;
  209. } else {
  210. url = node.relpath+link;
  211. }
  212. a.className = stripPath(link.replace('#',':'));
  213. if (link.indexOf('#')!=-1) {
  214. var aname = '#'+link.split('#')[1];
  215. var srcPage = stripPath($(location).attr('pathname'));
  216. var targetPage = stripPath(link.split('#')[0]);
  217. a.href = srcPage!=targetPage ? url : "javascript:void(0)";
  218. a.onclick = function(){
  219. storeLink(link);
  220. if (!$(a).parent().parent().hasClass('selected'))
  221. {
  222. $('.item').removeClass('selected');
  223. $('.item').removeAttr('id');
  224. $(a).parent().parent().addClass('selected');
  225. $(a).parent().parent().attr('id','selected');
  226. }
  227. var anchor = $(aname);
  228. gotoAnchor(anchor,aname,true);
  229. };
  230. } else {
  231. a.href = url;
  232. a.onclick = function() { storeLink(link); }
  233. }
  234. } else {
  235. if (childrenData != null)
  236. {
  237. a.className = "nolink";
  238. a.href = "javascript:void(0)";
  239. a.onclick = node.expandToggle.onclick;
  240. }
  241. }
  242. node.childrenUL = null;
  243. node.getChildrenUL = function() {
  244. if (!node.childrenUL) {
  245. node.childrenUL = document.createElement("ul");
  246. node.childrenUL.className = "children_ul";
  247. node.childrenUL.style.display = "none";
  248. node.li.appendChild(node.childrenUL);
  249. }
  250. return node.childrenUL;
  251. };
  252. return node;
  253. }
  254. function showRoot()
  255. {
  256. var headerHeight = $("#top").height();
  257. var footerHeight = $("#nav-path").height();
  258. var windowHeight = $(window).height() - headerHeight - footerHeight;
  259. (function (){ // retry until we can scroll to the selected item
  260. try {
  261. var navtree=$('#nav-tree');
  262. navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
  263. } catch (err) {
  264. setTimeout(arguments.callee, 0);
  265. }
  266. })();
  267. }
  268. function expandNode(o, node, imm, showRoot)
  269. {
  270. if (node.childrenData && !node.expanded) {
  271. if (typeof(node.childrenData)==='string') {
  272. var varName = node.childrenData;
  273. getScript(node.relpath+varName,function(){
  274. node.childrenData = getData(varName);
  275. expandNode(o, node, imm, showRoot);
  276. }, showRoot);
  277. } else {
  278. if (!node.childrenVisited) {
  279. getNode(o, node);
  280. } if (imm || ($.browser.msie && $.browser.version>8)) {
  281. // somehow slideDown jumps to the start of tree for IE9 :-(
  282. $(node.getChildrenUL()).show();
  283. } else {
  284. $(node.getChildrenUL()).slideDown("fast");
  285. }
  286. if (node.isLast) {
  287. node.plus_img.src = node.relpath+"ftv2mlastnode.png";
  288. } else {
  289. node.plus_img.src = node.relpath+"ftv2mnode.png";
  290. }
  291. node.expanded = true;
  292. }
  293. }
  294. }
  295. function glowEffect(n,duration)
  296. {
  297. n.addClass('glow').delay(duration).queue(function(next){
  298. $(this).removeClass('glow');next();
  299. });
  300. }
  301. function highlightAnchor()
  302. {
  303. var aname = $(location).attr('hash');
  304. var anchor = $(aname);
  305. if (anchor.parent().attr('class')=='memItemLeft'){
  306. var rows = $('.memberdecls tr[class$="'+
  307. window.location.hash.substring(1)+'"]');
  308. glowEffect(rows.children(),300); // member without details
  309. } else if (anchor.parents().slice(2).prop('tagName')=='TR') {
  310. glowEffect(anchor.parents('div.memitem'),1000); // enum value
  311. } else if (anchor.parent().attr('class')=='fieldtype'){
  312. glowEffect(anchor.parent().parent(),1000); // struct field
  313. } else if (anchor.parent().is(":header")) {
  314. glowEffect(anchor.parent(),1000); // section header
  315. } else {
  316. glowEffect(anchor.next(),1000); // normal member
  317. }
  318. gotoAnchor(anchor,aname,false);
  319. }
  320. function selectAndHighlight(hash,n)
  321. {
  322. var a;
  323. if (hash) {
  324. var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
  325. a=$('.item a[class$="'+link+'"]');
  326. }
  327. if (a && a.length) {
  328. a.parent().parent().addClass('selected');
  329. a.parent().parent().attr('id','selected');
  330. highlightAnchor();
  331. } else if (n) {
  332. $(n.itemDiv).addClass('selected');
  333. $(n.itemDiv).attr('id','selected');
  334. }
  335. if ($('#nav-tree-contents .item:first').hasClass('selected')) {
  336. $('#nav-sync').css('top','30px');
  337. } else {
  338. $('#nav-sync').css('top','5px');
  339. }
  340. showRoot();
  341. }
  342. function showNode(o, node, index, hash)
  343. {
  344. if (node && node.childrenData) {
  345. if (typeof(node.childrenData)==='string') {
  346. var varName = node.childrenData;
  347. getScript(node.relpath+varName,function(){
  348. node.childrenData = getData(varName);
  349. showNode(o,node,index,hash);
  350. },true);
  351. } else {
  352. if (!node.childrenVisited) {
  353. getNode(o, node);
  354. }
  355. $(node.getChildrenUL()).css({'display':'block'});
  356. if (node.isLast) {
  357. node.plus_img.src = node.relpath+"ftv2mlastnode.png";
  358. } else {
  359. node.plus_img.src = node.relpath+"ftv2mnode.png";
  360. }
  361. node.expanded = true;
  362. var n = node.children[o.breadcrumbs[index]];
  363. if (index+1<o.breadcrumbs.length) {
  364. showNode(o,n,index+1,hash);
  365. } else {
  366. if (typeof(n.childrenData)==='string') {
  367. var varName = n.childrenData;
  368. getScript(n.relpath+varName,function(){
  369. n.childrenData = getData(varName);
  370. node.expanded=false;
  371. showNode(o,node,index,hash); // retry with child node expanded
  372. },true);
  373. } else {
  374. var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
  375. if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
  376. expandNode(o, n, true, true);
  377. }
  378. selectAndHighlight(hash,n);
  379. }
  380. }
  381. }
  382. } else {
  383. selectAndHighlight(hash);
  384. }
  385. }
  386. function removeToInsertLater(element) {
  387. var parentNode = element.parentNode;
  388. var nextSibling = element.nextSibling;
  389. parentNode.removeChild(element);
  390. return function() {
  391. if (nextSibling) {
  392. parentNode.insertBefore(element, nextSibling);
  393. } else {
  394. parentNode.appendChild(element);
  395. }
  396. };
  397. }
  398. function getNode(o, po)
  399. {
  400. var insertFunction = removeToInsertLater(po.li);
  401. po.childrenVisited = true;
  402. var l = po.childrenData.length-1;
  403. for (var i in po.childrenData) {
  404. var nodeData = po.childrenData[i];
  405. po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
  406. i==l);
  407. }
  408. insertFunction();
  409. }
  410. function gotoNode(o,subIndex,root,hash,relpath)
  411. {
  412. var nti = navTreeSubIndices[subIndex][root+hash];
  413. o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
  414. if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
  415. navTo(o,NAVTREE[0][1],"",relpath);
  416. $('.item').removeClass('selected');
  417. $('.item').removeAttr('id');
  418. }
  419. if (o.breadcrumbs) {
  420. o.breadcrumbs.unshift(0); // add 0 for root node
  421. showNode(o, o.node, 0, hash);
  422. }
  423. }
  424. function navTo(o,root,hash,relpath)
  425. {
  426. var link = cachedLink();
  427. if (link) {
  428. var parts = link.split('#');
  429. root = parts[0];
  430. if (parts.length>1) hash = '#'+parts[1];
  431. else hash='';
  432. }
  433. if (hash.match(/^#l\d+$/)) {
  434. var anchor=$('a[name='+hash.substring(1)+']');
  435. glowEffect(anchor.parent(),1000); // line number
  436. hash=''; // strip line number anchors
  437. //root=root.replace(/_source\./,'.'); // source link to doc link
  438. }
  439. var url=root+hash;
  440. var i=-1;
  441. while (NAVTREEINDEX[i+1]<=url) i++;
  442. if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
  443. if (navTreeSubIndices[i]) {
  444. gotoNode(o,i,root,hash,relpath)
  445. } else {
  446. getScript(relpath+'navtreeindex'+i,function(){
  447. navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
  448. if (navTreeSubIndices[i]) {
  449. gotoNode(o,i,root,hash,relpath);
  450. }
  451. },true);
  452. }
  453. }
  454. function showSyncOff(n,relpath)
  455. {
  456. n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
  457. }
  458. function showSyncOn(n,relpath)
  459. {
  460. n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
  461. }
  462. function toggleSyncButton(relpath)
  463. {
  464. var navSync = $('#nav-sync');
  465. if (navSync.hasClass('sync')) {
  466. navSync.removeClass('sync');
  467. showSyncOff(navSync,relpath);
  468. storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));
  469. } else {
  470. navSync.addClass('sync');
  471. showSyncOn(navSync,relpath);
  472. deleteLink();
  473. }
  474. }
  475. function initNavTree(toroot,relpath)
  476. {
  477. var o = new Object();
  478. o.toroot = toroot;
  479. o.node = new Object();
  480. o.node.li = document.getElementById("nav-tree-contents");
  481. o.node.childrenData = NAVTREE;
  482. o.node.children = new Array();
  483. o.node.childrenUL = document.createElement("ul");
  484. o.node.getChildrenUL = function() { return o.node.childrenUL; };
  485. o.node.li.appendChild(o.node.childrenUL);
  486. o.node.depth = 0;
  487. o.node.relpath = relpath;
  488. o.node.expanded = false;
  489. o.node.isLast = true;
  490. o.node.plus_img = document.createElement("img");
  491. o.node.plus_img.src = relpath+"ftv2pnode.png";
  492. o.node.plus_img.width = 16;
  493. o.node.plus_img.height = 22;
  494. if (localStorageSupported()) {
  495. var navSync = $('#nav-sync');
  496. if (cachedLink()) {
  497. showSyncOff(navSync,relpath);
  498. navSync.removeClass('sync');
  499. } else {
  500. showSyncOn(navSync,relpath);
  501. }
  502. navSync.click(function(){ toggleSyncButton(relpath); });
  503. }
  504. $(window).load(function(){
  505. navTo(o,toroot,window.location.hash,relpath);
  506. showRoot();
  507. });
  508. $(window).bind('hashchange', function(){
  509. if (window.location.hash && window.location.hash.length>1){
  510. var a;
  511. if ($(location).attr('hash')){
  512. var clslink=stripPath($(location).attr('pathname'))+':'+
  513. $(location).attr('hash').substring(1);
  514. a=$('.item a[class$="'+clslink+'"]');
  515. }
  516. if (a==null || !$(a).parent().parent().hasClass('selected')){
  517. $('.item').removeClass('selected');
  518. $('.item').removeAttr('id');
  519. }
  520. var link=stripPath2($(location).attr('pathname'));
  521. navTo(o,link,$(location).attr('hash'),relpath);
  522. } else if (!animationInProgress) {
  523. $('#doc-content').scrollTop(0);
  524. $('.item').removeClass('selected');
  525. $('.item').removeAttr('id');
  526. navTo(o,toroot,window.location.hash,relpath);
  527. }
  528. })
  529. }