/* * Console Initialization Routine */ void console_init() { memset(cmdEntries,0, sizeof(struct COMMAND_ENTRY) * CONSOLE_MAX_COMMAND); cmdCount = 0; // Initialize the commands #if CONSOLE_SETTINGS_COMMANDS_ENABLED // settings console_add_command(PSTR("CALL"),cmd_settings_mycall); // setup my callsign-ssid console_add_command(PSTR("DEST"),cmd_settings_destcall); // setup destination call-ssid console_add_command(PSTR("PATH"),cmd_settings_path); // setup path like WIDEn-N for beaco console_add_command(PSTR("RESET"),cmd_settings_reset); // reset the tnc console_add_command(PSTR("SYMBOL"),cmd_settings_symbol); // setup the beacon symbol console_add_command(PSTR("BEACON"), cmd_settings_beacon_interval); // setup beacon interval #if SETTINGS_SUPPORT_BEACON_TEXT console_add_command(PSTR("TEXT"),cmd_settings_beacon_text); #endif #endif #if CONSOLE_SEND_COMMAND_ENABLED console_add_command(PSTR("SEND"),cmd_send); #endif // Initialization done, display the welcome banner and settings info cmd_info(&g_serial,0,0); }
static void add_console_cmds(void){ pos_print_cmd = malloc(sizeof(console_command_t)); strcpy(pos_print_cmd->name, "position"); pos_print_cmd->n_args = 0; pos_print_cmd->execute = pos_print_execute; console_add_command(pos_print_cmd); pos_move_cmd = malloc(sizeof(console_command_t)); strcpy(pos_move_cmd->name, "teleport"); pos_move_cmd->n_args = 3; pos_move_cmd->arg_types[0] = ARG_FLOAT; pos_move_cmd->arg_types[1] = ARG_FLOAT; pos_move_cmd->arg_types[2] = ARG_FLOAT; pos_move_cmd->execute = pos_move_execute; console_add_command(pos_move_cmd); }
static void init(void) { IRQ_ENABLE; kdbg_init(); timer_init(); /* Initialize serial port, we are going to use it to show APRS messages*/ ser_init(&g_serial, SER_UART0); ser_setbaudrate(&g_serial, SER_DEFAULT_BAUD_RATE); // For some reason BertOS sets the serial // to 7 bit characters by default. We set // it to 8 instead. UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); // see ATMEGA328P datasheet P197, Table 20-11. UCSZn Bits Settings // initialize the reader that wraps the serial serialreader_init(&g_serialreader, &g_serial); // Load settings first settings_load(); /* * Init afsk demodulator. We need to implement the macros defined in hw_afsk.h, which * is the hardware abstraction layer. * We do not need transmission for now, so we set transmission DAC channel to 0. */ afsk_init(&g_afsk, ADC_CH, DAC_CH); /* * Here we initialize AX25 context, the channel (KFile) we are going to read messages * from and the callback that will be called on incoming messages. */ ax25_init(&g_ax25, &g_afsk.fd, ax25_msg_callback); g_ax25.pass_through = false; // Initialize the kiss module // NOTE - use shared memory buffer #if MOD_KISS kiss_init(&g_serialreader,&g_ax25); #endif #if MOD_BEACON // Initialize the beacon module beacon_init(beacon_mode_exit_callback); #endif // Initialize the digi module #if MOD_DIGI digi_init(); #endif #if MOD_RADIO // Initialize the soft serial and radio radio_init(4310400); //TODO read from settings #endif // Initialize GPS NMEA/GPRMC parser #if MOD_TRACKER tracker_init(); #endif #if MOD_CONSOLE ////////////////////////////////////////////////////////////// // Initialize the console & commands console_init(); console_add_command(PSTR("MODE"),cmd_switch_mode); // setup tnc run mode #if MOD_KISS console_add_command(PSTR("KISS"),cmd_enter_kiss_mode); // enable KISS mode #endif #endif }