Beispiel #1
0
int main(void) {
    int key;
    adc_setup();
    draw_text();
    char temp[5];
    while (1) {
        for (i = 0; i < 4; i++) {
            if (adc_isdone(adcchannels[i]) == 1)
                adc_sample(adcchannels[i], 128);
            tsample = adc_getsample(adcchannels[i]);
            if (! tsample == 0) {
                sprintf(temp, "%d", adcchannels[i]);
                term_puts(1, i + 4, temp);
                sprintf(temp, "%d", adcsmoothing[i]);
                term_puts(5, i + 4, temp);
                sprintf(temp, "%d", tsample);
                term_puts(11, i + 4, temp);
            }
        }
        key = term_getchar(NOWAIT);
        if (key != -1) {
            if (handle_kbd((int)key))
                break;
        }
    }
    term_clrscr();
    term_moveto(1, 1);
    return 0;
}
Beispiel #2
0
/* the magic starts here */
int main(void)
{
	char msg[20];
	int key;
	int index, enabled = 1, i, j;
	if (strcmp("EK-LM3S8962", pd_board()) != 0 || strcmp("EK-LM3S6965", pd_board() != 0)) {
		printf("%s is not supported with this example\n");
		return -1;
	}

	get_started();

	while (1) {
		term_clrscr();
		term_moveto(1, 1);
		printf("Welcome to picoc Morse Playing on %s", pd_board());
		printf("\nEnter phrase (empty phrase to exit): ");
		gets(msg);
		if (strlen(msg) == 0)
			break;
		while (term_getchar(0) != -1);
		while (enabled) {
			for (i = 0; msg[i]; i++) {
				index = morse_index(msg[i]);
				printf ("%c", msg[i]);
				printf (": ");
				if (msg[i] != ' ') {
					for (j = 0; morse[index][j]; j++) {
						printf ("%c", morse[index][j]);
						play(morse[index][j]);
					}
					printf ("\n");
				} else {
					play(' ');
					play(' ');
				}
				play(' ');
				key = term_getchar(0);
				if (key != -1) {
					if (handle_kbd((int)key)) {
						enabled = 0;
						exit(1);
					}
				}
			}
			if (!enabled)
				break;
			printf("\n\n");
			play(' ');
			play(' ');
			play(' ');
		}
	}
	return 0;
}
Beispiel #3
0
int platform_init()
{ 
  if( memory_start_address == NULL ) 
  {
    hostif_putstr( "platform_init(): mmap failed\n" );
    return PLATFORM_ERR;
  }

  // Set the std input/output functions
  // Set the send/recv functions                          
  std_set_send_func( scr_write );
  std_set_get_func( kb_read );       

  // Set term functions
#ifdef BUILD_TERM  
  term_init( TERM_LINES, TERM_COLS, i386_term_out, i386_term_in, i386_term_translate );
#endif

  term_clrscr();
  term_gotoxy( 1, 1 );
 
  // All done
  return PLATFORM_OK;
}
Beispiel #4
0
// Lua: clrscr()
static int luaterm_clrscr( lua_State* L )
{
  term_clrscr();
  return 0;
}
Beispiel #5
0
// (term-clrscr) -> Nil
any plisp_term_clrscr(any x) {
  term_clrscr();
  return Nil;
}
Beispiel #6
0
// picoc: term_clrscr();
static void pterm_clrscr(pstate *p, val *r, val **param, int n)
{
  term_clrscr();
}
Beispiel #7
0
/* draw static text on terminal */
void draw_text(void) {
    term_clrscr();
    term_puts(1, 1, "ADC Status:");
    term_puts(1, 3, "CH  SLEN  RES");
    term_puts(1, 9, "Press ESC to exit.");
}