File: htlib.html

package info (click to toggle)
libticables3 3.9.6-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,656 kB
  • ctags: 2,184
  • sloc: ansic: 15,996; sh: 9,298; makefile: 526; yacc: 288; awk: 145; sed: 16
file content (34 lines) | stat: -rw-r--r-- 2,509 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Making programs against the TiCables library</title>
  
  <style type="TEXT/CSS">
<!--
BODY {FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; BACKGROUND-COLOR: #FFFFFF; FONT-SIZE: 10pt}
TD {FONT-SIZE: 10pt}
H1 {FONT-SIZE: 18pt}
H3 {FONT-SIZE: 13pt}
PRE {FONT-FAMILY: Courier New; FONT-SIZE: 9pt}
CODE {FONT-FAMILY: Courier New; FONT-SIZE: 9pt}
-->
  </style>
</head>
 <body bgcolor="#ffffff" text="#000000" alink="#ff0000" vlink="#0000ff">
 
<h1> How to make a program against ticables library </h1>
 
<hr> 
<pre>&nbsp;<em>&nbsp;</em></pre>
You will find in the <i>test</i> folder of the libary source archive a test/example
program which uses this lib.<br>
Below is listed a light version (error management has been removed) of this
program to make it clearer:
<pre># include &lt;tilp/ticables.h&gt;<br># include &lt;tilp/pause.h&gt;<br><br>int main(int argc, char **argv)<br>{<br>  int err;<br>  uint8_t data;<br>  TicableLinkParam lp;<br>  TicableLinkCable lc;<br><br>  ticable_DISPLAY_settings(DSP_ON);	// display verbose informations in a shell/console<br>  <br>  ticable_init();			// set cable<br><br>  ticable_get_default_param(&amp;lp);	// we get default parameters for a link cable<br>  lp.delay = 10;			// we modify fields with our own values<br>  lp.timeout = 15;<br>  lp.port = SERIAL_PORT_1;<br>  ticable_set_param(&amp;lp);		// and make changes<br><br>  ticable_set_cable(LINK_TGL, &amp;lc);	// we choose a link cable model; this init the lc structure<br>     <br>  lc.init();				// initialize link cable<br> <br>  lc.open();				// open link cable access<br><br>  DISPLAY("Wait 1 second...\n");	// display a message (console is enabled by default)<br>  PAUSE(1000);				// and we wait for 1 second<br>  <br>  DISPLAY("Check if calc is OK...\n");	// we test if calc is ready (89/92+) by sending a RDY packet<br>  lc.put(0x00);<br>  lc.put(0x68);<br>  lc.put(0x00);<br>  lc.put(0x00);<br>  <br>  lc.get(&amp;data);			// we should receive 4 bytes<br>  printf("Data: %02X\n", data);<br>  lc.get(&amp;data);<br>  printf("Data: %02X\n", data);<br>  lc.get(&amp;data);<br>  printf("Data: %02X\n", data);<br>  lc.get(&amp;data);<br>  printf("Data: %02X\n", data);<br><br>  lc.close();				// we close link cable access<br>  <br>  lc.exit();				// we close the link cable<br><br>  return 0;<br>}<br></pre>
<br>
That's all ! 
<pre></pre>
<h3><a href="index.html">Return to the main index</a> </h3>
 <br>
</body>
</html>