#include <net_config.h>
void tnet_set_delay (
U16 dly ); /* Length of time to wait. */
Description
The tnet_set_delay function ensures that the telnet server
does not call the tnet_process_cmd function until a certain
time period expires. After the time interval, the telnet server can
call the tnet_process_cmd function. The argument dly
specifies the time period to wait, in number of timer ticks.
The tnet_set_delay function is in the RL-TCPnet library.
The prototype is defined in net_config.h.
note
For example, when monitoring an input channel, you can call the
tnet_set_delay function from the tnet_process_cmd to
continuously update the telnet client screen every 2 seconds.
Pressing a key on the remote telnet client stops the monitoring
process.
typedef struct {
U8 id;
U8 nmax;
U8 idx;
} MY_BUF;
#define MYBUF(p) ((MY_BUF *)p)
U16 tnet_process_cmd (U8 *cmd, U8 *buf, U16 buflen, U32 *pvar) {
U16 len;
switch (MYBUF(pvar)->id) {
case 0:
/* On first call to this function, the value of '*pvar' is 0 */
break;
case 1:
/* Display measurements triggered by command 'MEAS' */
..
return (len);
case 2:
/* Monitor analog input ADIN0. */
len = sprintf (buf,"ADIN0 = %d",AD_in (0));
/* Delay a call to this function for 2 seconds (20 * 100ms). */
tnet_set_delay (20);
/* Request a repeated call, bit 14 is a repeat flag. */
len |= 0x4000;
return (len);
}
/* Simple Command line parser */
if (tnet_ccmp (cmd, "ADMON") == __TRUE) {
/* Monitor the value of ADIN0 constantly on a screen. */
len = str_copy (buf, CLS);
MYBUF(cmd)->id = 2;
return (len | 0x4000);
}
..
return (len);
}
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.