sam/can_client.cpp
/**
 * \brief MCAN module initialization.
 *
 */
\brief MCAN module initialization.
\ brief MCAN module initialization .
void CanClient::ConfigureHardware()
{
    struct mcan_config config_mcan;
    mcan_get_config_defaults(&config_mcan);
    config_mcan.rx_fifo_0_overwrite = false;
    mcan_init(&mcan_instance, m_mcan_module, &config_mcan);
    mcan_enable_fd_mode(&mcan_instance);
    mcan_enable_test_mode(&mcan_instance);
    mcan_start(&mcan_instance);
    if(mcan_instance.hw == MCAN0)
    {
        irq_register_handler(MCAN0_INT0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+1);
    }
    else
    {
        irq_register_handler(MCAN1_INT0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY+1);
    }
    mcan_enable_interrupt
    (&mcan_instance,
     (mcan_interrupt_source) (MCAN_FORMAT_ERROR | MCAN_ACKNOWLEDGE_ERROR | MCAN_BUS_OFF | MCAN_RX_FIFO_0_LOST_MESSAGE));
}
void CanClient :: ConfigureHardware ( ) { struct mcan_config config_mcan ; mcan_get_config_defaults ( & config_mcan ) ; config_mcan . rx_fifo_0_overwrite = false ; mcan_init ( & mcan_instance , m_mcan_module , & config_mcan ) ; mcan_enable_fd_mode ( & mcan_instance ) ; mcan_enable_test_mode ( & mcan_instance ) ; mcan_start ( & mcan_instance ) ; if ( mcan_instance . hw == MCAN0 ) { irq_register_handler ( MCAN0_INT0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1 ) ; } else { irq_register_handler ( MCAN1_INT0_IRQn , configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1 ) ; } mcan_enable_interrupt ( & mcan_instance , ( mcan_interrupt_source ) ( MCAN_FORMAT_ERROR | MCAN_ACKNOWLEDGE_ERROR | MCAN_BUS_OFF | MCAN_RX_FIFO_0_LOST_MESSAGE ) ) ; }
\brief MCAN module initialization.
\ brief MCAN module initialization .
/* Initialize the module. */ //# loopback mode /* Enable interrupts for this MCAN module */