Exemple #1
0
BOOL syntax_error()
{
    console_puts_P(PSTR("BadCmd"));
    console_newline();
    // Returning TRUE here is a convenience for other parsing functions,
    // suggesting to ignore rest of line
    return FALSE;
}
Exemple #2
0
int main(void)
{
    /* Bring up processor */
	cpu_init();
    watchdog_init();

#ifdef CONFIG_HW_LED_ALIVE_CHECK
    /* Bring up low level LED */
    hw_led_init();
#endif
#ifdef CONFIG_HW_UART
    /* Bring up low level hardware UART */
    hw_uart_init();
#endif
    /* Setup timer for tick counting */
    tick_init();

    /* Bring up high level LED */
    led_init();

    /* Bring up console */
    console_init();

#ifdef CONFIG_DEBUG_RESET_REASON
    /* Report reason for last reset */
    console_puts_P(PSTR("Reset cause:"));
    console_puthex8(MCUSR);
    console_newline();
#endif

    /* Set default LED pattern */
    led_set_seq(LED_SEQ_SINE);

#ifdef CONFIG_USBDEV
    usbdev_init(USBMODE_DEFAULT);
#endif

    /* HiZ bus mode selected by default */
    bus_init(&bus_hiz);

    /* Enable interrupts */
    cpu_enable_int();

    while(1)
	{
        driver_tick();
	}
}
Exemple #3
0
// "mycommand ... .... ..."
//  ^       ^            ^
//  cmdname |            |
//          cmdname+len  |
//                       line_end
static BOOL handle_global_command(const uint8_t *cmdname, size_t len, const uint8_t *line_end)
{
    const global_command_t *cmd_ptr = global_command_table;
    global_command_t cmd;

    memcpy_P(&cmd, cmd_ptr, sizeof(global_command_t));
    while(NULL != cmd.name)
    {
        if (memcmp_P(cmdname, cmd.name, len)==0 && strlen_P(cmd.name) <= len)
        {
            if (!(*cmd.handler)(cmdname+len, line_end))
            {
                console_puts_P(PSTR("Error"));
                console_newline();
            }
            return TRUE;
        }
        memcpy_P(&cmd, ++cmd_ptr, sizeof(global_command_t));
    }
    return FALSE;
}
Exemple #4
0
static void prompt(void)
{
    if (console_prompt)
        console_puts((uint8_t*)console_prompt);
    console_puts_P(PSTR("> "));
}
Exemple #5
0
static void prompt(void)
{
    console_puts_P(PSTR("> "));
}