Example #1
0
void vt100_poll()
{
    int c;

    c = console_usb_getchar();
    if (c >= 0){
	if (unlikely(vt100_redirect_handler))
	    vt100_redirect_handler(c);
	else
	    microrl_insert_char(&microrl, c);
    }
}
Example #2
0
void main()
{
    __disable_interrupt();

    init_core();
    init_device();
    init_wdt();

    __enable_interrupt();

    microrl_init (pointerMicrorl, &serprintf);
    microrl_set_execute_callback (pointerMicrorl, execute);
    microrl_set_complete_callback (pointerMicrorl, complet);
    microrl_set_sigint_callback (pointerMicrorl, sigint);

    init_app_settings();

    print_revision();
    DEBUG_PRINTF("FlashMem: %s %s\n\r",
        get_family_desc_at25df(),
        get_density_desc_at25df());

    enable_default_lis3dh();
    init_tasks();
    init_reco_drift();
    init_can_j1939();

    DEBUG_PRINTF("\r\n\r\n");

    while (1) {
        if (pointerRingBuff->size(pointerRingBuff) > 0) {
            const uint8_t data = pointerRingBuff->get(pointerRingBuff);

            if (!get_proto_type()) {
                microrl_insert_char (pointerMicrorl, data);
            } else {
                sdp_insert_char(data);
            }
        }

        poll_can_msg();

        run_tasks();

        clear_wdt();
    }
}
Example #3
0
//*****************************************************************************
int main (void/*int argc, char ** argv*/)
{
	init();
	// call init with ptr to microrl instance and print callback
	microrl_init(prl, print);
	// set callback for execute
	microrl_set_execute_callback(prl, execute);

#ifdef _USE_COMPLETE
	// set callback for completion
	microrl_set_complete_callback(prl, complete);
#endif
	// set callback for Ctrl+C
	microrl_set_sigint_callback(prl, sigint);
	while (1) {
		// put received char from stdin to microrl lib
		microrl_insert_char(prl, get_char());
	}
	return 0;
}
Example #4
0
File: cli.c Project: mcu786/volat3
static msg_t ShellThread(void *arg){
  chRegSetThreadName("Shell");
  chThdSleepMilliseconds(1000);

  /* init static pointer for serial driver with received pointer */
  shell_sdp = (SerialUSBDriver *)arg;

  // create and init microrl object
  microrl_t microrl_shell;
//  cli_print("@@*** Super cool device, version 1.2.3, for help type help... ***@@\r\n");
  microrl_init(&microrl_shell, cli_print);

  // set callback for execute
  microrl_set_execute_callback(&microrl_shell, execute);

  // set callback for completion (optionally)
  microrl_set_complete_callback(&microrl_shell, complete);

  // set callback for ctrl+c handling (optionally)
  microrl_set_sigint_callback(&microrl_shell, sigint);

  while (TRUE){
    // put received char from stdin to microrl lib
    msg_t c = sdGetTimeout(shell_sdp, MS2ST(50));
    if (c != Q_TIMEOUT)
      microrl_insert_char(&microrl_shell, (char)c);

    /* умираем по всем правилам, не забываем убить потомков */
    if (chThdShouldTerminate()){
      if ((current_cmd_tp != NULL) && (current_cmd_tp->p_state != THD_STATE_FINAL)){
        chThdTerminate(current_cmd_tp);
        chThdWait(current_cmd_tp);
      }
      chThdExit(0);
    }
  }
  return 0;
}
Example #5
0
void console_exec(char *str) {
	while (*str)
		microrl_insert_char (prl, (char) *str++);
}
Example #6
0
void console_insert(char c)
{
	if (!console_locked || (c) == KEY_ETX)
		microrl_insert_char (prl, c);
}
Example #7
0
/**
  * @brief  
  * @retval 
  */
void MICRORL_GetChar(uint8_t ch)
{
  microrl_insert_char(prl, ch);
}
Example #8
0
void stm32_microrl_insert_char(int ch)
{
	microrl_insert_char (prl, ch);
}