From 5fdc15c3020c9a2d6da125f8cdc0915df12dadf2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 1 May 2012 12:51:08 +0100 Subject: [PATCH] doc: A few whitespace tweaks in program listings --- demo/tut3_part.c | 3 +- doc/other.xml | 354 ++++++++++++++++++++++++----------------------- 2 files changed, 183 insertions(+), 174 deletions(-) diff --git a/demo/tut3_part.c b/demo/tut3_part.c index 1daa708..2e2abe0 100644 --- a/demo/tut3_part.c +++ b/demo/tut3_part.c @@ -104,7 +104,8 @@ * This prepares a command in a pretty generic way. We ask the * library to create a stock command that supports periodic * sampling of data, then modify the parts we want. */ -int prepare_cmd_lib(comedi_t *dev, int subdevice, int n_scan, int n_chan, unsigned scan_period_nanosec, comedi_cmd *cmd) +int prepare_cmd_lib(comedi_t *dev, int subdevice, int n_scan, int n_chan, + unsigned scan_period_nanosec, comedi_cmd *cmd) { int ret; diff --git a/doc/other.xml b/doc/other.xml index ee90642..1d83b10 100644 --- a/doc/other.xml +++ b/doc/other.xml @@ -1,6 +1,6 @@ %comedilib_entities; ]> @@ -58,8 +58,10 @@ digital subdevices on a particular board. Individual bits on a digital I/O device can be read and written using the functions - int comedi_dio_read(device,subdevice,channel,unsigned int *bit); - int comedi_dio_write(device,subdevice,channel,unsigned int bit); +int comedi_dio_read(comedi_t *device, unsigned int subdevice, unsigned int channel, + unsigned int *bit); +int comedi_dio_write(comedi_t *device, unsigned int subdevice, unsigned int channel, + unsigned int bit); The device parameter is a pointer @@ -74,7 +76,8 @@ contains the value of the acquired bit. The direction of bidirectional lines can be configured using the function - comedi_dio_config(device,subdevice,channel,unsigned int dir); +int comedi_dio_config(comedi_t *device, unsigned int subdevice, unsigned int channel, + unsigned int dir); The parameter dir should be either COMEDI_INPUT or @@ -88,7 +91,8 @@ the entire block. Multiple channels can be read and written simultaneously using the function - comedi_dio_bitfield(device,subdevice,unsigned int write_mask,unsigned int *bits); +int comedi_dio_bitfield(comedi_t *device, unsigned int subdevice, + unsigned int write_mask, unsigned int *bits); Each channel is assigned to a bit in the write_mask and @@ -131,25 +135,26 @@ the range of, typically, 8, 10, The - int comedi_data_read(comedi_t * device, unsigned int subdevice, unsigned int channel, - unsigned int range, unsigned int aref, lsampl_t * data); +int comedi_data_read(comedi_t *device, unsigned int subdevice, unsigned int channel, + unsigned int range, unsigned int aref, lsampl_t * data); function reads one such data value from a &comedi; channel, and puts it in the user-specified data buffer. The - int comedi_data_write(comedi_t * device, unsigned int subdevice, unsigned int channel, - unsigned int range, unsigned int aref, lsampl_t data); +int comedi_data_write(comedi_t *device, unsigned int subdevice, unsigned int channel, + unsigned int range, unsigned int aref, lsampl_t data); works in the opposite direction. Data values returned by this function are unsigned integers less than, or equal to, the maximum sample value of the channel, which can be determined using the function - lsampl_t comedi_get_maxdata(comedi_t * device, unsigned int subdevice, unsigned int channel); +lsampl_t comedi_get_maxdata(comedi_t *device, unsigned int subdevice, + unsigned int channel); Conversion of data values to physical units can be performed by the function - double comedi_to_phys(lsampl_t data, comedi_range * range, lsampl_t maxdata); +double comedi_to_phys(lsampl_t data, comedi_range * range, lsampl_t maxdata); There are two data structures in these commands that are not fully self-explanatory: @@ -188,8 +193,8 @@ function call are checked. If multiple acquisitions must be done on the same channel, this overhead can be avoided by using a function that can read more than one sample: - int comedi_data_read_n(comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, - unsigned int aref, lsampl_t *data, unsigned int n) +int comedi_data_read_n(comedi_t *it, unsigned int subdev, unsigned int chan, + unsigned int range, unsigned int aref, lsampl_t *data, unsigned int n); The number of samples, n, is limited by the &comedi; implementation (to a maximum of 100 samples), @@ -199,8 +204,9 @@ because the call is blocking. The start of the data acquisition can also be delayed by a specified number of nano-seconds: -int comedi_data_read_delayed(comedi_t *it, unsigned int subdev, unsigned int chan, unsigned int range, - unsigned int aref, lsampl_t *data, unsigned int nano_sec) +int comedi_data_read_delayed(comedi_t *it, unsigned int subdev, unsigned int chan, + unsigned int range, unsigned int aref, lsampl_t *data, + unsigned int nano_sec); All these read and write acquisition functions are implemented on top of the generic instruction @@ -245,7 +251,7 @@ All the information needed to execute an instruction is stored in the comedi_insn data structure: -struct comedi_insn_struct{ +struct comedi_insn_struct { unsigned int insn; // integer encoding the type of acquisition // (or configuration) unsigned int n; // number of elements in data array @@ -317,7 +323,7 @@ Instruction execution Once an instruction data structure has been filled in, the corresponding instruction is executed as follows: - int comedi_do_insn(comedi_t *it, comedi_insn * instruction); +int comedi_do_insn(comedi_t *it, comedi_insn *instruction); Many &comedi; instructions are shortcuts that relieve the programmer from explicitly filling in the data structure and calling the @@ -327,7 +333,7 @@ function. The - int comedi_do_insnlistcomedi_t *it, comedi_insnlist * list) +int comedi_do_insnlist(comedi_t *it, comedi_insnlist *list) instruction allows to perform a list of instructions in one function call. The number of instructions in the list is limited in the @@ -580,7 +586,7 @@ Executing a command A commands is executed by the following &comedi; function: - int comedi_command(comedi_t * device, comedi_cmd * command); +int comedi_command(comedi_t *device, comedi_cmd *command); The following sections explain the meaning of the comedi_cmd data structure. @@ -618,7 +624,7 @@ acquisition, which is stored in the typedef struct comedi_cmd_struct comedi_cmd; -struct comedi_cmd_struct{ +struct comedi_cmd_struct { unsigned int subdev; // which subdevice to sample unsigned int flags; // encode some configuration possibilities // of the command execution; e.g., @@ -1188,13 +1194,14 @@ As you might have guessed, the &comedi; library has functions to help you in your quest to accurately measure slowly varying inputs: - int comedi_sv_init(comedi_sv_t * sv, comedi_t * device, unsigned int subdevice, unsigned int channel); +int comedi_sv_init(comedi_sv_t *sv, comedi_t *device, unsigned int subdevice, + unsigned int channel); This function initializes the comedi_sv_t data structure, used to do the averaging acquisition: -struct comedi_sv_struct{ +struct comedi_sv_struct { comedi_t *dev; unsigned int subdevice; unsigned int chan; @@ -1211,7 +1218,7 @@ struct comedi_sv_struct{ The actual acquisition is done with: - int comedi_sv_measure(comedi_sv_t * sv, double * data); +int comedi_sv_measure(comedi_sv_t *sv, double *data); The number of samples over which the comedi_sv_measure() averages is limited by the @@ -2005,78 +2012,78 @@ An example to set up a device as a master is given below. @@ -2088,86 +2095,87 @@ external clock source instead of using its internal clock directly (for best syncronization). -- 2.26.2