Changeset 23 in pacpussensors for trunk/CanGateway


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

add PeakCanDriver write method

Location:
trunk/CanGateway/driver
Files:
2 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    }
  • trunk/CanGateway/driver/PeakCanDriver.h

    r1 r23  
    1818
    1919#include "CanDriverBase.h"
    20 #include "libpcan.h"
     20#include <libpcan.h>
    2121#include <fcntl.h>    // O_RDWR
    2222#include <errno.h>
     
    2424
    2525#define PSUCCESS                     0
    26 #define READ_TIMEOUT                100000 // 100 miliseconds timeout
     26#define READ_TIMEOUT                100000// 100 miliseconds timeout
    2727
    2828class PeakCanDriver : public CanDriverBase
Note: See TracChangeset for help on using the changeset viewer.