Пример #1
0
int main(void)
{
    CLKPR = (1<<7);
    CLKPR = 0;

    /* Disable watchdog timer */
    MCUSR = 0;
    wdt_disable();

    /* Start the multi-threading kernel */
    init_kernel(STACK_MAIN);

    /* Timer */
    TCCR2B = 0x03;                   /* Pre-scaler for timer0 */
    TCCR2A = 1<<WGM21;               /* CTC mode */
    TIMSK2 = 1<<OCIE2A;              /* Interrupt on compare match */
    OCR2A  = (SCALED_F_CPU / 32 / 2400) - 1;

    TRACE_INIT;
    sei();
    t_stackErrorHandler(stackOverflow);
    fbuf_errorHandler(bufferOverflow);
    reset_params();

    /* HDLC and AFSK setup */
    mon_init(&cdc_outstr);
    adf7021_init();
    inframes  = hdlc_init_decoder( afsk_init_decoder() );
    outframes = hdlc_init_encoder( afsk_init_encoder() );
    digipeater_init();
    /* Activate digipeater in ui thread */

    /* USB */
    usb_init();
    THREAD_START(usbSerListener, STACK_USBLISTENER);

    ui_init();

    /* GPS and tracking */
    gps_init(&cdc_outstr);
    tracker_init();


    TRACE(1);
    while(1)
    {
        lbeep();
        if (t_is_idle()) {
            /* Enter idle mode or sleep mode here */
            powerdown_handler();
            sleep_mode();
        }
        else
            t_yield();
    }
}
Пример #2
0
void init(void) {
    sei();

    AFSK_init(&modem);
    ax25_init(&AX25, &modem.fd, ax25_callback);
    digipeater_init(&AX25, &modem, &serial);

    serial_init(&serial);
    stdout = &serial.uart0;
    stdin  = &serial.uart0;

}