Пример #1
0
ot_int mpipedrv_init(void* port_id) {
/// <LI> "port_id" is unused in this impl, and it may be NULL                   </LI>
/// <LI> Prepare the HW, which in this case is a USB CDC (i.e. Virtual COM)     </LI>
/// <LI> USB is disconnected at startup in order to clear the host USB driver,
///        which will get stuck during debugging or other sleeping processes.   </LI>

    platform_ext.usb_wakeup = False;
    tty.seq.ushort          = 0;                //not actually necessary
    mpipe.state             = MPIPE_Null;	    // Disconnected

	alp_init(&mpipe.alp, &otmpin, &otmpout);
	mpipe.alp.inq->back    -= 10;
    mpipe.alp.outq->back   -= 10;
    
    usb_init();
    //usb_disconnect();	//disconnect USB first

    //See if we're already attached physically to USB, and if so, connect to it
    //Normally applications don't invoke the event handlers, but this is an exception.
    if (USBPWRCTL & USBBGVBV){
        usbevt_vbuson();
    }

    return 255;
}
Пример #2
0
ot_int mpipe_init(void* port_id) {
/// 0. "port_id" is unused in this impl, and it may be NULL
/// 1. Set all signal callbacks to NULL, and initialize other variables.
/// 2. Prepare the HW, which in this case is a UART
/// 3. Set default speed, which in this case is 115200 bps

#if (MCU_FEATURE(MEMCPYDMA) != ENABLED)
    BOARD_DMA_COMMON_INIT();
#endif

#if (OT_FEATURE(MPIPE_CALLBACKS) == ENABLED)
    mpipe.sig_rxdone    = &otutils_sigv_null;
    mpipe.sig_txdone    = &otutils_sigv_null;
    mpipe.sig_rxdetect  = &otutils_sigv_null;
#endif
#if (MPIPE_USE_ACKS)
    mpipe.priority  = MPIPE_Low;
#endif

    mpipe.sequence.ushort   = 0;          //not actually necessary
    mpipe.state             = MPIPE_Idle;

    alp_init(&mpipe_alp, &dir_in, &dir_out);
    mpipe_alp.inq->back    -= 10;
    mpipe_alp.outq->back   -= 10;

    sub_uart_portsetup();
    mpipe_setspeed(MPIPE_115200bps);     //default baud rate

    return 0;
}
Пример #3
0
OT_WEAK void m2qp_init() {
#if OT_FEATURE(M2QP_CALLBACKS)
#   if !defined(EXTF_m2qp_sig_isf)
        m2qp.sig.isf    = &m2qp_sig_null;
#   endif

#   if !defined(EXTF_m2qp_sig_ctl) && M2QP_HANDLES_ERROR

        m2qp.sig.ctl = &m2qp_sig_null;

#   endif

#   if !defined(EXTF_m2qp_sig_a2p) && M2QP_HANDLES_A2P

        m2qp.sig.a2p    = &m2qp_sig_null;

#   endif



// These callbacks no longer available
//#   if !defined(EXTF_m2qp_sig_udp)
//        m2qp.sig.udp    = &m2qp_sig_null;
//#   endif
//#   if !defined(EXTF_m2qp_sig_scpkt) && M2_FEATURE(DATASTREAM)
//        m2qp.sig.scpkt  = &m2qp_sig_null;
//#   endif
//#   if !defined(EXTF_m2qp_sig_scack) && M2_FEATURE(M2DP)
//        m2qp.sig.scack  = &m2qp_sig_null;
//#   endif

#endif

    //Initialize to an undefined code value
    m2qp.cmd.code = 0x1F; 
    
    ///@note New patchwork code to accomodate universal ALP model.
    ///      Soon it will need buffers as well.
    alp_init(&m2alp, &rxq, &txq);
}