Module interface:userport - RMoX userport interface

RMoX userport interface. The "userport" infrastructure provides a generic way of handling general-purpose I/O interfaces with digital and analogue ports.

Ports are consecutively numbered from 0, and can be digital or analogue, with fixed or variable direction. Digital ports are single bits. Analogue ports deal with analogue values; see USERPORT.INFO for how these values are represented as integers.

Drivers that provide a userport interface must implement the IOCTL.USERPORT.OPEN IOCTL, returning either an error, or ERR.SUCCESS followed by the client-end of a CT.USERPORT channel bundle.

Index

Declarations

userport.inc:24Group USERPORT.ATTR

Port attributes These values are ORed together to describe a port -- for example, the value USERPORT.ATTR.IN \/ USERPORT.ATTR.OUT \/ USERPORT.ATTR.DIGITAL describes a bidirectional digital port.

userport.inc:28Constant USERPORT.ATTR.MASK

VAL USERPORT.ATTR.MASK

Attribute mask

userport.inc:29Constant USERPORT.ATTR.IN

VAL USERPORT.ATTR.IN

Input port

userport.inc:30Constant USERPORT.ATTR.OUT

VAL USERPORT.ATTR.OUT

Output port

userport.inc:31Constant USERPORT.ATTR.TRISTATE

VAL USERPORT.ATTR.TRISTATE

Tristate (disconnected) port

userport.inc:32Constant USERPORT.ATTR.DIGITAL

VAL USERPORT.ATTR.DIGITAL

Digital port

userport.inc:33Constant USERPORT.ATTR.ANALOG

VAL USERPORT.ATTR.ANALOG

Analog port

userport.inc:34Constant USERPORT.ATTR.PWM

VAL USERPORT.ATTR.PWM

PWM port

userport.inc:35Constant USERPORT.ATTR.VIRTUAL

VAL USERPORT.ATTR.VIRTUAL

Virtual port (e.g. virtual PWM)

userport.inc:43Record USERPORT.INFO

DATA TYPE USERPORT.INFO

Describe the device.

userport.inc:46Variable analog.in.max

INT

Analogue input ports return values between 0 and this value - 1.

userport.inc:48Variable analog.out.max

INT

Analogue output ports accept values between 0 and this value - 1.

userport.inc:54Protocol P.USERPORT.IN

PROTOCOL P.USERPORT.IN

Requests to the user port.

userport.inc:57Tag get.info

get.info

Get information about the device

userport.inc:61Tag set.direction

set.direction; INT; INT

Set the direction of a port.

Parameters:

INT Port number
INT Direction (one of the USERPORT.ATTR constants)

userport.inc:67Tag read.digital

read.digital; INT; INT

Read digital input values. This reads a range of consecutive ports and gives you back their values packed into an INT; the LSB is the first port.

Parameters:

INT First port to read
INT Number of ports to read

userport.inc:74Tag set.digital

set.digital; INT; INT; INT

Set digital output values. This sets a range of consecutive ports from a value packed into an INT; the LSB is the first port.

Parameters:

INT First port to set
INT Number of ports to set
INT Value

userport.inc:76Tag read.analog

read.analog; INT

Read analogue input value

userport.inc:78Tag set.analog

set.analog; INT; INT

Set analogue output value

userport.inc:84Tag set.pwm

set.pwm; INT; INT; INT

Set PWM output value. This sets the PWM going values, times in micro-seconds.

Parameters:

INT Port number
INT Cycle period for PWM, 0 disables
INT High output time for PWM, when disabled 0 = output-low, otherwise output-high

userport.inc:89Tag read.pwm

read.pwm; INT

Read PWM input value. This reads the value of a PWM input (detected period and high-time), or queries current settings for an PWM output port.

Parameters:

INT Port number

userport.inc:92Protocol P.USERPORT.OUT

PROTOCOL P.USERPORT.OUT

Responses from the user port.

userport.inc:97Tag info

info; USERPORT.INFO; MOBILE []INT

Return information about the device.

Parameters:

USERPORT.INFO General information
MOBILE []INT Attributes for each port

userport.inc:99Tag digital

digital; INT

Return digital input values.

userport.inc:101Tag analog

analog; INT

Return analogue input value.

userport.inc:103Tag pwm

pwm; INT; INT

Return PWM input values.

userport.inc:106Channel type CT.USERPORT

RECURSIVE CHAN TYPE CT.USERPORT

User port interface.