Hauptseite   Module   Übersicht   Auflistung der Dateien   Datenstruktur-Elemente   Datei-Elemente   Beispiele  

examples_canEvents.c

Beispiel einer Callback Routine für die Treiber Ereignisse. Die Callback Routine muss bei canInit() angegeben werden.



int canEvents(struct can_api* c, double absTime, double relTime, ISRInfo *i)
{
                switch (i->msg)
                {
                case EV2PRG_RECEIVED:
                        TRACE("Data received and placed in i\n");
                        break;
                case EV2PRG_RECEIVED_STD:
                        TRACE("Data received and placed in i\n CAN Identifier has Standard Frame Format\n");
                        break;
                case EV2PRG_RECEIVED_EXT:
                        TRACE("Data received and placed in i\n CAN Identifier has Extended Frame Format\n");
                        break;
                case EV2PRG_TRANSMIT:
                        TRACE("Data transmitted and placed in i\n");
                        break;
                case EV2PRG_TRANSMIT_STD:
                        TRACE("Data transmitted and placed in i\n CAN Identifier has Standard Frame Format\n");
                        break;
                case EV2PRG_TRANSMIT_EXT:
                        TRACE("Data transmitted and placed in i\n CAN Identifier has Extended Frame Format\n");
                        break;
                case EV2PRG_BUSERROR:
                        TRACE("Bus error occured\n");
                        break;
                case EV2PRG_WARNING:
                        TRACE("Warning error occured\n");
                        break;
                case EV2PRG_PASSIVE:
                        TRACE("Passive error occured\nSJA1000 is now passive\n");
                        break;
                case EV2PRG_ARBITRATION:
                        TRACE("Arbitration error occured\n");
                        break;
                case EV2PRG_WAKEUP:
                        TRACE("Wakeup occured\n");
                        break;
                case EV2PRG_OVERRUN:
                        TRACE("Overrun occured\nSome messages are lost\n");
                        break;
                }

        return 0;
}

Erzeugt am Tue Oct 15 22:28:39 2002 für CAN API von doxygen1.2.18