Changeset 89 in pacpussensors for trunk/CanGateway/Win32CanInterface.cpp


Ignore:
Timestamp:
Jul 28, 2015, 3:28:21 PM (9 years ago)
Author:
DHERBOMEZ Gérald
Message:

Add KVASER CAN driver support for CanGateway component. Tested only for Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CanGateway/Win32CanInterface.cpp

    r41 r89  
    44//
    55//  author:     Gerald Dherbomez
    6 //              Copyright Heudiasyc UMR UTC/CNRS 6599
     6//              Copyright Heudiasyc UMR UTC/CNRS 7253
    77//
    88//  version:    $Id: $
    99//
    10 //  purpose:    Windows specific management of the Can Interface
     10//  purpose:    Management of the Can Interface
    1111//
    1212*********************************************************************/
     
    115115  case XLVectorCard:
    116116    vectorXlLoop();
     117  case KvaserCard:
     118    kvaserLoop();
    117119    break;
    118120  default:
     
    145147/// The loop used for waiting CAN data from XL Vector card
    146148void Win32CanInterface::vectorXlLoop()
     149{
     150  while(continue_) {
     151    // Wait incoming data from the CAN bus
     152    if (canDriver_->receiveFrame(frame_) == 0) {
     153      receivedFrames_[counter_].time = road_time();
     154      receivedFrames_[counter_].timerange = 0;
     155      memcpy(&(receivedFrames_[counter_].frame), &frame_, sizeof(CanFrame));
     156      semaphore_->release();
     157      counter_++;
     158      counter_ = counter_ % receivedFramesArraySize_;
     159    }
     160  }
     161}
     162
     163/************************************************************************/
     164/// The loop used for waiting CAN data from Kvaser card
     165void Win32CanInterface::kvaserLoop()
    147166{
    148167  while(continue_) {
Note: See TracChangeset for help on using the changeset viewer.