How to make a program against the ticalcs library


  
You will find in the test folder of the library source archive a test/example program which uses this library.
Below is listed a light version (error management has been removed and update functions are set to void) of this program to make it clearer:
#include <ticalcs.h>

/* Cable & Calc structures */
TicableLinkParam lp;
TicableLinkCable lc;
TicalcFncts tc; // Functions which drive a calculator
TicalcInfoUpdate iu; // Functions to do the refresh of progress bar & label

/* Update functions */
void ilp_start() { }
void ilp_stop() { }
void ilp_refresh() { }
void ilp_pbar() { }
void ilp_label() { }

int main(int argc, char **argv)
{
int err;

/*
Initialize the libTIcable library
*/
ticable_get_default_param(&lp);
lp.delay = DFLT_DELAY;
lp.timeout = DFLT_TIMEOUT;
lp.port = SERIAL_PORT_2;
lp.method = IOM_AUTO;
ticable_set_param(&lp);
ticable_set_cable(LINK_SER, &lc);

/*
Initialize the libTIcalc library
*/
ticalc_set_update(&iu, ilp_start, ilp_stop, ilp_refresh,
ilp_pbar, ilp_label);

ticalc_set_cable(&lc);
ticalc_set_calc(CALC_TI89, &tc);

// Init port
lc.init();
lc.open();

// Check ready
tc.isready();

// Close port
lc.close();
lc.exit();

return 0;
}

That's all !

     

Return to the main index