Datasheet
Write methods
The next step is to write the c-code for the methods.
The c-file ra_io_m_motioncontrol_usbio.c are created on $pwrp_src.
As Proview has a GPL license, also the code for the methods has to be GPL licensed if the program
is distributed to other parties. We therefor put a GPL header in the beginning of the file.
To simplify the code we limit our use of USB I/O to a configuration where channel 0-3 are digital
outputs, 4-7 digital inputs, 8-15 analog inputs, 16-18 digital inputs and 19-20 analog outputs.
ra_io_m_motioncontrol_usbio.c
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelรถsund.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_cvolmerk1classes.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_card_read.h"
#include "rt_io_card_write.h"
#include "rt_io_msg.h"
#include "libusbio.h"
typedef struct {
int USB_Handle;
} io_sLocal;
// Init method
static pwr_tStatus IoCardInit( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp)
{
int i;
int timeout;
io_sLocal *local;
pwr_sClass_MotionControl_USBIO *op = (pwr_sClass_MotionControl_USBIO *)cp->op;
local = (io_sLocal *) calloc( 1, sizeof(io_sLocal));
cp->Local = local;










