13 Mar 2018 14:49:56 UTC
- Distribution: Device-FTDI
- Module version: 0.14
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (37 / 0 / 3)
- KwaliteeBus factor: 2
- % Coverage
- License: perl_5
- Download (40.88KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Device::FTDI::SPI- use an FTDI chip to talk the SPI protocol
This subclass of Device::FTDI::MPSSE provides helpers around the basic MPSSE to fully implement the SPI protocol.
$spi = Device::FTDI::SPI->new( %args )
In addition to the arguments taken by "new" in Device::FTDI::MPSSE, this constructor also accepts:
- mode => INT
The required SPI mode. Should be 0, 1, 2, or 3.
- wordsize => INT
The required wordsize. Values up to 32 are supported.
- clock_rate => INT
Sets the initial value of the bit clock rate; as per "set_clock_rate".
Any of the following methods documented with a trailing
->getcall return Future instances.
$i2c->set_clock_rate( $rate )->get
Sets the clock rate for data transfers, in units of bits per second.
$spi->set_spi_mode( $mode )->get
Sets the current SPI mode. This will affect the clock sense and the idle state of the
$spi->set_wordsize( $bits )->get
When set to a value smaller than 8, only the least significant bits of each word are used.
When set to a value greater than 8, the string values operated on will consist of wide characters, having codepoints greater than 255. Care should be taken not to treat these strings as Unicode text strings, as in general the values they contain may not be compatible with Unicode.
SSGPIO pin to LOW or HIGH state respectively. Normally these methods would not be required, as "read", "write" and "readwrite" perform these steps automatically. However, they may be useful when combined with the
$no_ssargument to split an SPI transaction over multiple method calls.
$spi->write( $words, $no_ss )->get
$words = $spi->read( $len, $no_ss )->get;
$words_in = $spi->readwrite( $words_out, $no_ss )->get;
Performs a full SPI write, or read-and-write operation, consisting of asserting the
SSpin, transferring bytes, and deasserting it again.
If the optional
$no_ssargument is true, then the
SSpin will not be adjusted. This is useful for combining multiple write or read operations into one SPI transaction.
If the wordsize is set to a value other than 8, the actual serial transfer is achieved by first reshaping the outbound data into 8-bit bytes with optionally a final bitmode transfer of between 1 and 7 bits, and reshaping inbound 8-bit bytes with this final bitmode transfer back into the required shape to be returned to the caller.
Paul Evans <email@example.com>
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|