PortDirWrite: IOType=29
PortStateWrite, 7 Command Bytes: | |
0 | IOType=29 |
1-3 | WriteMask |
4-6 | Direction |
0 Response Bytes: | |
|
|
This IOType writes the direction of all digital I/O, where 0-7=FIO, 8-15=EIO, and 16-19=CIO. Note that the desired lines must be configured as digital (not analog).
WriteMask: Each bit specifies whether to update the corresponding bit of I/O.
Direction: Each bit of this value corresponds to the specified bit of I/O such that 1=Output and 0=Input. To configure all as input, Direction=d0. For all 20 standard digital I/O as output, Direction=d1048575. To configure FIO0-FIO2 as output, EIO0-EIO2 as output, CIO0 as output, and all other I/O as input (b000000010000011100000111), Direction=d67335.
Example
# PortDirWrite Feedback command
import u3
d = u3.U3()
d.debug = True
d.getFeedback(u3.PortDirWrite(Direction = [0xaa, 0xcc, 0xff], WriteMask = [0xff, 0xff, 0xff]))
# Sent: [0x91, 0xf8, 0x4, 0x0, 0x8f, 0x5, 0x0, 0x1d, 0xff, 0xff, 0xff, 0xaa, 0xcc, 0xff]
# Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]
# [None]