2 \author Travis Goodspeed
3 \brief These functions manage command interpretation.
10 unsigned char cmddata[CMDDATALEN];
11 unsigned char silent=0;
13 //! Transmit a string.
14 void txstring(unsigned char app,
17 unsigned long len=strlen(str);
23 /*! \brief Transmit a debug string.
25 Transmits a debugging string that is to be printed
26 out of line by the client. This is just for record-keeping;
27 it is not considered a proper reply to a query.
29 void debugstr(const char *str){
30 txstring(0xFF,0xFF,str);
33 /*! \brief Transmit debug bytes.
35 Transmits bytes for debugging.
37 void debugbytes(const char *bytes, unsigned int len){
39 txhead(0xFF,0xFE,len);
45 //! Transmit a header.
46 void txhead(unsigned char app,
51 //serial_tx(len); //old protocol
56 void txdata(unsigned char app,
64 serial_tx(cmddata[i]);
69 unsigned long rxlong(){
70 unsigned long toret=0;
72 toret|=(((long)serial_rx())<<8);
73 toret|=(((long)serial_rx())<<16);
74 toret|=(((long)serial_rx())<<24);
78 unsigned int rxword(){
79 unsigned long toret=0;
81 toret|=(((long)serial_rx())<<8);
85 void txlong(unsigned long l){
96 void txword(unsigned int l){
103 //Be very careful changing delay().
104 //It was chosen poorly by trial and error.
106 //! Delay for a count.
107 void delay(unsigned int count){
108 volatile unsigned int i=count;
109 while(i--) asm("nop");
112 void msdelay(unsigned int ms){
113 volatile unsigned int i,j;
117 while(j--) asm("nop");
119 //Using TimerA might be cleaner.