Changeset 23 in pacpussensors for trunk/CanGateway/driver/PeakCanDriver.cpp


Ignore:
Timestamp:
Aug 11, 2013, 11:19:01 AM (11 years ago)
Author:
aschildk
Message:

add PeakCanDriver write method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CanGateway/driver/PeakCanDriver.cpp

    r1 r23  
    144144short PeakCanDriver::sendFrame (struct CanFrame frame)
    145145{
     146    TPCANMsg msg;
     147    msg.MSGTYPE  = 0; //normal message
     148    //msg.MSGTYPE |= MSGTYPE_EXTENDED; //extended ?
     149    msg.ID = frame.id;
     150    msg.LEN = frame.dlc;
     151    memcpy(msg.DATA, frame.data, frame.dlc);
     152    if(CAN_Write(canDeviceHandle_, &msg)) {
     153        perror("application: CAN_Write()");
     154        return errno;
     155    }
    146156    return PSUCCESS;
    147157}
     
    164174    if ((errno = LINUX_CAN_Read_Timeout(canDeviceHandle_, &message, READ_TIMEOUT)))
    165175    {
    166       perror("application: CAN_Read()");
     176      //Timeout:
     177      //perror("application: CAN_Read()");
    167178      return errno;
    168179    }
Note: See TracChangeset for help on using the changeset viewer.