/*
| ------------------------------------------
| Filename: upload_eye1.c
|
| Author:   Thomas Braunl, Aug. 2003
|
| Description: 
| serial data upload: EyeBot --> PC 
| use simple RoBIOS functions (not libc)
| -----------------------------------------
*/

#include "eyebot.h"

char newline = '\n';
char term    =  4;

char str[] = "0123456789\n";


void sendstr(char s[])
{ int i;
  i = 0;
  while (s[i] != 0)
  { OSSendRS232(&s[i], SERIAL1);
    LCDPrintf("%c",s[i]);
    i++;
  }
}


int main ()
{ char key, sendchar;

  LCDPrintf("UPLOAD DATA\n");
  LCDMenu("A..","Str"," ","END");
  OSInitRS232(SER115200, NONE, SERIAL1);

  do
  { key = KEYGet();
    switch (key)
    { case KEY1: sendchar = 'A';
      do
      { OSSendRS232(&sendchar, SERIAL1);
        LCDPrintf("%c",sendchar);
      } while (KEYRead() != KEY4);
      LCDPrintf("\n");
      OSSendRS232(&newline, SERIAL1);
      /* terminate chars with new line */
      break;

      case KEY2: sendstr(str);
      break;
    }
  } while (key != KEY4);

  OSSendRS232(&term, SERIAL1);
  /* terminate transmission */

  return 0;
}


